Browse Source

no heads-up foreground notifications, only add them to the notification center if supported and update the badge counter

cyberta 4 years ago
parent
commit
dcf167a975
1 changed files with 4 additions and 6 deletions
  1. 4 6
      deltachat-ios/AppDelegate.swift

+ 4 - 6
deltachat-ios/AppDelegate.swift

@@ -279,13 +279,11 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
     }
 
     func userNotificationCenter(_: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
-        //remove foreground notifications after 4 seconds
-        if notification.request.identifier == Constants.notificationIdentifier {
-            DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
-                UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [notification.request.identifier])
-            }
+        if #available(iOS 14.0, *) {
+            completionHandler([.list, .badge])
+        } else {
+            completionHandler([.badge])
         }
-        completionHandler([.alert, .sound])
     }
 
     func registerForPushNotifications() {