Hide "mark unread" functionality in labs

Not many other clients support this yet

Change-Id: I37c618a592fec834f6376802434a5c8a20d1bbb1
This commit is contained in:
SpiritCroc 2020-12-05 17:46:32 +01:00
parent 3e4f6a4689
commit 455d48ea6a
5 changed files with 29 additions and 8 deletions

View file

@ -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<RoomListQuickActionsState>() {
@ -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

View file

@ -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

View file

@ -44,6 +44,9 @@
<string name="settings_unimportant_counter_badge">Zähle unwichtige Chat-Ereignisse</string>
<string name="settings_unimportant_counter_badge_summary">Betrachte auch Chats ohne Benachrichtigung beim Zählen der ungelesenen Nachrichten pro Kategorie</string>
<string name="labs_mark_rooms_unread">Chats als ungelesen markieren</string>
<string name="labs_mark_rooms_unread_summary">Erlaube, Chats als ungelesen zu markieren. Andere Matrix-Clients unterstützen diese Funktionalität möglicherweise noch nicht.</string>
<string name="login_mobile_device_sc">SchildiChat Android</string>
<string name="bottom_action_all">Übersicht</string>
<string name="all_list_rooms_empty_title">SchildiChat</string>

View file

@ -44,6 +44,9 @@
<string name="settings_unimportant_counter_badge">Count unimportant chat events</string>
<string name="settings_unimportant_counter_badge_summary">Include chats without notifications in the category unread counter</string>
<string name="labs_mark_rooms_unread">Mark chats as unread</string>
<string name="labs_mark_rooms_unread_summary">Allow to mark chats as unread. Other matrix clients might not support this functionality yet.</string>
<string name="login_mobile_device_sc">SchildiChat Android</string>
<string name="bottom_action_all">Overview</string>
<string name="all_list_rooms_empty_title">SchildiChat</string>

View file

@ -40,6 +40,12 @@
android:title="@string/settings_system_dark_theme_pre_ten"
android:summary="@string/settings_system_dark_theme_pre_ten_summary" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_ALLOW_MARK_UNREAD"
android:title="@string/labs_mark_rooms_unread"
android:summary="@string/labs_mark_rooms_unread_summary" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY"