Marc Knaup
03/31/2020, 7:01 AMKodeinAware
Presenter
for an Activity
can be instantiated either with or without a Session
- depending on whether a user is signed-in to the app or not.
Depending on whether a Session
is available, some dependencies in the Presenter
won’t ever be accessed. These dependencies should only be instantiated if there is a Session
and have their lifetime bound to the Session
.
I think the only alternative is a whole lot of the following across all presenters:
val property: SomethingSessionDependent by kodein.on { direct.instance<AuthenticationManager>().session ?: error("not signed in") }