Reorders some functions within FtueAuthVariant

This commit is contained in:
ericdecanini 2022-02-24 15:33:06 +01:00
parent 92c6d59984
commit 3d57d72a7e

View file

@ -112,10 +112,6 @@ class FtueAuthVariant(
} }
} }
override fun setIsLoading(isLoading: Boolean) {
doNothing()
}
private fun addFirstFragment() { private fun addFirstFragment() {
val splashFragment = when (vectorFeatures.isOnboardingSplashCarouselEnabled()) { val splashFragment = when (vectorFeatures.isOnboardingSplashCarouselEnabled()) {
true -> FtueAuthSplashCarouselFragment::class.java true -> FtueAuthSplashCarouselFragment::class.java
@ -124,6 +120,23 @@ class FtueAuthVariant(
activity.addFragment(views.loginFragmentContainer, splashFragment) 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) { private fun handleOnboardingViewEvents(viewEvents: OnboardingViewEvents) {
when (viewEvents) { when (viewEvents) {
is OnboardingViewEvents.RegistrationFlowResult -> { is OnboardingViewEvents.RegistrationFlowResult -> {
@ -245,17 +258,6 @@ class FtueAuthVariant(
.show() .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) { private fun onWebLoginError(onWebLoginError: OnboardingViewEvents.OnWebLoginError) {
// Pop the backstack // Pop the backstack
supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)