remove any lingering legacy notifications in modern notification adapter

pull/2/head
Michael Kirk 6 years ago
parent cb3a36ba3d
commit 5e0c10a1a9

@ -222,6 +222,10 @@ extension LegacyNotificationPresenterAdaptee: NotificationPresenterAdaptee {
for (_, notification) in notifications { for (_, notification) in notifications {
cancelNotification(notification) cancelNotification(notification)
} }
type(of: self).clearExistingNotifications()
}
public class func clearExistingNotifications() {
// This will cancel all "scheduled" local notifications that haven't // This will cancel all "scheduled" local notifications that haven't
// been presented yet. // been presented yet.
UIApplication.shared.cancelAllLocalNotifications() UIApplication.shared.cancelAllLocalNotifications()

@ -181,6 +181,7 @@ extension UserNotificationPresenterAdaptee: NotificationPresenterAdaptee {
AssertIsOnMainThread() AssertIsOnMainThread()
notificationCenter.removeAllPendingNotificationRequests() notificationCenter.removeAllPendingNotificationRequests()
notificationCenter.removeAllDeliveredNotifications() notificationCenter.removeAllDeliveredNotifications()
LegacyNotificationPresenterAdaptee.clearExistingNotifications()
} }
func shouldPresentNotification(category: AppNotificationCategory, userInfo: [AnyHashable: Any]) -> Bool { func shouldPresentNotification(category: AppNotificationCategory, userInfo: [AnyHashable: Any]) -> Bool {

Loading…
Cancel
Save