Introduced RetainedInstanceStore to keep data during config change#361
Conversation
dcf4973 to
626a79b
Compare
626a79b to
af8cbce
Compare
|
Originally I wanted to suggest to adopt #322 instead, but after I checked API I do not want anymore (ViewModels API is a hell, you can't just pass ViewModel factory as a lambda). But my suggestion is still to apply its approach regarding Would like to invite more people to discuss. |
af8cbce to
3685fa6
Compare
|
@CherryPerry I'm happy if we can come up with another solution. This PR allows Devs to retained objects within the builder which is useful of you're using MVICore. The ViewModel approach in the other PR doesn't seem to have this functionality. Perhaps we could support both? As devs using the builder/interactor approach need a solution as well |
3685fa6 to
18fd6ae
Compare
| } | ||
|
|
||
| fun <T : NodeCustomisation> getOrDefault(defaultCustomisation: T) : T = | ||
| val identifier: String by lazy { |
There was a problem hiding this comment.
Make this internal?
There was a problem hiding this comment.
Add a comment at the very least saying to not use it, Incubating?
There was a problem hiding this comment.
We cannot make this internal unfortunately. Not sure if I should mark this with a comment as this will be part of the 1.0 API
| private val map: MutableMap<String, MutableMap<KClass<*>, ValueHolder<*>>> = HashMap() | ||
|
|
||
| @Suppress("UNCHECKED_CAST") | ||
| override fun <T : Any> get(nodeId: String, clazz: KClass<*>, disposer: (T) -> Unit, factory: () -> T): T = |
There was a problem hiding this comment.
Use a string key instead of the class so that multiple instance of the same class can be used.
eca3a97 to
5d629d2
Compare
libraries/core/src/test/kotlin/com/bumble/appyx/core/store/RetainedInstanceStoreTest.kt
Outdated
Show resolved
Hide resolved
libraries/core/src/main/kotlin/com/bumble/appyx/core/store/RetainedInstanceStore.kt
Outdated
Show resolved
Hide resolved
libraries/core/src/test/kotlin/com/bumble/appyx/core/store/RetainedInstanceStoreTest.kt
Show resolved
Hide resolved
eb7fd4d to
50d47f4
Compare
50d47f4 to
af69578
Compare
af69578 to
fe8d961
Compare
Description
Copied the RetainedInstanceStore concept from RIBs so that objects can be retained during a configuration change.
Also re-added the MVICore screens to the sandbox to demonstrate the behaviour
Check list
CHANGELOG.mdif required.