From ef159c78c53bed0b7fab501ce0dccc57773e30b5 Mon Sep 17 00:00:00 2001 From: dab246 Date: Tue, 21 May 2024 02:11:13 +0700 Subject: [PATCH] TF-2871 Fix notification loss error when sending multiple notifications simultaneously. --- ios/TwakeMailNSE/NotificationService.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ios/TwakeMailNSE/NotificationService.swift b/ios/TwakeMailNSE/NotificationService.swift index d4e48eb96..7f4f360d1 100644 --- a/ios/TwakeMailNSE/NotificationService.swift +++ b/ios/TwakeMailNSE/NotificationService.swift @@ -94,13 +94,14 @@ class NotificationService: UNNotificationServiceExtension { badgeCount: emails.count, userInfo: [JmapConstants.EMAIL_ID : email.id]) return self.notify() + } else { + self.showNewNotification(title: email.getSenderName(), + subtitle: email.subject, + body: email.preview, + badgeCount: emails.count, + notificationId: email.id, + userInfo: [JmapConstants.EMAIL_ID : email.id]) } - self.showNewNotification(title: email.getSenderName(), - subtitle: email.subject, - body: email.preview, - badgeCount: emails.count, - notificationId: email.id, - userInfo: [JmapConstants.EMAIL_ID : email.id]) } } else { self.showModifiedNotification(title: emails.first!.getSenderName(), @@ -157,8 +158,7 @@ class NotificationService: UNNotificationServiceExtension { content.userInfo = userInfo // Create a notification trigger - let triggerDateTime = Calendar.current.dateComponents([.hour, .minute, .second], from: Date()) - let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDateTime, repeats: false) + let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 2, repeats: false) // Create a notification request let request = UNNotificationRequest(identifier: notificationId, content: content, trigger: trigger)