Voice Broadcast - Restore feature flag and enable it by default

This commit is contained in:
Florian Renaud 2022-10-18 21:02:58 +02:00
parent 5a749bdccf
commit 63c02c6fef
5 changed files with 17 additions and 1 deletions

View File

@ -100,6 +100,11 @@ class DebugFeaturesStateFactory @Inject constructor(
key = DebugFeatureKeys.reciprocateQrCodeLogin,
factory = VectorFeatures::isReciprocateQrCodeLogin
),
createBooleanFeature(
label = "Enable Voice Broadcast",
key = DebugFeatureKeys.voiceBroadcastEnabled,
factory = VectorFeatures::isVoiceBroadcastEnabled
),
)
)
}

View File

@ -85,6 +85,9 @@ class DebugVectorFeatures(
override fun isReciprocateQrCodeLogin() = read(DebugFeatureKeys.reciprocateQrCodeLogin)
?: vectorFeatures.isReciprocateQrCodeLogin()
override fun isVoiceBroadcastEnabled(): Boolean = read(DebugFeatureKeys.voiceBroadcastEnabled)
?: vectorFeatures.isVoiceBroadcastEnabled()
fun <T> override(value: T?, key: Preferences.Key<T>) = updatePreferences {
if (value == null) {
it.remove(key)
@ -147,4 +150,5 @@ object DebugFeatureKeys {
val qrCodeLoginEnabled = booleanPreferencesKey("qr-code-login-enabled")
val qrCodeLoginForAllServers = booleanPreferencesKey("qr-code-login-for-all-servers")
val reciprocateQrCodeLogin = booleanPreferencesKey("reciprocate-qr-code-login")
val voiceBroadcastEnabled = booleanPreferencesKey("voice-broadcast-enabled")
}

View File

@ -43,6 +43,7 @@ interface VectorFeatures {
fun isQrCodeLoginEnabled(): Boolean
fun isQrCodeLoginForAllServers(): Boolean
fun isReciprocateQrCodeLogin(): Boolean
fun isVoiceBroadcastEnabled(): Boolean
}
class DefaultVectorFeatures : VectorFeatures {
@ -61,4 +62,5 @@ class DefaultVectorFeatures : VectorFeatures {
override fun isQrCodeLoginEnabled(): Boolean = true
override fun isQrCodeLoginForAllServers(): Boolean = false
override fun isReciprocateQrCodeLogin(): Boolean = false
override fun isVoiceBroadcastEnabled(): Boolean = true
}

View File

@ -1206,6 +1206,7 @@ class VectorPreferences @Inject constructor(
}
fun isVoiceBroadcastEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_VOICE_BROADCAST_KEY, getDefault(R.bool.settings_labs_enable_voice_broadcast_default))
return vectorFeatures.isVoiceBroadcastEnabled() &&
defaultPrefs.getBoolean(SETTINGS_LABS_VOICE_BROADCAST_KEY, getDefault(R.bool.settings_labs_enable_voice_broadcast_default))
}
}

View File

@ -90,6 +90,10 @@ class VectorSettingsLabsFragment :
}
}
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_VOICE_BROADCAST_KEY)?.let { pref ->
pref.isVisible = vectorFeatures.isVoiceBroadcastEnabled()
}
configureUnreadNotificationsAsTabPreference()
configureEnableClientInfoRecordingPreference()
}