-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#5307 Adds ForceLoginFallback feature flag to Login and Registration #5325
Conversation
…tration-feature-flag # Conflicts: # vector/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt # vector/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt # vector/src/main/java/im/vector/app/features/VectorFeatures.kt
package im.vector.lib.core.utils.extensions | ||
|
||
@Suppress("UNUSED_PARAMETER") | ||
fun doNothing(reason: String = "") = Unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially useful in single line lambdas (e.g. when statements, example below) as a cleaner alternative to { /* do nothing */ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just write { Unit }
?
@@ -228,6 +224,25 @@ class FtueAuthVariant( | |||
}.exhaustive | |||
} | |||
|
|||
private fun registrationShouldFallback(registrationFlowResult: OnboardingViewEvents.RegistrationFlowResult) = | |||
vectorFeatures.isForceLoginFallbackEnabled() || registrationFlowResult.containsUnsupportedRegistrationFlow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Real change no. 1
.setNegativeButton(R.string.no, null) | ||
.show() | ||
} | ||
|
||
private fun handleSignInWithMatrixId(state: OnboardingViewState) { | ||
if (vectorFeatures.isForceLoginFallbackEnabled()) | ||
onLoginModeNotSupported(state.loginModeSupportedTypes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Real change no. 3
?.let { onboardingViewModel.handle(OnboardingAction.LoginWithToken(it)) } | ||
private fun handleSignInSelected(state: OnboardingViewState) { | ||
if (vectorFeatures.isForceLoginFallbackEnabled()) | ||
onLoginModeNotSupported(state.loginModeSupportedTypes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Real change no. 2
Matrix SDKIntegration Tests Results:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Some remarks.
package im.vector.lib.core.utils.extensions | ||
|
||
@Suppress("UNUSED_PARAMETER") | ||
fun doNothing(reason: String = "") = Unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just write { Unit }
?
@@ -110,7 +111,7 @@ class FtueAuthVariant( | |||
} | |||
|
|||
override fun setIsLoading(isLoading: Boolean) { | |||
// do nothing | |||
doNothing() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer a comment, or write override fun setIsLoading(isLoading: Boolean) = Unit
. I do not know what others think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. This is purely my personal preference, but Unit
definitely works too
is LoginMode.SsoAndPassword, | ||
LoginMode.Password -> openAuthLoginFragmentWithTag(FRAGMENT_LOGIN_TAG) | ||
LoginMode.Unsupported -> onLoginModeNotSupported(state.loginModeSupportedTypes) | ||
}.exhaustive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here .exhaustive
is not necessary anymore, since when
statement is "assigned" to the fun
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@@ -106,4 +108,5 @@ object DebugFeatureKeys { | |||
val onboardingSplashCarousel = booleanPreferencesKey("onboarding-splash-carousel") | |||
val onboardingUseCase = booleanPreferencesKey("onbboarding-splash-carousel") | |||
val onboardingPersonalize = booleanPreferencesKey("onbboarding-personalize") | |||
val forceLoginFallback = booleanPreferencesKey("force-login-fallback") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to add this simple boolean to the screen DebugPrivateSettingsFragment
as suggested by @ouchadam , since this is really something for internal test and not a feature we can disable or enable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was my thinking ^^^ I don't see us wanting to promoting this setting for production/all users
@@ -59,4 +59,16 @@ class VectorDataStore @Inject constructor( | |||
settings[forceDialPadDisplay] = force | |||
} | |||
} | |||
|
|||
private val forceLoginFallback = booleanPreferencesKey("force_login_fallback") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected this to be beside the dial pad option within the VectorDataStore
(along with the store read/write access below) 🤔
I have an upcoming PR to move the override options out of the VectorDataStore
and into a VectorOverrides
abstraction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soz for the conflict 😅 For visibility sake, because they're pretty minor, we decided that you'd resolve them on your pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good from my side! thanks for adding the screenshots 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
@@ -75,6 +75,8 @@ class FtueAuthVariant( | |||
private val popEnterAnim = R.anim.no_anim | |||
private val popExitAnim = R.anim.exit_fade_out | |||
|
|||
private var isForceLoginFallbackEnabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for this private var, as a cache, because the boolean is also in the state.
Type of change
Content
Adds a new feature flag
forceLoginFallback
used inFtueAuthVariant
's registration and login flows to force web registration / login to be usedMotivation and context
Addresses Issue #5307
I also took this as an opportunity to do some light refactoring within
FtueAuthVariant
with the only real change being the addition of said feature flag. It might look more functions have been added / removed in the diff when in reality they've only been moved around (and some functions have been split out for better abstraction and readability).I limited this refactoring to only the flows directly related to where the feature flag was used, otherwise this PR would be far larger than it needs to be.
I suggest looking through the commits when reviewing as I've separated out the behavioural changes and the refactoral changes
Screenshots / GIFs
Feature Flag
Usage
Tests
Tested devices
Checklist