Skip to content

Add function that exposes removeAllPendingNotificationRequests #2567

@ohkhan

Description

@ohkhan

At the moment the method for cancelling all notifications involves also clearing notifications that have been pushed.
Current implementation for reference:

func cancelAll(_ result: @escaping FlutterResult) {
if #available(macOS 10.14, *) {
let center = UNUserNotificationCenter.current()
center.removeAllPendingNotificationRequests()
center.removeAllDeliveredNotifications()
result(nil)
} else {
let center = NSUserNotificationCenter.default
for scheduledNotification in center.scheduledNotifications {
center.removeScheduledNotification(scheduledNotification)
}
center.removeAllDeliveredNotifications()
result(nil)
}
}

In order to avoid canceling pushed notifications one has to use a persistent solution to track notification IDs and delivery times in order to know which ids can be cancelled. It would be great if we could simply expose a function that exclusively calls removeAllPendingNotificationRequests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions