Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-03 12:01:36 +02:00
parent 2a61e32f0c
commit 31bfe75e14

View file

@ -31,14 +31,12 @@ internal class WelcomeViewModel @Inject constructor(
private val stateInternal = MutableStateFlow(WelcomeScreenState())
val state: StateFlow<WelcomeScreenState> = stateInternal
init {
override fun onCreate(owner: LifecycleOwner) {
store.dispatch(WelcomeAction.SetCoroutineScope(viewModelScope))
subscribeToStoreChanges()
initGlobalState()
}
override fun onCreate(owner: LifecycleOwner) {
val welcomeAction = if (initialIntent != null) {
WelcomeAction.ProceedWithIntent(initialIntent)
} else {
@ -81,9 +79,10 @@ internal class WelcomeViewModel @Inject constructor(
}
}
override fun onCleared() {
override fun onDestroy(owner: LifecycleOwner) {
store.dispatch(WelcomeAction.ClearCoroutineScope)
store.unsubscribe(this)
super.onDestroy(owner)
}
private fun createWarningIfNeeded(error: TangemError?): WarningModel? {