-
Notifications
You must be signed in to change notification settings - Fork 742
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
Changes from 4 commits
2450954
fbe5918
a851b0a
5e0d84b
91b4918
468c7b6
31a3552
b7efd63
d77ce27
9564c8f
6c23634
afbb76f
64c8789
37b2163
6badbe7
2ab0343
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds New App Layout into Labs |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,7 +200,7 @@ class HomeActivity : | |
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
isNewAppLayoutEnabled = vectorFeatures.isNewAppLayoutEnabled() | ||
isNewAppLayoutEnabled = vectorPreferences.isNewAppLayoutEnabled() | ||
analyticsScreenName = MobileScreen.ScreenName.Home | ||
supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleCallbacks, false) | ||
unifiedPushHelper.register(this) { | ||
|
@@ -216,7 +216,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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
views.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) | ||
replaceFragment(views.homeDetailFragmentContainer, NewHomeDetailFragment::class.java) | ||
} else { | ||
|
@@ -575,12 +575,12 @@ class HomeActivity : | |
} | ||
|
||
private fun checkNewAppLayoutFlagChange() { | ||
if (buildMeta.isDebug && vectorFeatures.isNewAppLayoutEnabled() != isNewAppLayoutEnabled) { | ||
if (buildMeta.isDebug && vectorPreferences.isNewAppLayoutEnabled() != isNewAppLayoutEnabled) { | ||
restart() | ||
} | ||
} | ||
|
||
override fun getMenuRes() = if (vectorFeatures.isNewAppLayoutEnabled()) R.menu.menu_new_home else R.menu.menu_home | ||
override fun getMenuRes() = if (vectorPreferences.isNewAppLayoutEnabled()) R.menu.menu_new_home else R.menu.menu_home | ||
|
||
override fun handlePrepareMenu(menu: Menu) { | ||
menu.findItem(R.id.menu_home_init_sync_legacy).isVisible = vectorPreferences.developerMode() | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -63,6 +63,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 commentThe reason will be displayed to describe this comment to others. Learn more. generally the
Suggested change
Do not forget to also change on |
||||||
const val SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY" | ||||||
const val SETTINGS_CRYPTOGRAPHY_DIVIDER_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_DIVIDER_PREFERENCE_KEY" | ||||||
const val SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY" | ||||||
|
@@ -1146,6 +1147,13 @@ class VectorPreferences @Inject constructor( | |||||
return spaceIdsJoined?.takeIf { it.isNotEmpty() }?.split(",").orEmpty() | ||||||
} | ||||||
|
||||||
/** | ||||||
* Indicates whether or not new app layout is enabled. | ||||||
*/ | ||||||
fun isNewAppLayoutEnabled(): Boolean { | ||||||
return defaultPrefs.getBoolean(SETTINGS_LABS_NEW_APP_LAYOUT_KEY, getDefault(R.bool.settings_labs_new_app_layout_default)) | ||||||
} | ||||||
|
||||||
fun showLiveSenderInfo(): Boolean { | ||||||
return defaultPrefs.getBoolean(SETTINGS_TIMELINE_SHOW_LIVE_SENDER_INFO, getDefault(R.bool.settings_timeline_show_live_sender_info_default)) | ||||||
} | ||||||
|
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()
andvectorPreferences.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 usevectorPreferences.isNewAppLayoutEnabled()
instead, to take care of the labs settings.I admit this is quite ugly...