Fix hide shields setting getting reset to true when opening Labs page

This commit is contained in:
Jarno Rankinen 2023-09-01 23:08:17 +03:00
parent c33fd8d379
commit 4a52a34df2
3 changed files with 8 additions and 6 deletions

View File

@ -85,6 +85,11 @@ class DebugFeaturesStateFactory @Inject constructor(
key = DebugFeatureKeys.newAppLayoutEnabled,
factory = VectorFeatures::isNewAppLayoutFeatureEnabled
),
createBooleanFeature(
label = "Disable Encryption Shields",
key = DebugFeatureKeys.shieldVisibilityDisabled,
factory = VectorFeatures::isShieldVisibilityDisabled
),
createBooleanFeature(
label = "Enable QR Code Login",
key = DebugFeatureKeys.qrCodeLoginEnabled,

View File

@ -306,6 +306,8 @@ class VectorPreferences @Inject constructor(
SETTINGS_SECURITY_USE_FLAG_SECURE,
SETTINGS_SECURITY_INCOGNITO_KEYBOARD_PREFERENCE_KEY,
SETTINGS_LABS_HIDE_SHIELDS_KEY,
ShortcutsHandler.SHARED_PREF_KEY,
)
}
@ -1222,8 +1224,7 @@ class VectorPreferences @Inject constructor(
* Indicates if the encryption shields in rooms next to messages are hidden
*/
fun isShieldVisibilityDisabled() : Boolean {
return vectorFeatures.isShieldVisibilityDisabled() &&
defaultPrefs.getBoolean(SETTINGS_LABS_HIDE_SHIELDS_KEY, getDefault(R.bool.settings_labs_hide_shields_default))
return defaultPrefs.getBoolean(SETTINGS_LABS_HIDE_SHIELDS_KEY, getDefault(R.bool.settings_labs_hide_shields_default))
}
/**

View File

@ -96,10 +96,6 @@ class VectorSettingsLabsFragment :
}
}
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_HIDE_SHIELDS_KEY)?.let { pref ->
pref.isChecked = vectorFeatures.isShieldVisibilityDisabled()
}
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_VOICE_BROADCAST_KEY)?.let { pref ->
// Voice Broadcast recording is not available on Android < 10
pref.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && vectorFeatures.isVoiceBroadcastEnabled()