mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-29 11:02:35 +01:00
Login screens: reset SDK when home server url is deleted
This commit is contained in:
parent
aa51764068
commit
fd90f3b9fc
@ -52,6 +52,11 @@ interface AuthenticationService {
|
||||
*/
|
||||
fun cancelPendingLoginOrRegistration()
|
||||
|
||||
/**
|
||||
* Reset all pending settings, including current HomeServerConnectionConfig
|
||||
*/
|
||||
fun reset()
|
||||
|
||||
/**
|
||||
* Check if there is an authenticated [Session].
|
||||
* @return true if there is at least one active session.
|
||||
|
@ -166,6 +166,15 @@ internal class DefaultAuthenticationService @Inject constructor(@Unauthenticated
|
||||
}
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
currentLoginWizard = null
|
||||
currentRegistrationWizard = null
|
||||
|
||||
GlobalScope.launch(coroutineDispatchers.main) {
|
||||
pendingSessionStore.delete()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig,
|
||||
credentials: Credentials,
|
||||
callback: MatrixCallback<Session>): Cancelable {
|
||||
|
@ -240,7 +240,8 @@ class LoginViewModel @AssistedInject constructor(@Assisted initialState: LoginVi
|
||||
|
||||
when (action) {
|
||||
LoginAction.ResetLogin -> {
|
||||
// TODO Clear wizard here?
|
||||
authenticationService.cancelPendingLoginOrRegistration()
|
||||
|
||||
setState {
|
||||
copy(
|
||||
asyncLoginAction = Uninitialized,
|
||||
@ -249,7 +250,7 @@ class LoginViewModel @AssistedInject constructor(@Assisted initialState: LoginVi
|
||||
}
|
||||
}
|
||||
LoginAction.ResetHomeServerUrl -> {
|
||||
authenticationService.cancelPendingLoginOrRegistration()
|
||||
authenticationService.reset()
|
||||
|
||||
setState {
|
||||
copy(
|
||||
|
Loading…
Reference in New Issue
Block a user