Skip to content

Commit

Permalink
fix: Folders unread count now correctly update for all Folders
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Feb 13, 2025
1 parent 5700f96 commit e839635
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,19 @@ class RefreshController @Inject constructor(
}

private fun updateFoldersUnreadCount(foldersIds: Set<String>, realm: MutableRealm): Int? {
return foldersIds.firstNotNullOfOrNull {

var inboxUnreadCount: Int? = null

foldersIds.forEach {
val folder = realm.getUpToDateFolder(it)

val unreadCount = ThreadController.getUnreadThreadsCount(folder)
folder.unreadCountLocal = unreadCount

return@firstNotNullOfOrNull if (folder.role == FolderRole.INBOX) unreadCount else null
if (folder.role == FolderRole.INBOX) inboxUnreadCount = unreadCount
}

return inboxUnreadCount
}

private suspend fun updateMailboxUnreadCount(unreadCount: Int?) {
Expand Down

0 comments on commit e839635

Please sign in to comment.