Skip to content

Commit

Permalink
Fix/refresh view after sync (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
kid1412621 authored Jan 15, 2024
1 parent 799a44c commit 0800e83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fun FeedsPage(
feedsViewModel.fetchAccount()
}

LaunchedEffect(filterUiState) {
LaunchedEffect(filterUiState, isSyncing) {
snapshotFlow { filterUiState }.collect {
feedsViewModel.pullFeeds(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ class FeedsViewModel @Inject constructor(
val isStarred = filterState.filter.isStarred()
val isUnread = filterState.filter.isUnread()
_feedsUiState.update {
val important = rssService.get().pullImportant(isStarred, isUnread)
it.copy(
importantSum = rssService.get().pullImportant(isStarred, isUnread)
importantSum = important
.mapLatest {
(it["sum"] ?: 0).run {
androidStringsHelper.getQuantityString(
Expand All @@ -59,7 +60,7 @@ class FeedsViewModel @Inject constructor(
}
}.flowOn(defaultDispatcher),
groupWithFeedList = combine(
rssService.get().pullImportant(isStarred, isUnread),
important,
rssService.get().pullFeeds()
) { importantMap, groupWithFeedList ->
val groupIterator = groupWithFeedList.iterator()
Expand Down

0 comments on commit 0800e83

Please sign in to comment.