Does it violating any conventions? Is it acceptable by MVVM? I have to separate the local data repository and online repository, but for login I have to use multiple repositories for getting response from API and saving credentials if they are correct
I have implemented it just by editing the ViewModelFactory as following
object AppViewModelProvider {
val Factory = viewModelFactory {
initializer {
PostCardsListViewModel(application().container.defaultPosterRepository)
}
initializer {
LoginScreenViewModel(
application().container.defaultPosterRepository,
application().container.defaultUserLoginRepository
)
}
}
}
fun CreationExtras.application() =
(this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY] as PosterApplication)
I know I can create a domain layer, but this app is as simple as heck, so this case will be the only reason for creating a new layer, but if I want it to be clean I have to refactor the whole project and make use-cases for every usage of repository