Reorders some functions within FtueAuthVariant

This commit is contained in:
ericdecanini 2022-02-24 15:33:06 +01:00
parent 92c6d59984
commit 3d57d72a7e
1 changed files with 17 additions and 15 deletions

View File

@ -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)