Zhuinden / flowless

[DEPRECATED] Based on Flow 1.0-alpha. To keep your life simple, use zhuinden/simple-stack instead.
Apache License 2.0
141 stars 7 forks source link

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

Closed Zhuinden closed 7 years ago

Zhuinden commented 7 years ago

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:

Zhuinden commented 7 years ago

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.

Zhuinden commented 7 years ago

fixed by https://github.com/Zhuinden/flowless/commit/d5b70c28b5ef2fb4dc89feac4d0584ee9ab5ca0a