Files
umbrix/macos/Runner/AppDelegate.swift
hiddify-com 607f1297f8 check macos
2024-08-05 15:48:20 +02:00

35 lines
1.2 KiB
Swift

import Cocoa
import FlutterMacOS
import UserNotifications
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
// https://github.com/leanflutter/window_manager/issues/214
return false
}
override func applicationDidFinishLaunching(_ aNotification: Notification) {
// Request notification authorization
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge]) { granted, error in
if let error = error {
print("Error requesting notification authorization: \(error)")
}
}
}
// // window manager restore from dock: https://leanflutter.dev/blog/click-dock-icon-to-restore-after-closing-the-window
// override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
// if !flag {
// for window in NSApp.windows {
// if !window.isVisible {
// window.setIsVisible(true)
// }
// window.makeKeyAndOrderFront(self)
// NSApp.activate(ignoringOtherApps: true)
// }
// }
// return true
// }
}