mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-24 21:40:48 +02:00
tests(e2e): improve coverage
This commit is contained in:
@@ -120,7 +120,8 @@ func showNotification(invoke: Invoke, notification: Notification)
|
||||
}
|
||||
|
||||
struct CancelArgs: Decodable {
|
||||
let notifications: [Int]
|
||||
// `cancelAll()` sends no list: cancel every pending notification
|
||||
let notifications: [Int]?
|
||||
}
|
||||
|
||||
struct Action: Decodable {
|
||||
@@ -216,9 +217,13 @@ class NotificationPlugin: Plugin {
|
||||
@objc func cancel(_ invoke: Invoke) throws {
|
||||
let args = try invoke.parseArgs(CancelArgs.self)
|
||||
|
||||
UNUserNotificationCenter.current().removePendingNotificationRequests(
|
||||
withIdentifiers: args.notifications.map { String($0) }
|
||||
)
|
||||
if let notifications = args.notifications {
|
||||
UNUserNotificationCenter.current().removePendingNotificationRequests(
|
||||
withIdentifiers: notifications.map { String($0) }
|
||||
)
|
||||
} else {
|
||||
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
|
||||
}
|
||||
invoke.resolve()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user