From 03ac0f1f0324db27f02d83f27d97f76b1dfc397d Mon Sep 17 00:00:00 2001 From: Florian Renaud Date: Tue, 18 Oct 2022 11:00:21 +0200 Subject: [PATCH] Move Voice Broadcast feature flag to labs settings --- library/ui-strings/src/main/res/values/strings.xml | 2 ++ .../features/debug/features/DebugFeaturesStateFactory.kt | 5 ----- .../app/features/debug/features/DebugVectorFeatures.kt | 4 ---- vector-config/src/main/res/values/config-settings.xml | 2 ++ .../src/main/java/im/vector/app/features/VectorFeatures.kt | 2 -- .../home/room/detail/composer/MessageComposerFragment.kt | 2 +- .../im/vector/app/features/settings/VectorPreferences.kt | 5 +++++ vector/src/main/res/xml/vector_settings_labs.xml | 7 +++++++ 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index 74ec175d17..1fda57180d 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -3346,6 +3346,8 @@ Have greater visibility and control over all your sessions. Enable client info recording Record the client name, version, and url to recognise sessions more easily in session manager. + Enable Voice broadcast (under active development) + 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) %s\nis looking a little empty. diff --git a/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt b/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt index 16e26ff3b5..0ce4416add 100644 --- a/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt +++ b/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt @@ -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 - ), ) ) } diff --git a/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt b/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt index 5c497c24ec..487094b238 100644 --- a/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt +++ b/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt @@ -85,9 +85,6 @@ class DebugVectorFeatures( override fun isReciprocateQrCodeLogin() = read(DebugFeatureKeys.reciprocateQrCodeLogin) ?: vectorFeatures.isReciprocateQrCodeLogin() - override fun isVoiceBroadcastEnabled(): Boolean = read(DebugFeatureKeys.voiceBroadcastEnabled) - ?: vectorFeatures.isVoiceBroadcastEnabled() - fun override(value: T?, key: Preferences.Key) = 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") } diff --git a/vector-config/src/main/res/values/config-settings.xml b/vector-config/src/main/res/values/config-settings.xml index 7b7aac8156..504c587b8d 100755 --- a/vector-config/src/main/res/values/config-settings.xml +++ b/vector-config/src/main/res/values/config-settings.xml @@ -49,6 +49,8 @@ false true false + true + false diff --git a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt index 255ac6d188..59bccc25fc 100644 --- a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt +++ b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt @@ -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 } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt index 59f9737542..55ec922a57 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt @@ -310,7 +310,7 @@ class MessageComposerFragment : VectorBaseFragment(), A ) attachmentTypeSelector.setAttachmentVisibility( AttachmentTypeSelectorView.Type.VOICE_BROADCAST, - vectorFeatures.isVoiceBroadcastEnabled(), // TODO check user permission + vectorPreferences.isVoiceBroadcastEnabled(), // TODO check user permission ) } attachmentTypeSelector.show(composer.attachmentButton) 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 89fcda142a..5d0f981314 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_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)) + } } diff --git a/vector/src/main/res/xml/vector_settings_labs.xml b/vector/src/main/res/xml/vector_settings_labs.xml index 5b519bdd91..15a255753a 100644 --- a/vector/src/main/res/xml/vector_settings_labs.xml +++ b/vector/src/main/res/xml/vector_settings_labs.xml @@ -117,4 +117,11 @@ android:title="@string/labs_enable_client_info_recording_title" app:isPreferenceVisible="@bool/settings_labs_client_info_recording_visible" /> + +