Zhuinden / flowless

[DEPRECATED] Based on Flow 1.0-alpha. To keep your life simple, use zhuinden/simple-stack instead.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Re-think `ForceBundler.saveToBundle()` and `onSaveInstanceState()`

Zhuinden opened this issue · comments

https://github.com/Zhuinden/flowless/blob/master/flowless-library/src/main/java/flowless/ForceBundler.java#L12-L26

It is currently called from preSaveViewState() in SingleRootDispatcher (before super.onSaveInstanceState()), but this callback can be missed by users of SingleRootDispatcher. Also, currently toBundle() is used to create the bundle, and is mapped to the state directly.

But what if we want nested dispatchers (multiple nested container dispatchers, for example) and we don't want to write event delegation logic (and just use an encapsulated single root dispatcher instead)?

Question is:

  • Composite state management
  • calling preSaveViewState() manually
  • ForceBundler API (how to directly access keyManager without access to Activity, should it need the activity?)

Solution will be to keep preSaveViewState() for doing things before onSaveInstanceState() and will be a manual call, BUT also add onSaveInstanceState() integration to InternalLifecycleIntegration to automatically provide Bundleable call through SingleRootDispatcher.

fixed by d5b70c2