From 3d57d72a7eb97c98407d097d2022acaca9ca0c34 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Thu, 24 Feb 2022 15:33:06 +0100 Subject: [PATCH] Reorders some functions within FtueAuthVariant --- .../onboarding/ftueauth/FtueAuthVariant.kt | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthVariant.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthVariant.kt index c5b65508b4..2083d936be 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthVariant.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthVariant.kt @@ -112,10 +112,6 @@ class FtueAuthVariant( } } - override fun setIsLoading(isLoading: Boolean) { - doNothing() - } - private fun addFirstFragment() { val splashFragment = when (vectorFeatures.isOnboardingSplashCarouselEnabled()) { true -> FtueAuthSplashCarouselFragment::class.java @@ -124,6 +120,23 @@ class FtueAuthVariant( activity.addFragment(views.loginFragmentContainer, splashFragment) } + private fun updateWithState(viewState: OnboardingViewState) { + isForceLoginFallbackEnabled = viewState.isForceLoginFallbackEnabled + views.loginLoading.isVisible = shouldShowLoading(viewState) + } + + private fun shouldShowLoading(viewState: OnboardingViewState) = + if (vectorFeatures.isOnboardingPersonalizeEnabled()) { + viewState.isLoading() + } else { + // Keep loading when during success because of the delay when switching to the next Activity + viewState.isLoading() || viewState.isAuthTaskCompleted() + } + + override fun setIsLoading(isLoading: Boolean) { + doNothing() + } + private fun handleOnboardingViewEvents(viewEvents: OnboardingViewEvents) { when (viewEvents) { is OnboardingViewEvents.RegistrationFlowResult -> { @@ -245,17 +258,6 @@ class FtueAuthVariant( .show() } - private fun updateWithState(viewState: OnboardingViewState) { - isForceLoginFallbackEnabled = viewState.isForceLoginFallbackEnabled - - views.loginLoading.isVisible = if (vectorFeatures.isOnboardingPersonalizeEnabled()) { - viewState.isLoading() - } else { - // Keep loading when during success because of the delay when switching to the next Activity - viewState.isLoading() || viewState.isAuthTaskCompleted() - } - } - private fun onWebLoginError(onWebLoginError: OnboardingViewEvents.OnWebLoginError) { // Pop the backstack supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)