From 2f5c447cc4d1c7b4369506dc7fc5007ffda896de Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 2 May 2025 11:27:49 +0300 Subject: [PATCH] Fix compilation errors - make sure we update the push notification badge using the received, server-provided unread count. --- NSE/Sources/NotificationHandler.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NSE/Sources/NotificationHandler.swift b/NSE/Sources/NotificationHandler.swift index 3aca9c2d5..08ae5e05b 100644 --- a/NSE/Sources/NotificationHandler.swift +++ b/NSE/Sources/NotificationHandler.swift @@ -43,7 +43,9 @@ class NotificationHandler { MXLog.info("\(tag) Processing event: \(eventID) in room: \(roomID)") // Copy over the unread information to the notification badge - notificationContent.badge = NSNumber(value: notificationContent.unreadCount) + if let unreadCount = notificationContent.unreadCount { + notificationContent.badge = NSNumber(value: unreadCount) + } guard let notificationItemProxy = await userSession.notificationItemProxy(roomID: roomID, eventID: eventID) else { MXLog.error("\(tag) Failed retrieving notification item")