Another evil hack for Android where I found no bet...
# kodein
m
Another evil hack for Android where I found no better solution so far. In MVP, a
KodeinAware
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:
Copy code
val property: SomethingSessionDependent by kodein.on { direct.instance<AuthenticationManager>().session ?: error("not signed in") }