Lukasz Kalnik
08/25/2022, 4:54 PMdata
layer:
• ...Api
suffix for the Retrofit interface definitions (e.g. MoviesApi
)
• ...Repository
suffix for the class that abstracts away the Api
.
domain
layer:
• ...UseCase
for commonly used, well, use cases, they usually depend on Repository
(although often we skip this layer altogether)
presentation
layer:
• obviously ...ViewModel
here.
I'm asking because I have a ViewModel
which grew really large, so I would like to split it in multiple viewmodels. However they all share common view data to some degree, so have to depend on a single source of truth in the presentation layer. And I was wondering how to call such single source of truth in the presentation layer.Lukasz Kalnik
08/25/2022, 4:57 PMdata
layer Repository
to a DataProvider
and then I could use Repository
in the presentation
layer as a source of truth for the viewmodels.gts13
08/27/2022, 1:27 PMdata/
• network/
◦ api.interface
◦ client.class
(encapsulates the api)
• db/
◦ ...Dao
• localstorage/
◦ PreferencesManager
(contains shared preferences)
• repositories/
◦ AccountRepositoryImpl
(the AccountRepository
interface resides in the domain layer)
◦ AnotherRepositoryImpl
domain/
• repositories/
◦ AccountRepository
• usecases/
◦ ...Lukasz Kalnik
08/27/2022, 3:05 PMRafs
08/27/2022, 4:19 PMLukasz Kalnik
08/27/2022, 4:48 PMgts13
08/28/2022, 8:59 AMLukasz Kalnik
08/29/2022, 8:21 AMLukasz Kalnik
08/29/2022, 8:22 AM