removing impossible case
This commit is contained in:
parent
93a247e0ce
commit
32389a9b33
|
@ -246,21 +246,15 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
private fun handleLoginWithToken(action: OnboardingAction.LoginWithToken) {
|
private fun handleLoginWithToken(action: OnboardingAction.LoginWithToken) {
|
||||||
val safeLoginWizard = loginWizard
|
val safeLoginWizard = loginWizard
|
||||||
|
setState { copy(isLoading = true) }
|
||||||
|
|
||||||
if (safeLoginWizard == null) {
|
currentJob = viewModelScope.launch {
|
||||||
setState { copy(isLoading = false) }
|
try {
|
||||||
_viewEvents.post(OnboardingViewEvents.Failure(Throwable("Bad configuration")))
|
val result = safeLoginWizard.loginWithToken(action.loginToken)
|
||||||
} else {
|
onSessionCreated(result, authenticationDescription = AuthenticationDescription.Login)
|
||||||
setState { copy(isLoading = true) }
|
} catch (failure: Throwable) {
|
||||||
|
setState { copy(isLoading = false) }
|
||||||
currentJob = viewModelScope.launch {
|
_viewEvents.post(OnboardingViewEvents.Failure(failure))
|
||||||
try {
|
|
||||||
val result = safeLoginWizard.loginWithToken(action.loginToken)
|
|
||||||
onSessionCreated(result, authenticationDescription = AuthenticationDescription.Login)
|
|
||||||
} catch (failure: Throwable) {
|
|
||||||
setState { copy(isLoading = false) }
|
|
||||||
_viewEvents.post(OnboardingViewEvents.Failure(failure))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue