Skip to content

Commit

Permalink
Fix crashing notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
rrroyal committed Sep 22, 2024
1 parent b5dda93 commit 0de1eb6
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@
import PortainerKit
import UserNotifications

extension AppDelegate: UNUserNotificationCenterDelegate {
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions {
[.banner, .list, .sound]
extension AppDelegate: @preconcurrency UNUserNotificationCenterDelegate {
func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
completionHandler([.banner, .list, .sound])
}

nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
await AppState.shared.handleNotification(response)
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
Task { @MainActor in
AppState.shared.handleNotification(response)
completionHandler()
}
}
}

0 comments on commit 0de1eb6

Please sign in to comment.