luke_c
02/25/2021, 3:53 PMwhenStarted
?
viewLifecycleOwner.lifecycleScope.launch {
val response = fetchConfig()
when (response) {
is ConfigResponse -> {
whenStarted {
goToNextScreen()
}
}
Error -> showError()
}
}
Martyna Maron
02/25/2021, 4:54 PMwhenStarted
help here? If you background the app and let the coroutine finish, on foregrounding the app, is goToNextScreen()
triggered?
According to the docs should the fetchConfig
be wrapped in whenStarted
too? 🤔luke_c
02/25/2021, 5:04 PMwhenStarted
then goToNextScreen()
gets triggered when the app is in the background leading to an exceptionAdam Powell
02/25/2021, 5:11 PMlifecycle-runtime-ktx
that you might find useful: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:lifecycl[…]a/androidx/lifecycle/RepeatOnLifecycle.kt?q=repeatOnLifecycle