Skip to content

An open-source cross-platform alternative to AirDrop

feat(macos): open the main window when the app is reopened (#1797)

Shlomo48c90d314100
diff --git a/app/macos/Runner/AppDelegate.swift b/app/macos/Runner/AppDelegate.swift
index c809ba37..1b6ee0cb 100644
--- a/app/macos/Runner/AppDelegate.swift
+++ b/app/macos/Runner/AppDelegate.swift
@@ -32,6 +32,11 @@ class AppDelegate: FlutterAppDelegate {
DockProgress.style = .squircle(color: localsendBrandColor)
}
+ override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
+ showLocalSendFromMenuBar()
+ return false
+ }
+
private func setupPendingItemsObservation() {
self.pendingFilesObservation = Defaults.observe(.pendingFiles) { change in
guard !Defaults[.pendingFiles].isEmpty else { return }
@@ -49,9 +54,9 @@ class AppDelegate: FlutterAppDelegate {
case .regular:
NSApplication.shared.applicationIconImage = NSImage(named: NSImage.applicationIconName)
case .error:
- NSApplication.shared.applicationIconImage = NSImage(named: "AppIconWithErrorMark")!
+ NSApplication.shared.applicationIconImage = NSImage(named: "AppIconWithErrorMark")!
case .success:
- NSApplication.shared.applicationIconImage = NSImage(named: "AppIconWithSuccessMark")!
+ NSApplication.shared.applicationIconImage = NSImage(named: "AppIconWithSuccessMark")!
}
}