Adding a new setting entry behind feature flag

This commit is contained in:
Maxime NATUREL 2022-08-10 09:50:02 +02:00
parent fb0b38bb49
commit db1d0daec0
3 changed files with 17 additions and 1 deletions

View file

@ -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"

View file

@ -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<VectorPreference>(VectorPreferences.SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY)!!
}
private val showDevicesV2ListPref by lazy {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SHOW_DEVICES_V2_LIST_PREFERENCE_KEY)!!
}
// encrypt to unverified devices
private val sendToUnverifiedDevicesPref by lazy {
findPreference<SwitchPreference>(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

View file

@ -62,6 +62,11 @@
android:title="@string/settings_active_sessions_show_all"
app:fragment="im.vector.app.features.settings.devices.VectorSettingsDevicesFragment" />
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_SHOW_DEVICES_V2_LIST_PREFERENCE_KEY"
android:title="@string/settings_active_sessions_show_all"
app:fragment="im.vector.app.features.settings.devices.VectorSettingsDevicesFragment" />
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreferenceCategory