Merge pull request #7337 from vector-im/feature/mna/device-manager-lab-flag

[Device management] Add lab flag for the feature (PSG-793)
This commit is contained in:
Maxime NATUREL 2022-10-12 14:16:53 +02:00 committed by GitHub
commit cf9f30d95e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 17 deletions

1
changelog.d/7336.feature Normal file
View file

@ -0,0 +1 @@
[Device management] Add lab flag for the feature

View file

@ -3239,7 +3239,8 @@
<string name="labs_enable_element_call_permission_shortcuts_summary">Auto-approve Element Call widgets and grant camera / mic access</string> <string name="labs_enable_element_call_permission_shortcuts_summary">Auto-approve Element Call widgets and grant camera / mic access</string>
<!-- Device Manager --> <!-- Device Manager -->
<string name="device_manager_settings_active_sessions_show_all">Show All Sessions (V2, WIP)</string> <!-- TODO remove this key -->
<string name="device_manager_settings_active_sessions_show_all" tools:ignore="UnusedResources">Show All Sessions (V2, WIP)</string>
<string name="device_manager_sessions_other_title">Other sessions</string> <string name="device_manager_sessions_other_title">Other sessions</string>
<string name="device_manager_sessions_other_description">For best security, verify your sessions and sign out from any session that you dont recognize or use anymore.</string> <string name="device_manager_sessions_other_description">For best security, verify your sessions and sign out from any session that you dont recognize or use anymore.</string>
<string name="a11y_device_manager_device_type_mobile">Mobile</string> <string name="a11y_device_manager_device_type_mobile">Mobile</string>
@ -3325,6 +3326,8 @@
<string name="device_manager_learn_more_sessions_verified">Verified sessions have logged in with your credentials and then been verified, either using your secure passphrase or by cross-verifying.\n\nThis means they hold encryption keys for your previous messages, and confirm to other users you are communicating with that these sessions are really you.</string> <string name="device_manager_learn_more_sessions_verified">Verified sessions have logged in with your credentials and then been verified, either using your secure passphrase or by cross-verifying.\n\nThis means they hold encryption keys for your previous messages, and confirm to other users you are communicating with that these sessions are really you.</string>
<string name="device_manager_learn_more_session_rename_title">Renaming sessions</string> <string name="device_manager_learn_more_session_rename_title">Renaming sessions</string>
<string name="device_manager_learn_more_session_rename">Other users in direct messages and rooms that you join are able to view a full list of your sessions.\n\nThis provides them with confidence that they are really speaking to you, but it also means they can see the session name you enter here.</string> <string name="device_manager_learn_more_session_rename">Other users in direct messages and rooms that you join are able to view a full list of your sessions.\n\nThis provides them with confidence that they are really speaking to you, but it also means they can see the session name you enter here.</string>
<string name="labs_enable_session_manager_title">Enable new session manager</string>
<string name="labs_enable_session_manager_summary">Have greater visibility and control over all your sessions.</string>
<!-- Note to translators: %s will be replaces with selected space name --> <!-- Note to translators: %s will be replaces with selected space name -->
<string name="home_empty_space_no_rooms_title">%s\nis looking a little empty.</string> <string name="home_empty_space_no_rooms_title">%s\nis looking a little empty.</string>

View file

