mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Update the app badge and clear read notifications on room list updates
The sync update action is sent from the room list service state listener, which fires before the SDK has applied the new unread counts, leaving the app badge one sync behind. Drive both the badge and the clearing of delivered notifications for fully read rooms from the room list publisher instead, moving the observer from the ChatsTabFlowCoordinator into the UserSessionFlowCoordinator. The NotificationManager now receives the badge count from the caller so the same value can be reused elsewhere.
This commit is contained in:
@@ -262,10 +262,8 @@ final class NotificationManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
func updatingAppBadgeCountUsesTheClientSideCount() async {
|
||||
clientProxy.totalUnreadNotifications = 7
|
||||
|
||||
await notificationManager.updateAppBadgeCount()
|
||||
func updatingAppBadgeCount() async {
|
||||
await notificationManager.updateAppBadgeCount(7)
|
||||
|
||||
#expect(notificationCenter.setBadgeCountReceivedNewBadgeCount == 7)
|
||||
#expect(appSettings.lastKnownBadgeCount == 7)
|
||||
@@ -275,7 +273,7 @@ final class NotificationManagerTests {
|
||||
func updatingAppBadgeCountWithoutASessionDoesNothing() async {
|
||||
notificationManager.setUserSession(nil)
|
||||
|
||||
await notificationManager.updateAppBadgeCount()
|
||||
await notificationManager.updateAppBadgeCount(7)
|
||||
|
||||
#expect(!notificationCenter.setBadgeCountCalled)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user