Zhuinden / simple-stack

[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).
Apache License 2.0
1.36k stars 76 forks source link

Dagger-Hilt integration sample #225

Closed Zhuinden closed 3 years ago

Zhuinden commented 4 years ago

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.

Zhuinden commented 4 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. 🤔

https://github.com/google/dagger/issues/1870

Zhuinden commented 4 years ago

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.

Zhuinden commented 4 years ago

This really does require more investigation. And a good sample to be able to verify what we're trying to accomplish.

Zhuinden commented 3 years ago

Zhuinden commented 3 years ago

EntryPoints are so tricky, this would only happen in a separate repository.