From 455d48ea6aa67a8eae6d1e6a01ef79452a293546 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Sat, 5 Dec 2020 17:46:32 +0100 Subject: [PATCH] Hide "mark unread" functionality in labs Not many other clients support this yet Change-Id: I37c618a592fec834f6376802434a5c8a20d1bbb1 --- .../RoomListQuickActionsEpoxyController.kt | 19 +++++++++++-------- .../features/settings/VectorPreferences.kt | 6 ++++++ vector/src/main/res/values-de/strings_sc.xml | 3 +++ vector/src/main/res/values/strings_sc.xml | 3 +++ .../src/main/res/xml/vector_settings_labs.xml | 6 ++++++ 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt index a943435a46..31bbee4f46 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt @@ -34,6 +34,7 @@ import javax.inject.Inject class RoomListQuickActionsEpoxyController @Inject constructor( private val avatarRenderer: AvatarRenderer, private val stringProvider: StringProvider, + private val vectorPreferences: VectorPreferences, private val scSdkPreferences: ScSdkPreferences ) : TypedEpoxyController() { @@ -57,14 +58,16 @@ class RoomListQuickActionsEpoxyController @Inject constructor( lowPriorityClickListener { listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.LowPriority(roomSummary.roomId)) } } - // Mark read/unread - dividerItem { - id("mark_unread_separator") - } - if (roomSummary.scIsUnread(scSdkPreferences)) { - RoomListQuickActionsSharedAction.MarkRead(roomSummary.roomId).toBottomSheetItem(-1) - } else { - RoomListQuickActionsSharedAction.MarkUnread(roomSummary.roomId).toBottomSheetItem(-1) + if (vectorPreferences.labAllowMarkUnread()) { + // Mark read/unread + dividerItem { + id("mark_unread_separator") + } + if (roomSummary.scIsUnread(scSdkPreferences)) { + RoomListQuickActionsSharedAction.MarkRead(roomSummary.roomId).toBottomSheetItem(-1) + } else { + RoomListQuickActionsSharedAction.MarkUnread(roomSummary.roomId).toBottomSheetItem(-1) + } } // Notifications 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 b7a2eb5006..7a50ce3c85 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 @@ -183,6 +183,7 @@ class VectorPreferences @Inject constructor(private val context: Context) { private const val SETTINGS_ROOM_UNREAD_KIND = "SETTINGS_ROOM_UNREAD_KIND" private const val SETTINGS_UNIMPORTANT_COUNTER_BADGE = "SETTINGS_UNIMPORTANT_COUNTER_BADGE" private const val SETTINGS_SIMPLIFIED_MODE = "SETTINGS_SIMPLIFIED_MODE" + private const val SETTINGS_LABS_ALLOW_MARK_UNREAD = "SETTINGS_LABS_ALLOW_MARK_UNREAD" private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH" @@ -884,6 +885,11 @@ class VectorPreferences @Inject constructor(private val context: Context) { .apply() } + // SC addition + fun labAllowMarkUnread(): Boolean { + return defaultPrefs.getBoolean(SETTINGS_LABS_ALLOW_MARK_UNREAD, false) + } + /** * The user enable protecting app access with pin code. * Currently we use the pin code store to know if the pin is enabled, so this is not used diff --git a/vector/src/main/res/values-de/strings_sc.xml b/vector/src/main/res/values-de/strings_sc.xml index 8af06b6abe..5f1434a9cc 100644 --- a/vector/src/main/res/values-de/strings_sc.xml +++ b/vector/src/main/res/values-de/strings_sc.xml @@ -44,6 +44,9 @@ Zähle unwichtige Chat-Ereignisse Betrachte auch Chats ohne Benachrichtigung beim Zählen der ungelesenen Nachrichten pro Kategorie + Chats als ungelesen markieren + Erlaube, Chats als ungelesen zu markieren. Andere Matrix-Clients unterstützen diese Funktionalität möglicherweise noch nicht. + SchildiChat Android Übersicht SchildiChat diff --git a/vector/src/main/res/values/strings_sc.xml b/vector/src/main/res/values/strings_sc.xml index 4a6fcd6d30..f56bf9f619 100644 --- a/vector/src/main/res/values/strings_sc.xml +++ b/vector/src/main/res/values/strings_sc.xml @@ -44,6 +44,9 @@ Count unimportant chat events Include chats without notifications in the category unread counter + Mark chats as unread + Allow to mark chats as unread. Other matrix clients might not support this functionality yet. + SchildiChat Android Overview SchildiChat diff --git a/vector/src/main/res/xml/vector_settings_labs.xml b/vector/src/main/res/xml/vector_settings_labs.xml index 6654c6f96f..3bf97eb18c 100644 --- a/vector/src/main/res/xml/vector_settings_labs.xml +++ b/vector/src/main/res/xml/vector_settings_labs.xml @@ -40,6 +40,12 @@ android:title="@string/settings_system_dark_theme_pre_ten" android:summary="@string/settings_system_dark_theme_pre_ten_summary" /> + +