AppDelegate.swift 722 B

12345678910111213141516171819202122232425
  1. import Cocoa
  2. import FlutterMacOS
  3. @main
  4. class AppDelegate: FlutterAppDelegate {
  5. var launched = false;
  6. override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
  7. dummy_method_to_enforce_bundling()
  8. // https://github.com/leanflutter/window_manager/issues/214
  9. return false
  10. }
  11. override func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
  12. if (launched) {
  13. handle_applicationShouldOpenUntitledFile();
  14. }
  15. return true
  16. }
  17. override func applicationDidFinishLaunching(_ aNotification: Notification) {
  18. launched = true;
  19. NSApplication.shared.activate(ignoringOtherApps: true);
  20. }
  21. }