diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index 9190c69..b327fef 100644 --- a/NearDrop/AppDelegate.swift +++ b/NearDrop/AppDelegate.swift @@ -23,6 +23,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele statusItem=NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) statusItem?.button?.image=NSImage(named: "MenuBarIcon") statusItem?.menu=menu + statusItem?.behavior = .removalAllowed let nc=UNUserNotificationCenter.current() nc.requestAuthorization(options: [.alert, .sound]) { granted, err in @@ -39,6 +40,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele NearbyConnectionManager.shared.mainAppDelegate=self NearbyConnectionManager.shared.becomeVisible() } + + func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { + statusItem?.isVisible=true + return true + } func applicationWillTerminate(_ aNotification: Notification) { UNUserNotificationCenter.current().removeAllDeliveredNotifications() diff --git a/NearbyShare/InboundNearbyConnection.swift b/NearbyShare/InboundNearbyConnection.swift index 5f0eba8..9fc317b 100644 --- a/NearbyShare/InboundNearbyConnection.swift +++ b/NearbyShare/InboundNearbyConnection.swift @@ -349,7 +349,7 @@ class InboundNearbyConnection: NearbyConnection{ currentState = .receivingFiles try sendTransferSetupFrame(frame) }catch{ - print("Error \(error)") + lastError=error protocolError() } }