import Cocoa import FlutterMacOS import UserNotifications @main class AppDelegate: FlutterAppDelegate, UNUserNotificationCenterDelegate { override func applicationDidFinishLaunching(_ notification: Notification) { if #available(macOS 10.14, *) { UNUserNotificationCenter.current().delegate = self } super.applicationDidFinishLaunching(notification) } override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } // MARK: - UNUserNotificationCenterDelegate func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { if #available(macOS 11.0, *) { completionHandler([.banner, .sound]) } else { completionHandler([.alert, .sound]) } } }