From 885cd752edbf59eeb682afa035edf3bb698dc672 Mon Sep 17 00:00:00 2001 From: Rust Date: Fri, 17 Oct 2025 21:44:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E8=AD=A6?= =?UTF-8?q?=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- macos/Runner/AppDelegate.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift index 7676297..beaf03e 100755 --- a/macos/Runner/AppDelegate.swift +++ b/macos/Runner/AppDelegate.swift @@ -34,7 +34,7 @@ class AppDelegate: FlutterAppDelegate { // 在这里可以执行清理操作 // 例如:保存状态、关闭连接等 print("应用程序即将终止") - + // 通知 Flutter 端应用即将终止 if let controller = NSApp.windows.first?.contentViewController as? FlutterViewController { let channel = FlutterMethodChannel(name: "kaer_vpn/terminate", binaryMessenger: controller.engine.binaryMessenger) @@ -42,6 +42,11 @@ class AppDelegate: FlutterAppDelegate { } } + // 支持安全的状态恢复 + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } + // // 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 {