Closed Zhuinden closed 3 years ago
They say the only scopes Hilt supports is Activity, Fragment, and ActivityViewModel scopes, so that means Simple-Stack is actually more powerful because that's basically GlobalScope and ScreenScope, but not SharedScope (GlobalServices, ScopeKey and ScopeKey.Child)
No mention of getting a reference to a SavedStateRegistry either. 🤔
It's actually not that bad. Stuff installed as unscoped in the ApplicationComponent would work well. Maybe the ones installed in ActivityRetainedComponent, too.
The Activity and Fragment scopes are kind of a lie, but they could be given modules that use lookup
.
This really does require more investigation. And a good sample to be able to verify what we're trying to accomplish.
EntryPoints are so tricky, this would only happen in a separate repository.
Although the first question is, is it even possible to get a reference to the ActivityRetainedComponent, and if it's possible to create a scope between an Activity and a Fragment without writing some custom annotation processor magic (whatever Jetpack Navigation will do to support retaining objects to a NavGraph scope).
If it's not possible to scope things to a NavGraph-scope, then Dagger-Hilt is a trap.