diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt index 0132f8b37c..bd2c9a941d 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt @@ -179,7 +179,7 @@ class OnboardingViewModel @AssistedInject constructor( override fun handle(action: OnboardingAction) { when (action) { - is OnboardingAction.LoginWithSSO -> handleLoginWithSSO(action) + is OnboardingAction.LoginWithSSO -> tchap.handleLoginWithSSO(action) is OnboardingAction.SplashAction -> handleSplashAction(action) is OnboardingAction.UpdateUseCase -> handleUpdateUseCase(action) OnboardingAction.ResetUseCase -> resetUseCase() @@ -210,20 +210,6 @@ class OnboardingViewModel @AssistedInject constructor( } } - private fun handleLoginWithSSO(action: OnboardingAction.LoginWithSSO) { - currentJob = viewModelScope.launch { - when (val result = getPlatformTask.execute(Params(action.email))) { - is GetPlatformResult.Success -> { - val homeServerUrl = stringProvider.getString(R.string.server_url_prefix) + result.platform.hs - handleHomeserverChange(OnboardingAction.HomeServerChange.EditHomeServer(homeServerUrl)) - } - is GetPlatformResult.Failure -> { - // Nothin to do. - } - } - } - } - private fun handleUserNameEntered(action: OnboardingAction.UserNameEnteredAction) { when (action) { is OnboardingAction.UserNameEnteredAction.Login -> maybeUpdateHomeserver(action.userId) @@ -1024,6 +1010,10 @@ class OnboardingViewModel @AssistedInject constructor( } } + fun handleLoginWithSSO(action: OnboardingAction.LoginWithSSO) { + startTchapAuthenticationFlow(action.email) {} + } + fun startResetPasswordFlow(email: String, onSuccess: () -> Unit) { startTchapAuthenticationFlow(email) { this@OnboardingViewModel.startResetPasswordFlow(email, onSuccess) diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthSplashFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthSplashFragment.kt index d9150162ff..3ee30c6e01 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthSplashFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthSplashFragment.kt @@ -82,7 +82,7 @@ class FtueAuthSplashFragment : } } - /** TCHAP Login with SSO */ + /** TCHAP Login with SSO. */ private fun alreadyHaveAnAccountWithSSO() { viewModel.handle(OnboardingAction.SplashAction.OnIAlreadyHaveAnAccount(onboardingFlow = OnboardingFlow.TchapSignInWithSSO)) } diff --git a/vector/src/main/res/layout/fragment_tchap_welcome.xml b/vector/src/main/res/layout/fragment_tchap_welcome.xml index b73e7cb28a..bfda2eceb9 100644 --- a/vector/src/main/res/layout/fragment_tchap_welcome.xml +++ b/vector/src/main/res/layout/fragment_tchap_welcome.xml @@ -40,7 +40,7 @@ android:textColor="?vctr_content_primary" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/fragment_tchap_welcome_title" /> + app:layout_constraintTop_toBottomOf="@id/fragment_tchap_welcome_title" />