-
Notifications
You must be signed in to change notification settings - Fork 739
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
New Layout - Labs Flag (to replace feature flag) #7038
Conversation
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.
Just a point on default value usage.
@@ -83,4 +83,10 @@ | |||
android:summary="@string/labs_enable_element_call_permission_shortcuts_summary" | |||
android:title="@string/labs_enable_element_call_permission_shortcuts" /> | |||
|
|||
<im.vector.app.core.preference.VectorSwitchPreference | |||
android:defaultValue="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.
You must use settings_labs_new_app_layout_default
here too.
…ers_for_space' into feature/eric/new-layout-labs
@ericdecanini I just had a discussion with @fedrunov and I think it's better to keep the feature flag, to be able to completely disable the new app layout feature. It can be useful for forks and also for us if there is a problem with the new app layout. So if the feature flag is Also we will have: VectorPreferences.isNewAppLayoutEnabled(): Boolean {
return vectorFeatures.isNewAppLayoutEnabled() &&
defaultPrefs.getBoolean(SETTINGS_LABS_NEW_APP_LAYOUT_KEY, getDefault(R.bool.settings_labs_new_app_layout_default))
} Can you do that please? Thanks! |
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.
See my comment
…ayout-labs # Conflicts: # vector/src/main/java/im/vector/app/features/settings/VectorSettingsLabsFragment.kt
@@ -249,7 +249,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver | |||
|
|||
initUiAndData() | |||
|
|||
if (vectorFeatures.isNewAppLayoutEnabled()) { | |||
if (vectorPreferences.isNewAppLayoutEnabled()) { |
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.
Since both vectorFeatures.isNewAppLayoutEnabled()
and vectorPreferences.isNewAppLayoutEnabled()
exist now, there is a risk of using the former instead of the latter, especially now that we have many open PR on the subject. Maybe rename the later to something else to force a compilation error on existing PR.
Something like vectorFeatures.isNewAppLayoutFeatureEnabled()
. Also maybe document it to tell the developer that they may want to use vectorPreferences.isNewAppLayoutEnabled()
instead, to take care of the labs settings.
I admit this is quite ugly...
@@ -63,6 +65,7 @@ class VectorPreferences @Inject constructor( | |||
const val SETTINGS_BACKGROUND_SYNC_PREFERENCE_KEY = "SETTINGS_BACKGROUND_SYNC_PREFERENCE_KEY" | |||
const val SETTINGS_BACKGROUND_SYNC_DIVIDER_PREFERENCE_KEY = "SETTINGS_BACKGROUND_SYNC_DIVIDER_PREFERENCE_KEY" | |||
const val SETTINGS_LABS_PREFERENCE_KEY = "SETTINGS_LABS_PREFERENCE_KEY" | |||
const val SETTINGS_LABS_NEW_APP_LAYOUT_KEY = "SETTINGS_LABS_ENABLE_NEW_LAYOUT" |
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.
generally the val
and the string has the same content (sort of convention, which is nice when looking across the whole codebase for the string), so maybe change to
const val SETTINGS_LABS_NEW_APP_LAYOUT_KEY = "SETTINGS_LABS_ENABLE_NEW_LAYOUT" | |
const val SETTINGS_LABS_NEW_APP_LAYOUT_KEY = "SETTINGS_LABS_NEW_APP_LAYOUT_KEY" |
Do not forget to also change on vector_settings_labs.xml
@@ -152,7 +152,7 @@ class ElementRobot { | |||
} | |||
|
|||
fun signout(expectSignOutWarning: Boolean) { | |||
if (features.isNewAppLayoutEnabled()) { | |||
if (features.isNewAppLayoutFeatureEnabled()) { |
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.
Now that we have it as a labs flag, we can take an approach of making the checks on one layout, enabling the labs flag with the robot and making the checks on the new version. I'll do this in #7020 as to not clutter this 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.
OK, good idea! Thanks
* This is only to enable if the labs flag should be visible and effective | ||
* If on the client-side you want functionality that should be enabled with the new layout, | ||
* use [VectorPreferences.isNewAppLayoutEnabled] instead | ||
*/ |
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.
👍
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 think at some places we want to check the labs flag. Can you double check?
@@ -120,7 +120,7 @@ class HomeActivityViewModel @AssistedInject constructor( | |||
|
|||
private fun observeReleaseNotes() = withState { state -> | |||
// we don't want to show release notes for new users or after relogin | |||
if (state.authenticationDescription == null && vectorFeatures.isNewAppLayoutEnabled()) { | |||
if (state.authenticationDescription == null && vectorFeatures.isNewAppLayoutFeatureEnabled()) { |
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.
so we want to check the labs flag here, no?
} | ||
|
||
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_UNREAD_NOTIFICATIONS_AS_TAB)?.let { pref -> | ||
pref.isVisible = !vectorFeatures.isNewAppLayoutEnabled() | ||
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled() |
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.
same, we want to check the labs flag here.
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.
What we should do probably here is make it visible depending on the feature flag, and make it enabled depending on the labs flag
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, good idea.
@@ -102,7 +102,7 @@ class VectorSettingsPreferencesFragment : | |||
} | |||
|
|||
findPreference<Preference>(VectorPreferences.SETTINGS_PREF_SPACE_CATEGORY)!!.let { pref -> | |||
pref.isVisible = !vectorFeatures.isNewAppLayoutEnabled() | |||
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled() |
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.
same, we want to check the labs flag here.
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.
Same as above
@@ -103,6 +103,7 @@ class VectorSettingsPreferencesFragment : | |||
|
|||
findPreference<Preference>(VectorPreferences.SETTINGS_PREF_SPACE_CATEGORY)!!.let { pref -> | |||
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled() | |||
pref.isEnabled = !vectorPreferences.isNewAppLayoutEnabled() |
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.
This has to be refreshed as well (like in configureUnreadNotificationsAsTabPreference()
). Maybe rename configureUnreadNotificationsAsTabPreference()
and use it to refresh all pref enable state?
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.
sorry, please ignore, this is not the same Fragment.
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.
One more important remark about the drawer.
@@ -217,7 +217,7 @@ class HomeActivity : | |||
roomListSharedActionViewModel = viewModelProvider[RoomListSharedActionViewModel::class.java] | |||
views.drawerLayout.addDrawerListener(drawerListener) | |||
if (isFirstCreation()) { | |||
if (vectorFeatures.isNewAppLayoutEnabled()) { | |||
if (vectorPreferences.isNewAppLayoutEnabled()) { |
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 think we want to unlock the drawer in the else block, since this is now a runtime setting.
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!
@@ -103,6 +103,7 @@ class VectorSettingsPreferencesFragment : | |||
|
|||
findPreference<Preference>(VectorPreferences.SETTINGS_PREF_SPACE_CATEGORY)!!.let { pref -> | |||
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled() | |||
pref.isEnabled = !vectorPreferences.isNewAppLayoutEnabled() |
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.
sorry, please ignore, this is not the same Fragment.
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!
@ericdecanini can you check the failing test |
|
||
class ElementRobot( | ||
private val labsPreferences: LabFeaturesPreferences = LabFeaturesPreferences(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.
Maybe you can invoke the constructor in UiAllScreensSanityTest
this way:
private val elementRobot = ElementRobot(
LabFeaturesPreferences(
InstrumentationRegistry.getInstrumentation()
.targetContext
.resources
.getBoolean(R.bool.settings_labs_new_app_layout_default)
)
)
…e status + small fix for tests
SonarCloud Quality Gate failed. |
Type of change
Content
Adds new layout flag as a labs flag
Motivation and context
Screenshots / GIFs
(see bottom option)
Tests
Switch on and off labs flag and see that new layout is switched on and off accordingly
Tested devices
Checklist