From db1d0daec077a60f57c1a2670a7d632f6bb680a5 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 10 Aug 2022 09:50:02 +0200 Subject: [PATCH] Adding a new setting entry behind feature flag --- .../vector/app/features/settings/VectorPreferences.kt | 1 + .../settings/VectorSettingsSecurityPrivacyFragment.kt | 10 ++++++++++ .../main/res/xml/vector_settings_security_privacy.xml | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index ac14bfc3c7..0134fc581b 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -74,6 +74,7 @@ class VectorPreferences @Inject constructor( const val SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY" const val SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY" const val SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY" + const val SETTINGS_SHOW_DEVICES_V2_LIST_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_V2_LIST_PREFERENCE_KEY" const val SETTINGS_ALLOW_INTEGRATIONS_KEY = "SETTINGS_ALLOW_INTEGRATIONS_KEY" const val SETTINGS_INTEGRATION_MANAGER_UI_URL_KEY = "SETTINGS_INTEGRATION_MANAGER_UI_URL_KEY" const val SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY = "SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY" diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt index ac8a47b81e..023bb9e03f 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt @@ -50,6 +50,7 @@ import im.vector.app.core.utils.copyToClipboard import im.vector.app.core.utils.openFileSelection import im.vector.app.core.utils.toast 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.plan.MobileScreen import im.vector.app.features.analytics.ui.consent.AnalyticsConsentViewActions @@ -86,6 +87,7 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor( private val rawService: RawService, private val navigator: Navigator, private val analyticsConfig: AnalyticsConfig, + private val vectorFeatures: VectorFeatures, ) : VectorSettingsBaseFragment() { override var titleRes = R.string.settings_security_and_privacy @@ -135,6 +137,10 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor( findPreference(VectorPreferences.SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY)!! } + private val showDevicesV2ListPref by lazy { + findPreference(VectorPreferences.SETTINGS_SHOW_DEVICES_V2_LIST_PREFERENCE_KEY)!! + } + // encrypt to unverified devices private val sendToUnverifiedDevicesPref by lazy { findPreference(VectorPreferences.SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY)!! @@ -546,6 +552,10 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor( showDeviceListPref.isEnabled = devices.isNotEmpty() showDeviceListPref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size) + showDevicesV2ListPref.isVisible = vectorFeatures.isNewDeviceManagementEnabled() + showDevicesV2ListPref.title = showDeviceListPref.title.toString() + " (V2, WIP)" + showDevicesV2ListPref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size) + val userId = session.myUserId val deviceId = session.sessionParams.deviceId diff --git a/vector/src/main/res/xml/vector_settings_security_privacy.xml b/vector/src/main/res/xml/vector_settings_security_privacy.xml index d4dfed2fcf..d3493fd984 100644 --- a/vector/src/main/res/xml/vector_settings_security_privacy.xml +++ b/vector/src/main/res/xml/vector_settings_security_privacy.xml @@ -62,6 +62,11 @@ android:title="@string/settings_active_sessions_show_all" app:fragment="im.vector.app.features.settings.devices.VectorSettingsDevicesFragment" /> + + - \ No newline at end of file +