Login screens: fix crash on back navigation

This commit is contained in:
Benoit Marty 2019-11-28 12:09:28 +01:00
parent 29f32cf8eb
commit 33925fcf57
3 changed files with 9 additions and 1 deletions

View file

@ -47,6 +47,11 @@ interface AuthenticationService {
*/
fun getRegistrationWizard(): RegistrationWizard
/**
* True when login and password has been sent with success to the homeserver
*/
val isRegistrationStarted: Boolean
/**
* Cancel pending login or pending registration
*/

View file

@ -134,6 +134,9 @@ internal class DefaultAuthenticationService @Inject constructor(@Unauthenticated
}
}
override val isRegistrationStarted: Boolean
get() = currentRegistrationWizard?.isRegistrationStarted == true
override fun getLoginWizard(): LoginWizard {
return currentLoginWizard
?: let {

View file

@ -70,7 +70,7 @@ class LoginViewModel @AssistedInject constructor(@Assisted initialState: LoginVi
// True when login and password has been sent with success to the homeserver
val isRegistrationStarted: Boolean
get() = registrationWizard?.isRegistrationStarted == true
get() = authenticationService.isRegistrationStarted
private val registrationWizard: RegistrationWizard?
get() = authenticationService.getRegistrationWizard()