How can a dependency be scoped to a sharedViewModel and then be injected into a non-shared viewModel?
Alex
03/04/2021, 3:48 PM
In Practice there is a container fragment, which is the host of a sharedViewModel, which holds a repository, which should be available to all subfragments of the container fragment('s viewmodels)
Alex
03/04/2021, 3:49 PM
the repository instance should be scoped to the sharedViewModel
a
arnaud.giuliani
03/05/2021, 8:54 AM
How can a dependency be scoped to a sharedViewModel and then be injected into a non-shared viewModel?
seems really weird usecase
arnaud.giuliani
03/05/2021, 8:54 AM
perhaps ViewModel is not the tool you need
a
Alex
03/08/2021, 8:55 AM
Our UseCase is basically a screen flow of a couple of subscreens contained in a parentFragment (think a viewpager inside a parent fragment).
Every subscreen is a part of a form, which in the end will fill a data class which is then submitted.
The data class is stored inside of a repo. The repo should be available for every subscreen, but cleared when the whole form (the parentFragment) is closed.
Alex
03/08/2021, 8:58 AM
Maybe it's a weird usecase, but its just an extension of scoping. The repo should be scoped to the lifecycle of the sharedViewModel.