Fix/refresh view after sync (#531)

This commit is contained in:
kid1412621 2024-01-15 18:09:30 +08:00 committed by GitHub
parent 799a44cdd3
commit 0800e838a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -113,7 +113,7 @@ fun FeedsPage(
feedsViewModel.fetchAccount()
}
LaunchedEffect(filterUiState) {
LaunchedEffect(filterUiState, isSyncing) {
snapshotFlow { filterUiState }.collect {
feedsViewModel.pullFeeds(it)
}

View File

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