From 45c0e10102925c16cc6882b6c9542a396d50bf73 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 20 Jan 2023 10:26:27 +0800 Subject: [PATCH] applicationDidFinishLaunching --- flutter/macos/Runner/AppDelegate.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flutter/macos/Runner/AppDelegate.swift b/flutter/macos/Runner/AppDelegate.swift index 46622746d..5708e35cb 100644 --- a/flutter/macos/Runner/AppDelegate.swift +++ b/flutter/macos/Runner/AppDelegate.swift @@ -3,13 +3,21 @@ import FlutterMacOS @NSApplicationMain class AppDelegate: FlutterAppDelegate { + var lauched = false; override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { dummy_method_to_enforce_bundling() return true } override func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool { - handle_applicationShouldOpenUntitledFile(); + if (lauched) { + handle_applicationShouldOpenUntitledFile(); + } return true } + + override func applicationDidFinishLaunching(_ aNotification: Notification) { + lauched = true; + NSApplication.shared.activate(ignoringOtherApps: true); + } }