Skip to content

Commit

Permalink
Experimental setting to show combined mention/unread count in overview
Browse files Browse the repository at this point in the history
Change-Id: I39a60ed7154841cc0ab72f47fdd54c914d2fd2dc
  • Loading branch information
SpiritCroc committed Jun 1, 2024
1 parent 1558a38 commit b047601
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ private fun ScUnreadCounter(room: RoomListRoomSummary) {
val badgeColor: Color
var outlinedBadge = false
when {
ScPrefs.DUAL_MENTION_UNREAD_COUNTS.value() && highlightCount > 0 && (notificationCount > highlightCount || (notificationCount == 0 && unreadCount > highlightCount)) -> {
val fullUnreadToUse = if (notificationCount == 0) unreadCount else notificationCount
count = "${formatUnreadCount(highlightCount)}/${formatUnreadCount(fullUnreadToUse)}"
badgeColor = ElementTheme.colors.bgCriticalPrimary
}
notificationCount > 0 -> {
count = formatUnreadCount(notificationCount)
badgeColor = if (highlightCount > 0) ElementTheme.colors.bgCriticalPrimary else ElementTheme.colors.unreadIndicator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ object ScPrefs {
val BURY_LOW_PRIORITY = ScBoolPref("BURY_LOW_PRIORITY", false, R.string.sc_pref_bury_low_priority_title, R.string.sc_pref_bury_low_priority_summary, upstreamChoice = false, authorsChoice = false)
val CLIENT_SIDE_SORT = ScBoolPref("CLIENT_SIDE_SORT", false, R.string.sc_pref_client_side_sort_title, R.string.sc_pref_client_side_sort_summary, upstreamChoice = false, authorsChoice = false)
val SORT_BY_ACTIVITY = ScBoolPref("SORT_BY_ACTIVITY", false, R.string.sc_pref_client_side_activity_sort_title, R.string.sc_pref_client_side_activity_sort_summary, authorsChoice = false, dependencies = CLIENT_SIDE_SORT.asDependencies())
val DUAL_MENTION_UNREAD_COUNTS = ScBoolPref("DUAL_MENTION_UNREAD_COUNTS", false, R.string.sc_pref_dual_mention_unread_counts_title, R.string.sc_pref_dual_mention_unread_counts_summary, authorsChoice = true, dependencies = SC_OVERVIEW_LAYOUT.asDependencies())
// Spaces
val SPACE_NAV = ScBoolPref("SPACE_NAV", false, R.string.sc_space_nav_title, R.string.sc_space_nav_summary, upstreamChoice = false, authorsChoice = true)
val COMPACT_ROOT_SPACES = ScBoolPref("COMPACT_ROOT_SPACES", false, R.string.sc_compact_root_spaces_title, R.string.sc_compact_root_spaces_summary, authorsChoice = true, dependencies = SPACE_NAV.asDependencies())
Expand Down Expand Up @@ -125,6 +126,7 @@ object ScPrefs {
BURY_LOW_PRIORITY,
CLIENT_SIDE_SORT,
SORT_BY_ACTIVITY,
DUAL_MENTION_UNREAD_COUNTS,
)),
ScPrefCategory(R.string.sc_pref_category_timeline, null, listOf(
PL_DISPLAY_NAME,
Expand Down Expand Up @@ -168,6 +170,7 @@ object ScPrefs {
COMPACT_APP_BAR,
)),
ScPrefCategory(R.string.sc_pref_category_misc, null, listOf(
DUAL_MENTION_UNREAD_COUNTS.copy(titleRes = R.string.sc_pref_dual_mention_unread_counts_title_short),
SPACE_NAV,
COMPACT_ROOT_SPACES,
ScPrefCategory(R.string.sc_pseudo_spaces_title, null, listOf(
Expand Down
3 changes: 3 additions & 0 deletions schildi/lib/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<string name="sc_pseudo_space_hide_empty_unread">Hide empty unread spaces</string>
<string name="sc_space_empty_title">Empty space</string>
<string name="sc_space_empty_summary">Navigate to another space to find your chats</string>
<string name="sc_pref_dual_mention_unread_counts_title">Combined mention/unread count</string>
<string name="sc_pref_dual_mention_unread_counts_title_short">Dual mention count</string>
<string name="sc_pref_dual_mention_unread_counts_summary">When a highlighted chat\'s mention count differs from unread count, show both</string>

<string name="sc_pref_dev_quick_options">Quick settings</string>
<string name="sc_pref_debug_read_marker">Debug read marker</string>
Expand Down

0 comments on commit b047601

Please sign in to comment.