From 31c01c98de71b60145473eb99416a88eccf1cf63 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Tue, 15 Mar 2022 20:18:33 +0100 Subject: [PATCH] Possibility to hide start call buttons from the toolbar Change-Id: Ica35e0dfd6b82beb90754dd5997fa0d756d816a5 --- FEATURES.md | 1 + .../app/features/home/room/detail/TimelineViewModel.kt | 4 ++-- .../im/vector/app/features/settings/VectorPreferences.kt | 6 ++++++ vector/src/main/res/values/strings_sc.xml | 2 ++ vector/src/main/res/xml/vector_settings_voice_video.xml | 8 ++++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/FEATURES.md b/FEATURES.md index ed14ba5f9a..54e801813d 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -27,6 +27,7 @@ Here you can find some extra features and changes compared to Element Android (w - Smaller compose area (as before Element 1.0.12) - Compose area: emoji button on the left, attachments button on the right (flipped compared to Element, but what most other messengers do, thus more familiar to most users) - Setting to re-alert for new messages even if there's still an old notification for that room +- Setting to hide start call buttons from the room's toolbar - Branding (name, app icon, links) - Show a toast instead of a snackbar after copying text, in order to not block the input area right after copying diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt index 1f80facd44..57e5d24399 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt @@ -728,8 +728,8 @@ class TimelineViewModel @AssistedInject constructor( R.id.timeline_setting -> false // replaced by show_room_info (downstream) R.id.invite -> false // state.canInvite // SC: disabled, we can do that over show_participants as well R.id.open_matrix_apps -> session.integrationManagerService().isIntegrationEnabled() - R.id.voice_call -> state.isWebRTCCallOptionAvailable() - R.id.video_call -> state.isWebRTCCallOptionAvailable() || state.jitsiState.confId == null || state.jitsiState.hasJoined + R.id.voice_call -> !vectorPreferences.hideCallButtons() && state.isWebRTCCallOptionAvailable() + R.id.video_call -> !vectorPreferences.hideCallButtons() && (state.isWebRTCCallOptionAvailable() || state.jitsiState.confId == null || state.jitsiState.hasJoined) // Show Join conference button only if there is an active conf id not joined. Otherwise fallback to default video disabled. ^ R.id.join_conference -> !state.isWebRTCCallOptionAvailable() && state.jitsiState.confId != null && !state.jitsiState.hasJoined R.id.search -> state.isSearchAvailable() 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 c47b937a13..d21076a4b9 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 @@ -216,6 +216,7 @@ class VectorPreferences @Inject constructor(private val context: Context, privat private const val SETTINGS_SPACE_MEMBERS_IN_SPACE_ROOMS = "SETTINGS_SPACE_MEMBERS_IN_SPACE_ROOMS" private const val SETTINGS_ENABLE_SPACE_PAGER = "SETTINGS_ENABLE_SPACE_PAGER" private const val SETTINGS_NOTIF_ONLY_ALERT_ONCE = "SETTINGS_NOTIF_ONLY_ALERT_ONCE" + private const val SETTINGS_HIDE_CALL_BUTTONS = "SETTINGS_HIDE_CALL_BUTTONS" private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH" @@ -1083,6 +1084,11 @@ class VectorPreferences @Inject constructor(private val context: Context, privat return defaultPrefs.getBoolean(SETTINGS_NOTIF_ONLY_ALERT_ONCE, true) } + // SC addition + fun hideCallButtons(): Boolean { + return defaultPrefs.getBoolean(SETTINGS_HIDE_CALL_BUTTONS, false) + } + /** * I likely do more fresh installs of the app than anyone else, so a shortcut to change some of the default settings to * my preferred values can safe me some time diff --git a/vector/src/main/res/values/strings_sc.xml b/vector/src/main/res/values/strings_sc.xml index 17cb616cac..4240d16d2d 100644 --- a/vector/src/main/res/values/strings_sc.xml +++ b/vector/src/main/res/values/strings_sc.xml @@ -165,6 +165,8 @@ Only alert once Omit alert sounds for new messages if there is already an open notification for that chat + Hide call buttons + Never show buttons in the room toolbar to start voice or video calls Default diff --git a/vector/src/main/res/xml/vector_settings_voice_video.xml b/vector/src/main/res/xml/vector_settings_voice_video.xml index 01067a1e4f..4ffa8d668a 100644 --- a/vector/src/main/res/xml/vector_settings_voice_video.xml +++ b/vector/src/main/res/xml/vector_settings_voice_video.xml @@ -6,10 +6,18 @@ + +