Browse Source

listener()

works_for_me
Volker Birk 2 years ago
parent
commit
8e016c0c22
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      pEpNotifications/pEpNotifications/AppDelegate.swift

+ 6
- 3
pEpNotifications/pEpNotifications/AppDelegate.swift View File

@ -26,6 +26,7 @@ enum DNType : Int { case ready = 0, downloading, downloadArrived, noDownloadAvai
var delegate: pEpNotificationProtocol!
func notifyDownload(_ type: Int, withName: NSString, withFilename: NSString) {
NSLog("notifyDownload");
delegate?.notifyDownload(type, withName: withName, withFilename: withFilename)
}
}
@ -41,6 +42,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
var nc = NSUserNotificationCenter.default
var clientListener: NSXPCListener!
var receiver: pEpNotification!
var obj: pEpNotification!
func notifyDownload(_ type: Int, withName: NSString, withFilename: NSString)
{
@ -93,12 +95,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
statusText.title = NSLocalizedString("Connection failed", comment: "")
}
@objc func shouldAcceptNewConnection(newConnection: NSXPCConnection) {
@objc func listener(_ listener: NSXPCListener, shouldAcceptNewConnection newConnection: NSXPCConnection) -> Bool {
newConnection.exportedInterface = NSXPCInterface.init(with: pEpNotificationProtocol.self)
let obj = pEpNotification()
obj = pEpNotification()
obj.delegate = self
newConnection.exportedObject = obj;
newConnection.resume()
return true
}
func applicationDidFinishLaunching(_ aNotification: Notification) {
@ -124,7 +127,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// init client callback service
clientListener = NSXPCListener.init(machServiceName: "foundation.pEp.updates")
clientListener = NSXPCListener.anonymous()
clientListener.delegate = self
clientListener.resume()


Loading…
Cancel
Save