From 1910536fd6aa2aad0ffdb11a614640f30dab2604 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Mon, 28 Jul 2025 23:10:22 +0200 Subject: [PATCH] Fix notification service --- msgNotificationService/NotificationService.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index d4ad38e14..6f9643832 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -95,6 +95,7 @@ class NotificationService: UNNotificationServiceExtension { VFSUtil.log("[VFS] Error unable to activate.", .error) } */ + if let bestAttemptContent = bestAttemptContent { createCore() if !lc!.config!.getBool(section: "app", key: "disable_chat_feature", defaultValue: false) { @@ -197,13 +198,20 @@ class NotificationService: UNNotificationServiceExtension { return } else { Log.info("Message not found for callid ["+callId+"]") + stopCore() + contentHandler(UNNotificationContent()) + return } - } + } else { + stopCore() + contentHandler(UNNotificationContent()) + return + } } else { + stopCore() contentHandler(UNNotificationContent()) return } - serviceExtensionTimeWillExpire() } } @@ -223,15 +231,18 @@ class NotificationService: UNNotificationServiceExtension { let _ = lc?.getNewChatRoomFromConfAddr(chatRoomAddr: chatRoomInviteAddr) stopCore() contentHandler(UNNotificationContent()) + return } else if let callId = bestAttemptContent.userInfo["call-id"] as? String { stopCore() bestAttemptContent.title = String(localized: "notification_chat_message_received_title") bestAttemptContent.body = NSLocalizedString("IM_MSG", comment: "") contentHandler(bestAttemptContent) + return } else { stopCore() contentHandler(UNNotificationContent()) + return } } }