@ -85,11 +85,6 @@ class DebugFeaturesStateFactory @Inject constructor(
key = DebugFeatureKeys.newAppLayoutEnabled, key = DebugFeatureKeys.newAppLayoutEnabled,
factory = VectorFeatures::isNewAppLayoutFeatureEnabled factory = VectorFeatures::isNewAppLayoutFeatureEnabled
), ),
createBooleanFeature(
label = "Enable New Device Management",
key = DebugFeatureKeys.newDeviceManagementEnabled,
factory = VectorFeatures::isNewDeviceManagementEnabled
),
createBooleanFeature( createBooleanFeature(
label = "Enable Voice Broadcast", label = "Enable Voice Broadcast",
key = DebugFeatureKeys.voiceBroadcastEnabled, key = DebugFeatureKeys.voiceBroadcastEnabled,

View file

@ -76,9 +76,6 @@ class DebugVectorFeatures(
override fun isNewAppLayoutFeatureEnabled(): Boolean = read(DebugFeatureKeys.newAppLayoutEnabled) override fun isNewAppLayoutFeatureEnabled(): Boolean = read(DebugFeatureKeys.newAppLayoutEnabled)
?: vectorFeatures.isNewAppLayoutFeatureEnabled() ?: vectorFeatures.isNewAppLayoutFeatureEnabled()
override fun isNewDeviceManagementEnabled(): Boolean = read(DebugFeatureKeys.newDeviceManagementEnabled)
?: vectorFeatures.isNewDeviceManagementEnabled()
override fun isVoiceBroadcastEnabled(): Boolean = read(DebugFeatureKeys.voiceBroadcastEnabled) override fun isVoiceBroadcastEnabled(): Boolean = read(DebugFeatureKeys.voiceBroadcastEnabled)
?: vectorFeatures.isVoiceBroadcastEnabled() ?: vectorFeatures.isVoiceBroadcastEnabled()
@ -140,8 +137,6 @@ object DebugFeatureKeys {
val liveLocationSharing = booleanPreferencesKey("live-location-sharing") val liveLocationSharing = booleanPreferencesKey("live-location-sharing")
val screenSharing = booleanPreferencesKey("screen-sharing") val screenSharing = booleanPreferencesKey("screen-sharing")
val forceUsageOfOpusEncoder = booleanPreferencesKey("force-usage-of-opus-encoder") val forceUsageOfOpusEncoder = booleanPreferencesKey("force-usage-of-opus-encoder")
val startDmOnFirstMsg = booleanPreferencesKey("start-dm-on-first-msg")
val newAppLayoutEnabled = booleanPreferencesKey("new-app-layout-enabled") val newAppLayoutEnabled = booleanPreferencesKey("new-app-layout-enabled")
val newDeviceManagementEnabled = booleanPreferencesKey("new-device-management-enabled")
val voiceBroadcastEnabled = booleanPreferencesKey("voice-broadcast-enabled") val voiceBroadcastEnabled = booleanPreferencesKey("voice-broadcast-enabled")
} }

View file

@ -41,6 +41,7 @@
<bool name="settings_labs_deferred_dm_default">true</bool> <bool name="settings_labs_deferred_dm_default">true</bool>
<bool name="settings_labs_thread_messages_default">false</bool> <bool name="settings_labs_thread_messages_default">false</bool>
<bool name="settings_labs_new_app_layout_default">true</bool> <bool name="settings_labs_new_app_layout_default">true</bool>
<bool name="settings_labs_new_session_manager_default">false</bool>
<bool name="settings_timeline_show_live_sender_info_visible">true</bool> <bool name="settings_timeline_show_live_sender_info_visible">true</bool>
<bool name="settings_timeline_show_live_sender_info_default">false</bool> <bool name="settings_timeline_show_live_sender_info_default">false</bool>
<bool name="settings_labs_rich_text_editor_visible">true</bool> <bool name="settings_labs_rich_text_editor_visible">true</bool>

View file

@ -40,7 +40,6 @@ interface VectorFeatures {
* use [VectorPreferences.isNewAppLayoutEnabled] instead. * use [VectorPreferences.isNewAppLayoutEnabled] instead.
*/ */
fun isNewAppLayoutFeatureEnabled(): Boolean fun isNewAppLayoutFeatureEnabled(): Boolean
fun isNewDeviceManagementEnabled(): Boolean
fun isVoiceBroadcastEnabled(): Boolean fun isVoiceBroadcastEnabled(): Boolean
} }
@ -57,6 +56,5 @@ class DefaultVectorFeatures : VectorFeatures {
override fun isLocationSharingEnabled() = Config.ENABLE_LOCATION_SHARING override fun isLocationSharingEnabled() = Config.ENABLE_LOCATION_SHARING
override fun forceUsageOfOpusEncoder(): Boolean = false override fun forceUsageOfOpusEncoder(): Boolean = false
override fun isNewAppLayoutFeatureEnabled(): Boolean = true override fun isNewAppLayoutFeatureEnabled(): Boolean = true
override fun isNewDeviceManagementEnabled(): Boolean = false
override fun isVoiceBroadcastEnabled(): Boolean = false override fun isVoiceBroadcastEnabled(): Boolean = false
} }

View file

