Move Voice Broadcast feature flag to labs settings

This commit is contained in:
Florian Renaud 2022-10-18 11:00:21 +02:00
parent 0dad78a24a
commit 03ac0f1f03
8 changed files with 17 additions and 12 deletions

View file

@ -3346,6 +3346,8 @@
<string name="labs_enable_session_manager_summary">Have greater visibility and control over all your sessions.</string>
<string name="labs_enable_client_info_recording_title">Enable client info recording</string>
<string name="labs_enable_client_info_recording_summary">Record the client name, version, and url to recognise sessions more easily in session manager.</string>
<string name="labs_enable_voice_broadcast_title">Enable Voice broadcast (under active development)</string>
<string name="labs_enable_voice_broadcast_summary">Be able to record and send voice broadcast in room timeline. Only ended voice broadcast can be listened (listen live broadcast is not correctly supported for the moment)</string>
<!-- 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>

View file

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

View file

@ -85,9 +85,6 @@ 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)
@ -150,5 +147,4 @@ 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

@ -49,6 +49,8 @@
<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_default">false</bool>
<bool name="settings_labs_enable_voice_broadcast_visible">true</bool>
<bool name="settings_labs_enable_voice_broadcast_default">false</bool>
<!-- Level 1: Advanced settings -->
<!-- Level 1: Help and about -->

View file

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

View file

@ -310,7 +310,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
)
attachmentTypeSelector.setAttachmentVisibility(
AttachmentTypeSelectorView.Type.VOICE_BROADCAST,
vectorFeatures.isVoiceBroadcastEnabled(), // TODO check user permission
vectorPreferences.isVoiceBroadcastEnabled(), // TODO check user permission
)
}
attachmentTypeSelector.show(composer.attachmentButton)

View file

@ -74,6 +74,7 @@ class VectorPreferences @Inject constructor(
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_LABS_CLIENT_INFO_RECORDING_KEY = "SETTINGS_LABS_CLIENT_INFO_RECORDING_KEY"
const val SETTINGS_LABS_VOICE_BROADCAST_KEY = "SETTINGS_LABS_VOICE_BROADCAST_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_MANAGE_PREFERENCE_KEY = "SETTINGS_CRYPTOGRAPHY_MANAGE_PREFERENCE_KEY"
@ -1203,4 +1204,8 @@ class VectorPreferences @Inject constructor(
fun isRichTextEditorEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_RICH_TEXT_EDITOR_KEY, getDefault(R.bool.settings_labs_rich_text_editor_default))
}
fun isVoiceBroadcastEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_VOICE_BROADCAST_KEY, getDefault(R.bool.settings_labs_enable_voice_broadcast_default))
}
}

View file

@ -117,4 +117,11 @@
android:title="@string/labs_enable_client_info_recording_title"
app:isPreferenceVisible="@bool/settings_labs_client_info_recording_visible" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="@bool/settings_labs_enable_voice_broadcast_default"
android:key="SETTINGS_LABS_VOICE_BROADCAST_KEY"
android:summary="@string/labs_enable_voice_broadcast_summary"
android:title="@string/labs_enable_voice_broadcast_title"
app:isPreferenceVisible="@bool/settings_labs_enable_voice_broadcast_visible" />
</androidx.preference.PreferenceScreen>