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