@ -72,6 +72,7 @@ class VectorPreferences @Inject constructor(
const val SETTINGS_LABS_NEW_APP_LAYOUT_KEY = "SETTINGS_LABS_NEW_APP_LAYOUT_KEY" const val SETTINGS_LABS_NEW_APP_LAYOUT_KEY = "SETTINGS_LABS_NEW_APP_LAYOUT_KEY"
const val SETTINGS_LABS_DEFERRED_DM_KEY = "SETTINGS_LABS_DEFERRED_DM_KEY" const val SETTINGS_LABS_DEFERRED_DM_KEY = "SETTINGS_LABS_DEFERRED_DM_KEY"
const val SETTINGS_LABS_RICH_TEXT_EDITOR_KEY = "SETTINGS_LABS_RICH_TEXT_EDITOR_KEY" const val SETTINGS_LABS_RICH_TEXT_EDITOR_KEY = "SETTINGS_LABS_RICH_TEXT_EDITOR_KEY"
const val SETTINGS_LABS_NEW_SESSION_MANAGER_KEY = "SETTINGS_LABS_NEW_SESSION_MANAGER_KEY"
const val SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_PREFERENCE_KEY" 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_DIVIDER_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_DIVIDER_PREFERENCE_KEY"
const val SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY" const val SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY"
@ -1180,6 +1181,13 @@ class VectorPreferences @Inject constructor(
return defaultPrefs.getBoolean(SETTINGS_LABS_DEFERRED_DM_KEY, getDefault(R.bool.settings_labs_deferred_dm_default)) return defaultPrefs.getBoolean(SETTINGS_LABS_DEFERRED_DM_KEY, getDefault(R.bool.settings_labs_deferred_dm_default))
} }
/**
* Indicates whether or not new session manager screens are enabled.
*/
fun isNewSessionManagerEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_NEW_SESSION_MANAGER_KEY, getDefault(R.bool.settings_labs_new_session_manager_default))
}
fun showLiveSenderInfo(): Boolean { fun showLiveSenderInfo(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_TIMELINE_SHOW_LIVE_SENDER_INFO, getDefault(R.bool.settings_timeline_show_live_sender_info_default)) return defaultPrefs.getBoolean(SETTINGS_TIMELINE_SHOW_LIVE_SENDER_INFO, getDefault(R.bool.settings_timeline_show_live_sender_info_default))
} }

View file

@ -51,7 +51,6 @@ import im.vector.app.core.utils.copyToClipboard
import im.vector.app.core.utils.openFileSelection import im.vector.app.core.utils.openFileSelection
import im.vector.app.core.utils.toast import im.vector.app.core.utils.toast
import im.vector.app.databinding.DialogImportE2eKeysBinding import im.vector.app.databinding.DialogImportE2eKeysBinding
import im.vector.app.features.VectorFeatures
import im.vector.app.features.analytics.AnalyticsConfig import im.vector.app.features.analytics.AnalyticsConfig
import im.vector.app.features.analytics.plan.MobileScreen import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.analytics.ui.consent.AnalyticsConsentViewActions import im.vector.app.features.analytics.ui.consent.AnalyticsConsentViewActions
@ -91,7 +90,7 @@ class VectorSettingsSecurityPrivacyFragment :
@Inject lateinit var rawService: RawService @Inject lateinit var rawService: RawService
@Inject lateinit var navigator: Navigator @Inject lateinit var navigator: Navigator
@Inject lateinit var analyticsConfig: AnalyticsConfig @Inject lateinit var analyticsConfig: AnalyticsConfig
@Inject lateinit var vectorFeatures: VectorFeatures @Inject lateinit var vectorPreferences: VectorPreferences
override var titleRes = R.string.settings_security_and_privacy override var titleRes = R.string.settings_security_and_privacy
override val preferenceXmlRes = R.xml.vector_settings_security_privacy override val preferenceXmlRes = R.xml.vector_settings_security_privacy
@ -562,11 +561,12 @@ class VectorSettingsSecurityPrivacyFragment :
* Build the cryptography preference section. * Build the cryptography preference section.
*/ */
private fun refreshCryptographyPreference(devices: List<DeviceInfo>) { private fun refreshCryptographyPreference(devices: List<DeviceInfo>) {
showDeviceListPref.isVisible = !vectorPreferences.isNewSessionManagerEnabled()
showDeviceListPref.isEnabled = devices.isNotEmpty() showDeviceListPref.isEnabled = devices.isNotEmpty()
showDeviceListPref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size) showDeviceListPref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size)
showDevicesListV2Pref.isVisible = vectorFeatures.isNewDeviceManagementEnabled() showDevicesListV2Pref.isVisible = vectorPreferences.isNewSessionManagerEnabled()
showDevicesListV2Pref.title = getString(R.string.device_manager_settings_active_sessions_show_all) showDevicesListV2Pref.isEnabled = devices.isNotEmpty()
showDevicesListV2Pref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size) showDevicesListV2Pref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size)
val userId = session.myUserId val userId = session.myUserId

View file

@ -103,4 +103,10 @@
android:title="@string/labs_enable_rich_text_editor_title" android:title="@string/labs_enable_rich_text_editor_title"
app:isPreferenceVisible="@bool/settings_labs_rich_text_editor_visible" /> app:isPreferenceVisible="@bool/settings_labs_rich_text_editor_visible" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="@bool/settings_labs_new_session_manager_default"
android:key="SETTINGS_LABS_NEW_SESSION_MANAGER_KEY"
android:summary="@string/labs_enable_session_manager_summary"
android:title="@string/labs_enable_session_manager_title" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>