Skip to content
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

Merged
merged 16 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.isNewAppLayoutFeatureEnabled()) {
if (state.authenticationDescription == null && vectorPreferences.isNewAppLayoutEnabled()) {
releaseNotesPreferencesStore.appLayoutOnboardingShown.onEach { isAppLayoutOnboardingShown ->
if (!isAppLayoutOnboardingShown) {
releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,20 @@ class VectorSettingsLabsFragment :

findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_NEW_APP_LAYOUT_KEY)?.let { pref ->
pref.isVisible = vectorFeatures.isNewAppLayoutFeatureEnabled()

pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
onNewLayoutPreferenceClicked()
true
}
}

configureUnreadNotificationsAsTabPreference()
}

private fun configureUnreadNotificationsAsTabPreference() {
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_UNREAD_NOTIFICATIONS_AS_TAB)?.let { pref ->
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled()
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, good idea.

pref.isEnabled = !vectorPreferences.isNewAppLayoutEnabled()
}
}

Expand Down Expand Up @@ -123,4 +133,11 @@ class VectorSettingsLabsFragment :
displayLoadingView()
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
}

/**
* Action when new layout preference switch is actually clicked.
*/
private fun onNewLayoutPreferenceClicked() {
configureUnreadNotificationsAsTabPreference()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class VectorSettingsPreferencesFragment :

findPreference<Preference>(VectorPreferences.SETTINGS_PREF_SPACE_CATEGORY)!!.let { pref ->
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled()
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

pref.isEnabled = !vectorPreferences.isNewAppLayoutEnabled()
Copy link
Member

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?

Copy link
Member

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.

}

// Url preview
Expand Down