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 {
cancelNotification(notification)
}
type(of: self).clearExistingNotifications()
}
public class func clearExistingNotifications() {
// This will cancel all "scheduled" local notifications that haven't
// been presented yet.
UIApplication.shared.cancelAllLocalNotifications()

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

Loading…
Cancel
Save