mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
* feat: macOS menubar * feat: Dynamic NavigateMenuItems * fix: simplify shortcut config * fix: Simplify the code * fix: More suitable tab name
29 lines
952 B
Swift
29 lines
952 B
Swift
import Cocoa
|
|
import FlutterMacOS
|
|
|
|
@main
|
|
class AppDelegate: FlutterAppDelegate {
|
|
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
|
return true
|
|
}
|
|
|
|
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
|
|
return true
|
|
}
|
|
|
|
override func applicationDidFinishLaunching(_ notification: Notification) {
|
|
if let controller = mainFlutterWindow?.contentViewController as? FlutterViewController {
|
|
let channel = FlutterMethodChannel(name: "about", binaryMessenger: controller.engine.binaryMessenger)
|
|
channel.setMethodCallHandler { (call: FlutterMethodCall, result: @escaping FlutterResult) in
|
|
if call.method == "showAboutPanel" {
|
|
NSApp.orderFrontStandardAboutPanel(nil)
|
|
result(nil)
|
|
} else {
|
|
result(FlutterMethodNotImplemented)
|
|
}
|
|
}
|
|
}
|
|
super.applicationDidFinishLaunching(notification)
|
|
}
|
|
}
|