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 🐛: Bugfix 🐛:
- Improve support for image/audio/video/file selection with intent changes (#1376) - Improve support for image/audio/video/file selection with intent changes (#1376)
- Fix Splash layout on small screens - Fix Splash layout on small screens
- Invalid popup when pressing back (#1635)
Translations 🗣: Translations 🗣:
- -

View File

@ -419,10 +419,15 @@ class LoginViewModel @AssistedInject constructor(
loginConfig = action.loginConfig loginConfig = action.loginConfig
// If there is a pending email validation continue on this step // If there is a pending email validation continue on this step
currentThreePid?.let { try {
if (isRegistrationStarted) { if (registrationWizard?.isRegistrationStarted == true) {
handle(LoginAction.PostViewEvent(LoginViewEvents.OnSendEmailSuccess(it))) 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) { private fun onSessionCreated(session: Session) {
activeSessionHolder.setActiveSession(session) activeSessionHolder.setActiveSession(session)
authenticationService.reset()
session.configureAndStart(applicationContext) session.configureAndStart(applicationContext)
setState { setState {
copy( copy(
@ -747,7 +753,7 @@ class LoginViewModel @AssistedInject constructor(
override fun onSuccess(data: LoginFlowResult) { override fun onSuccess(data: LoginFlowResult) {
when (data) { when (data) {
is LoginFlowResult.Success -> { is LoginFlowResult.Success -> {
val loginMode = when { val loginMode = when {
// SSO login is taken first // SSO login is taken first
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso