Make unread-counter for non-notifications a setting

Change-Id: I6e097ee4577868b1e82a0cd69bd67122cb57a4d4
This commit is contained in:
SpiritCroc 2020-09-10 12:01:54 +02:00
parent 91c7e39d50
commit 1d6fd71adb
6 changed files with 38 additions and 6 deletions

View File

@ -40,4 +40,8 @@ class UserPreferencesProvider @Inject constructor(private val vectorPreferences:
fun neverShowLongClickOnRoomHelpAgain() { fun neverShowLongClickOnRoomHelpAgain() {
vectorPreferences.neverShowLongClickOnRoomHelpAgain() vectorPreferences.neverShowLongClickOnRoomHelpAgain()
} }
fun shouldShowUnimportantCounterBadge(): Boolean {
return vectorPreferences.shouldShowUnimportantCounterBadge()
}
} }

View File

@ -137,7 +137,7 @@ class RoomSummaryController @Inject constructor(private val stringProvider: Stri
summaries.map { it.notificationCount }.sumBy { i -> i } summaries.map { it.notificationCount }.sumBy { i -> i }
} }
// SC addition // SC addition
val unreadMessages = if (summaries.isEmpty()) { val unreadMessages = if (summaries.isEmpty() || !userPreferencesProvider.shouldShowUnimportantCounterBadge()) {
0 0
} else { } else {
// TODO actual sum of events instead of sum of chats? // TODO actual sum of events instead of sum of chats?

View File

@ -177,6 +177,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
// SC additions // SC additions
private const val SETTINGS_SINGLE_OVERVIEW = "SETTINGS_SINGLE_OVERVIEW" private const val SETTINGS_SINGLE_OVERVIEW = "SETTINGS_SINGLE_OVERVIEW"
private const val SETTINGS_ROOM_UNREAD_KIND = "SETTINGS_ROOM_UNREAD_KIND" 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 DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH" private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH"
@ -844,6 +845,11 @@ class VectorPreferences @Inject constructor(private val context: Context) {
} }
} }
// SC addition
fun shouldShowUnimportantCounterBadge(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_UNIMPORTANT_COUNTER_BADGE, true)
}
/** /**
* The user enable protecting app access with pin code * The user enable protecting app access with pin code
*/ */

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="settings_home_overview">Übersicht</string>
<string name="settings_single_overview">Vereinte Chat-Übersicht</string> <string name="settings_single_overview">Vereinte Chat-Übersicht</string>
<string name="settings_single_overview_summary">Zeige sowohl Direktnachrichten als auch Gruppenchats in einer gemeinsamen Übersicht</string> <string name="settings_single_overview_summary">Zeige sowohl Direktnachrichten als auch Gruppenchats in einer gemeinsamen Übersicht</string>
@ -22,6 +24,9 @@
<string name="bubble_style_start">Selbe Seite</string> <string name="bubble_style_start">Selbe Seite</string>
<string name="bubble_style_both">Beide Seiten</string> <string name="bubble_style_both">Beide Seiten</string>
<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="login_mobile_device_sc">SchildiChat Android</string> <string name="login_mobile_device_sc">SchildiChat Android</string>
<string name="bottom_action_all">Übersicht</string> <string name="bottom_action_all">Übersicht</string>
<string name="all_list_rooms_empty_title">SchildiChat</string> <string name="all_list_rooms_empty_title">SchildiChat</string>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="settings_home_overview">Overview</string>
<string name="settings_single_overview">Combined chat overview</string> <string name="settings_single_overview">Combined chat overview</string>
<string name="settings_single_overview_summary">View both direct messages and rooms on one page</string> <string name="settings_single_overview_summary">View both direct messages and rooms on one page</string>
@ -22,6 +24,9 @@
<string name="bubble_style_start">Same side</string> <string name="bubble_style_start">Same side</string>
<string name="bubble_style_both">Both sides</string> <string name="bubble_style_both">Both sides</string>
<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="login_mobile_device_sc">SchildiChat Android</string> <string name="login_mobile_device_sc">SchildiChat Android</string>
<string name="bottom_action_all">Overview</string> <string name="bottom_action_all">Overview</string>
<string name="all_list_rooms_empty_title">SchildiChat</string> <string name="all_list_rooms_empty_title">SchildiChat</string>

View File

@ -39,6 +39,18 @@
android:title="@string/bubble_style" android:title="@string/bubble_style"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<im.vector.app.core.preference.VectorPreference
android:dialogTitle="@string/font_size"
android:key="SETTINGS_INTERFACE_TEXT_SIZE_KEY"
android:persistent="false"
android:title="@string/font_size" />
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreferenceCategory
android:key="SETTINGS_HOME_OVERVIEW_KEY"
android:title="@string/settings_home_overview">
<im.vector.app.core.preference.VectorSwitchPreference <im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="SETTINGS_SINGLE_OVERVIEW" android:key="SETTINGS_SINGLE_OVERVIEW"
@ -53,11 +65,11 @@
android:summary="%s" android:summary="%s"
android:title="@string/settings_room_unread_kind" /> android:title="@string/settings_room_unread_kind" />
<im.vector.app.core.preference.VectorPreference <im.vector.app.core.preference.VectorSwitchPreference
android:dialogTitle="@string/font_size" android:defaultValue="true"
android:key="SETTINGS_INTERFACE_TEXT_SIZE_KEY" android:key="SETTINGS_UNIMPORTANT_COUNTER_BADGE"
android:persistent="false" android:summary="@string/settings_unimportant_counter_badge_summary"
android:title="@string/font_size" /> android:title="@string/settings_unimportant_counter_badge" />
</im.vector.app.core.preference.VectorPreferenceCategory> </im.vector.app.core.preference.VectorPreferenceCategory>