handling the legacy onboarding complete navigation by inferring the auth description from the sign mode

- the type is set to other as the legacy viewmodel doesn't support tracking the sso provider
This commit is contained in:
Adam Brown 2022-06-06 11:38:29 +01:00
parent 6fcbd24ce1
commit 49930773e7

View File

@ -42,6 +42,7 @@ import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.home.HomeActivity
import im.vector.app.features.login.terms.LoginTermsFragment
import im.vector.app.features.login.terms.LoginTermsFragmentArgument
import im.vector.app.features.onboarding.AuthenticationDescription
import im.vector.app.features.pin.UnlockedActivity
import org.matrix.android.sdk.api.auth.registration.FlowResult
import org.matrix.android.sdk.api.auth.registration.Stage
@ -218,7 +219,8 @@ open class LoginActivity : VectorBaseActivity<ActivityLoginBinding>(), UnlockedA
// change the screen name
analyticsScreenName = MobileScreen.ScreenName.Register
}
val intent = HomeActivity.newIntent(this)
val authDescription = inferAuthDescription(loginViewState)
val intent = HomeActivity.newIntent(this, authenticationDescription = authDescription)
startActivity(intent)
finish()
return
@ -228,6 +230,13 @@ open class LoginActivity : VectorBaseActivity<ActivityLoginBinding>(), UnlockedA
views.loginLoading.isVisible = loginViewState.isLoading()
}
private fun inferAuthDescription(loginViewState: LoginViewState) = when (loginViewState.signMode) {
SignMode.Unknown -> null
SignMode.SignUp -> AuthenticationDescription.Register(type = AuthenticationDescription.AuthenticationType.Other)
SignMode.SignIn -> AuthenticationDescription.Login
SignMode.SignInWithMatrixId -> AuthenticationDescription.Login
}
private fun onWebLoginError(onWebLoginError: LoginViewEvents.OnWebLoginError) {
// Pop the backstack
supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)