fix: --connect command on macOS & window closing issues

This commit is contained in:
Kingtous
2023-02-03 17:08:40 +08:00
parent 1ad55d9914
commit 66851efaa3
9 changed files with 68 additions and 28 deletions

View File

@@ -3,21 +3,22 @@ import FlutterMacOS
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
var lauched = false;
var launched = false;
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
dummy_method_to_enforce_bundling()
return true
// https://github.com/leanflutter/window_manager/issues/214
return false
}
override func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
if (lauched) {
if (launched) {
handle_applicationShouldOpenUntitledFile();
}
return true
}
override func applicationDidFinishLaunching(_ aNotification: Notification) {
lauched = true;
launched = true;
NSApplication.shared.activate(ignoringOtherApps: true);
}
}

View File

@@ -23,8 +23,10 @@
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<key>CFBundleURLIconFile</key>
<string></string>
<key>CFBundleURLName</key>
<string>com.carriez.rustdesk</string>
<key>CFBundleURLSchemes</key>
<array>
<string>rustdesk</string>
@@ -35,13 +37,13 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>$(PRODUCT_COPYRIGHT)</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<string>1</string>
<string>NSApplication</string>
</dict>
</plist>

View File

@@ -78,6 +78,9 @@ class MainFlutterWindow: NSWindow {
self.setWindowInterfaceMode(window: window,themeName: themeName ?? "light")
result(nil)
break;
case "terminate":
NSApplication.shared.terminate(self)
result(nil)
default:
result(FlutterMethodNotImplemented)
}