adds feature flag usage to registration flow result

This commit is contained in:
ericdecanini 2022-02-23 13:25:16 +01:00
parent 507ddc2d4a
commit 713248805c

View File

@ -123,8 +123,7 @@ class FtueAuthVariant(
private fun handleOnboardingViewEvents(viewEvents: OnboardingViewEvents) {
when (viewEvents) {
is OnboardingViewEvents.RegistrationFlowResult -> {
// Check that all flows are supported by the application
if (viewEvents.flowResult.missingStages.any { !it.isSupported() }) {
if (registrationShouldFallback(viewEvents)) {
// Display a popup to propose use web fallback
onRegistrationStageNotSupported()
} else {
@ -223,6 +222,12 @@ class FtueAuthVariant(
}.exhaustive
}
private fun registrationShouldFallback(registrationFlowResult: OnboardingViewEvents.RegistrationFlowResult) =
vectorFeatures.isForceLoginFallbackEnabled() || registrationFlowResult.containsUnsupportedRegistrationFlow()
private fun OnboardingViewEvents.RegistrationFlowResult.containsUnsupportedRegistrationFlow() =
flowResult.missingStages.any { !it.isSupported() }
private fun updateWithState(viewState: OnboardingViewState) {
if (viewState.isUserLogged()) {
val intent = HomeActivity.newIntent(