https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
o

Orhan Tozan

05/17/2020, 4:34 PM
When using Koin/Dagger, is it usual to instantiate a repository on login and delete it on logout? Or maintain a single repository during the app's lifecycle, and clear it's cache when logging out?
s

Saurabh

05/18/2020, 5:04 AM
If I get your question right, your first idea is to create a subcomponent for login flow and have something like a
LoginRepository
in scope only when this LoginComponent is active, right.
I have implemented both of the ways you mentioned before (If my assumption above is correct). I like the subcomponent approach better.
g

gildor

05/18/2020, 8:23 AM
Subcomponent approach is probably better solution, you may create dependencies with data available only for login user in constructor
4 Views