A fully functional Android app built entirely with Kotlin and Jetpack Compose
Replace workaround on SettingsViewModel now that a fix has been deployed
Simon Marquisb043d8db8691
diff --git a/feature/settings/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt b/feature/settings/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.ktindex a49c0d512..123c84d1c 100644--- a/feature/settings/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt+++ b/feature/settings/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt@@ -24,12 +24,13 @@ import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrandimport com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Loadingimport com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Successimport dagger.hilt.android.lifecycle.HiltViewModel-import kotlinx.coroutines.flow.SharingStarted+import kotlinx.coroutines.flow.SharingStarted.Companion.WhileSubscribedimport kotlinx.coroutines.flow.StateFlowimport kotlinx.coroutines.flow.mapimport kotlinx.coroutines.flow.stateInimport kotlinx.coroutines.launchimport javax.inject.Inject+import kotlin.time.Duration.Companion.seconds@HiltViewModelclass SettingsViewModel @Inject constructor(@@ -48,13 +49,7 @@ class SettingsViewModel @Inject constructor(}.stateIn(scope = viewModelScope,- // Starting eagerly means the user data is ready when the SettingsDialog is laid out- // for the first time. Without this, due to b/221643630 the layout is done using the- // "Loading" text, then replaced with the user editable fields once loaded, however,- // the layout height doesn't change meaning all the fields are squashed into a small- // scrollable column.- // TODO: Change to SharingStarted.WhileSubscribed(5_000) when b/221643630 is fixed- started = SharingStarted.Eagerly,+ started = WhileSubscribed(5.seconds.inWholeMilliseconds),initialValue = Loading,)