Use async versions of UNUserNotificationCenterDelegate functions.
This commit is contained in:
parent
55d67c3277
commit
b94935998b
|
@ -481,30 +481,25 @@ import Sparkle
|
|||
|
||||
// MARK: UNUserNotificationCenterDelegate
|
||||
|
||||
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
||||
completionHandler([.banner, .badge, .sound])
|
||||
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions {
|
||||
|
||||
[.banner, .badge, .sound]
|
||||
}
|
||||
|
||||
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
||||
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
|
||||
|
||||
let userInfo = response.notification.request.content.userInfo
|
||||
guard let articlePathInfo = ArticlePathInfo(userInfo: userInfo) else {
|
||||
completionHandler()
|
||||
return
|
||||
}
|
||||
|
||||
let actionIdentifier = response.actionIdentifier
|
||||
|
||||
Task { @MainActor in
|
||||
switch actionIdentifier {
|
||||
switch response.actionIdentifier {
|
||||
case "MARK_AS_READ":
|
||||
handleMarkAsRead(articlePathInfo: articlePathInfo)
|
||||
await handleMarkAsRead(articlePathInfo: articlePathInfo)
|
||||
case "MARK_AS_STARRED":
|
||||
handleMarkAsStarred(articlePathInfo: articlePathInfo)
|
||||
await handleMarkAsStarred(articlePathInfo: articlePathInfo)
|
||||
default:
|
||||
mainWindowController?.handle(articlePathInfo: articlePathInfo)
|
||||
}
|
||||
completionHandler()
|
||||
await mainWindowController?.handle(articlePathInfo: articlePathInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue