Skip to content

Commit

Permalink
taking the already have an account feature flag into account in the f…
Browse files Browse the repository at this point in the history
…tue auth splash
  • Loading branch information
ouchadam committed Dec 16, 2021
1 parent cda9a77 commit f06cfcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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() {
Expand Down

0 comments on commit f06cfcf

Please sign in to comment.