From 08e265220d0ef1862fd86b74f64ebb949e241cd9 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 2 May 2025 11:41:46 +0300 Subject: [PATCH] Always set the push notification badge, even if the unread count is missing. --- NSE/Sources/NotificationHandler.swift | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/NSE/Sources/NotificationHandler.swift b/NSE/Sources/NotificationHandler.swift index 08ae5e05b..65f7360de 100644 --- a/NSE/Sources/NotificationHandler.swift +++ b/NSE/Sources/NotificationHandler.swift @@ -43,9 +43,7 @@ class NotificationHandler { MXLog.info("\(tag) Processing event: \(eventID) in room: \(roomID)") // Copy over the unread information to the notification badge - if let unreadCount = notificationContent.unreadCount { - notificationContent.badge = NSNumber(value: unreadCount) - } + notificationContent.badge = notificationContent.unreadCount as NSNumber? guard let notificationItemProxy = await userSession.notificationItemProxy(roomID: roomID, eventID: eventID) else { MXLog.error("\(tag) Failed retrieving notification item") @@ -83,10 +81,7 @@ class NotificationHandler { MXLog.info("\(tag) Discarding notification") let content = UNMutableNotificationContent() - - if let unreadCount = notificationContent.unreadCount { - content.badge = NSNumber(value: unreadCount) - } + content.badge = notificationContent.unreadCount as NSNumber? contentHandler(content) }