mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:06:00 +00:00
Introduce a local mechanism for managing the app's badge count
This commit is contained in:
@@ -237,6 +237,37 @@ final class NotificationManagerTests {
|
||||
await notificationManager.userNotificationCenter(UNUserNotificationCenter.current(), didReceive: response)
|
||||
#expect(notificationTappedDelegateCalled)
|
||||
}
|
||||
|
||||
@Test
|
||||
func updatingAppBadgeCountUsesTheClientSideCount() async {
|
||||
appSettings.roomListNotificationCountEnabled = true
|
||||
clientProxy.totalUnreadNotifications = 7
|
||||
|
||||
await notificationManager.updateAppBadgeCount()
|
||||
|
||||
#expect(notificationCenter.setBadgeCountReceivedNewBadgeCount == 7)
|
||||
#expect(appSettings.lastKnownBadgeCount == 7)
|
||||
}
|
||||
|
||||
@Test
|
||||
func updatingAppBadgeCountWithoutASessionDoesNothing() async {
|
||||
appSettings.roomListNotificationCountEnabled = true
|
||||
notificationManager.setUserSession(nil)
|
||||
|
||||
await notificationManager.updateAppBadgeCount()
|
||||
|
||||
#expect(!notificationCenter.setBadgeCountCalled)
|
||||
}
|
||||
|
||||
@Test
|
||||
func updatingAppBadgeCountWithFeatureDisabledDoesNothing() async {
|
||||
appSettings.roomListNotificationCountEnabled = false
|
||||
clientProxy.totalUnreadNotifications = 7
|
||||
|
||||
await notificationManager.updateAppBadgeCount()
|
||||
|
||||
#expect(!notificationCenter.setBadgeCountCalled)
|
||||
}
|
||||
}
|
||||
|
||||
extension NotificationManagerTests: @MainActor NotificationManagerDelegate {
|
||||
|
||||
Reference in New Issue
Block a user