Skip to content

Commit

Permalink
Fixed unread count in title for tags (#308)
Browse files Browse the repository at this point in the history
* fix: unread count in title for groups (tags)

* chore: slightly adjust German translation
  • Loading branch information
svenjacobs authored Jun 14, 2024
1 parent 98f3fa8 commit c04fdcb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ class Repository(override val di: DI) : DIAware {

val currentFeedAndTag: StateFlow<Pair<Long, String>> = settingsStore.currentFeedAndTag

fun getUnreadCount(feedId: Long) =
feedItemStore.getFeedItemCountRaw(
feedId = feedId,
tag = "",
minReadTime = Instant.now(),
filter = emptyFeedListFilter,
)
fun getUnreadCount(
feedId: Long,
tag: String = "",
) = feedItemStore.getFeedItemCountRaw(
feedId = feedId,
tag = tag,
minReadTime = Instant.now(),
filter = emptyFeedListFilter,
)

fun setCurrentFeedAndTag(
feedId: Long,
Expand Down Expand Up @@ -419,7 +421,7 @@ class Repository(override val di: DI) : DIAware {
fun getScreenTitleForFeedOrTag(
feedId: Long,
tag: String,
) = getUnreadCount(feedId).mapLatest { unreadCount ->
) = getUnreadCount(feedId, tag).mapLatest { unreadCount ->
ScreenTitle(
title =
when {
Expand All @@ -441,7 +443,7 @@ class Repository(override val di: DI) : DIAware {
@OptIn(ExperimentalCoroutinesApi::class)
fun getScreenTitleForCurrentFeedOrTag(): Flow<ScreenTitle> =
currentFeedAndTag.flatMapLatest { (feedId, tag) ->
getUnreadCount(feedId).mapLatest { unreadCount ->
getUnreadCount(feedId, tag).mapLatest { unreadCount ->
ScreenTitle(
title =
when {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,6 @@
<string name="skip_duplicate_articles">Doppelte Artikel überspringen</string>
<string name="skip_duplicate_articles_desc">Artikel mit Links oder Titeln, die mit bestehenden Artikeln identisch sind, werden ignoriert</string>
<string name="feed_item_style_compact_card">Kompakte Kartei</string>
<string name="show_title_unread_count">Zeige Anzahl ungelesener Artikel im Titel</string>
<string name="show_title_unread_count">Anzahl ungelesener Artikel im Titel anzeigen</string>
<string name="touch_to_play_audio">Berühren, um Audio abzuspielen</string>
</resources>

0 comments on commit c04fdcb

Please sign in to comment.