Delete pending session store and states after session is created.

This commit is contained in:
Onuray Sahin 2020-10-06 17:02:49 +03:00
parent 1f4a360a0c
commit 3877b2f58e
2 changed files with 11 additions and 4 deletions

View File

@ -17,6 +17,7 @@ Improvements 🙌:
Bugfix 🐛:
- Improve support for image/audio/video/file selection with intent changes (#1376)
- Fix Splash layout on small screens
- Invalid popup when pressing back (#1635)
Translations 🗣:
-

View File

@ -419,10 +419,15 @@ class LoginViewModel @AssistedInject constructor(
loginConfig = action.loginConfig
// If there is a pending email validation continue on this step
currentThreePid?.let {
if (isRegistrationStarted) {
handle(LoginAction.PostViewEvent(LoginViewEvents.OnSendEmailSuccess(it)))
try {
if (registrationWizard?.isRegistrationStarted == true) {
currentThreePid?.let {
handle(LoginAction.PostViewEvent(LoginViewEvents.OnSendEmailSuccess(it)))
}
}
} catch (e: Throwable) {
// NOOP. API is designed to use wizards in a login/registration flow,
// but we need to check the state anyway.
}
}
@ -679,6 +684,7 @@ class LoginViewModel @AssistedInject constructor(
private fun onSessionCreated(session: Session) {
activeSessionHolder.setActiveSession(session)
authenticationService.reset()
session.configureAndStart(applicationContext)
setState {
copy(
@ -747,7 +753,7 @@ class LoginViewModel @AssistedInject constructor(
override fun onSuccess(data: LoginFlowResult) {
when (data) {
is LoginFlowResult.Success -> {
is LoginFlowResult.Success -> {
val loginMode = when {
// SSO login is taken first
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso