taking the already have an account feature flag into account in the ftue auth splash

This commit is contained in:
Adam Brown 2021-12-09 16:35:49 +00:00
parent e3c0b34651
commit 380f079ab7
2 changed files with 10 additions and 3 deletions

View file

@ -25,7 +25,6 @@ import androidx.core.view.isVisible
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.core.epoxy.onClick
import im.vector.app.databinding.FragmentLoginSplashBinding
import im.vector.app.features.settings.VectorPreferences
import org.matrix.android.sdk.api.failure.Failure

View file

@ -24,9 +24,11 @@ import android.view.ViewGroup
import androidx.core.view.isVisible
import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.databinding.FragmentFtueSplashBinding
import im.vector.app.features.VectorFeatures
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingFlow
import im.vector.app.features.settings.VectorPreferences
@ -37,9 +39,11 @@ import javax.inject.Inject
/**
* In this screen, the user is viewing an introduction to what he can do with this application
*/
@AndroidEntryPoint
class FtueAuthSplashFragment : AbstractFtueAuthFragment<FragmentFtueSplashBinding>() {
@Inject lateinit var vectorPreferences: VectorPreferences
@Inject lateinit var vectorFeatures: VectorFeatures
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueSplashBinding {
return FragmentFtueSplashBinding.inflate(inflater, container, false)
@ -52,7 +56,10 @@ class FtueAuthSplashFragment : AbstractFtueAuthFragment<FragmentFtueSplashBindin
private fun setupViews() {
views.loginSplashSubmit.debouncedClicks { getStarted() }
views.loginSplashAlreadyHaveAccount.debouncedClicks { alreadyHaveAnAccount() }
views.loginSplashAlreadyHaveAccount.apply {
isVisible = vectorFeatures.isAlreadyHaveAccountSplashEnabled()
debouncedClicks { alreadyHaveAnAccount() }
}
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
views.loginSplashVersion.isVisible = true
@ -65,7 +72,8 @@ class FtueAuthSplashFragment : AbstractFtueAuthFragment<FragmentFtueSplashBindin
}
private fun getStarted() {
viewModel.handle(OnboardingAction.OnGetStarted(resetLoginConfig = false, onboardingFlow = OnboardingFlow.SignUp))
val getStartedFlow = if (vectorFeatures.isAlreadyHaveAccountSplashEnabled()) OnboardingFlow.SignUp else OnboardingFlow.SignInSignUp
viewModel.handle(OnboardingAction.OnGetStarted(resetLoginConfig = false, onboardingFlow = getStartedFlow))
}
private fun alreadyHaveAnAccount() {