mirror of
https://github.com/grishka/NearDrop.git
synced 2026-04-03 09:46:19 +02:00
@@ -23,6 +23,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
statusItem=NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
statusItem=NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||||
statusItem?.button?.image=NSImage(named: "MenuBarIcon")
|
statusItem?.button?.image=NSImage(named: "MenuBarIcon")
|
||||||
statusItem?.menu=menu
|
statusItem?.menu=menu
|
||||||
|
statusItem?.behavior = .removalAllowed
|
||||||
|
|
||||||
let nc=UNUserNotificationCenter.current()
|
let nc=UNUserNotificationCenter.current()
|
||||||
nc.requestAuthorization(options: [.alert, .sound]) { granted, err in
|
nc.requestAuthorization(options: [.alert, .sound]) { granted, err in
|
||||||
@@ -40,6 +41,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
NearbyConnectionManager.shared.becomeVisible()
|
NearbyConnectionManager.shared.becomeVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
|
||||||
|
statusItem?.isVisible=true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
|
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ class InboundNearbyConnection: NearbyConnection{
|
|||||||
currentState = .receivingFiles
|
currentState = .receivingFiles
|
||||||
try sendTransferSetupFrame(frame)
|
try sendTransferSetupFrame(frame)
|
||||||
}catch{
|
}catch{
|
||||||
print("Error \(error)")
|
lastError=error
|
||||||
protocolError()
|
protocolError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user