Guilherme Delgado
06/22/2022, 1:25 PMMikolaj Leszczynski
06/22/2022, 1:28 PMGuilherme Delgado
06/22/2022, 1:29 PMappmattus
06/22/2022, 7:15 PMMikolaj Leszczynski
06/24/2022, 12:37 PMGuilherme Delgado
06/24/2022, 12:38 PMMikolaj Leszczynski
06/24/2022, 12:39 PMGuilherme Delgado
06/24/2022, 12:40 PMit increases the API surface for little reason other than making it easier for a small subset of ppl to hide the containercould be a small subset of ppl because they probably don’t mind, but actually having the container “public” kind of scratches my OCD 😅 so yeah I think it’s better not to be able to do something like: viewmodel.container.intent … in the view
the functions feel like they are better placed as part of something like androidx.compose.runtime or a separate library, especially given there is no orbit code in the new functionscompletely agree 👍
Mikolaj Leszczynski
06/24/2022, 12:42 PMContainerHost
to call _container.intent
instead of simply intent
Guilherme Delgado
06/24/2022, 12:44 PM/**
* Just to keep it private without public access.
* @param initialState The initial state of the container.
*/
internal fun <STATE : Any, SIDE_EFFECT : Any> CoroutineScope.containerHostVisibilityWrapper(initialState: STATE) =
object : ContainerHost<STATE, SIDE_EFFECT> {
override val container = this@containerHostVisibilityWrapper.container<STATE, SIDE_EFFECT>(initialState)
}
/**
* Just to keep it private without public access.
*/
fun <STATE : Parcelable, SIDE_EFFECT : Any> ViewModel.containerHostVisibilityWrapper(
initialState: STATE,
savedStateHandle: SavedStateHandle,
onCreate: ((state: STATE) -> Unit)? = null
) =
object : ContainerHost<STATE, SIDE_EFFECT> {
override val container =
this@containerHostVisibilityWrapper.container<STATE, SIDE_EFFECT>(initialState, savedStateHandle = savedStateHandle, onCreate = onCreate)
}
android world ^appmattus
06/24/2022, 12:55 PM