TF-2871 Fix notification loss error when sending multiple notifications simultaneously.

This commit is contained in:
dab246
2024-05-21 02:11:13 +07:00
committed by Dat H. Pham
parent d3bc5912fb
commit ef159c78c5
+8 -8
View File
@@ -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)