Browse Source

connect

works_for_me
Volker Birk 2 years ago
parent
commit
a7f0605696
2 changed files with 7 additions and 6 deletions
  1. +7
    -6
      pEpNotifications/pEpNotifications/AppDelegate.swift
  2. BIN
      pEpNotifications/pEpNotifications/de.lproj/Localizable.strings

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

@ -26,7 +26,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
var statusBarItem: NSStatusItem!
var statusText: NSMenuItem!
var connection: NSXPCConnection!
var proxy: pEpMacOSAdapterProtocol!
var service: pEpMacOSAdapterProtocol!
var nc = NSUserNotificationCenter.default
func notifyDownload(notification: DNType, name: NSString, download: NSString)
@ -59,9 +59,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
}
@objc func updateNow() {
proxy?.updateNow()
service.updateNow()
NSLog("pEpNotifications: %@", "update fired")
// notifyDownload(notification: DNType.downloadArrived, name: "pp for Thunderbird", download: "/bla")
}
@objc func userNotificationCenter(_ : NSUserNotificationCenter, didActivate: NSUserNotification) {
@ -96,8 +95,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// subscribe
statusText.title = NSLocalizedString("Connecting…", comment: "")
proxy = connection.remoteObjectProxyWithErrorHandler(proxyErrorHandler) as? pEpMacOSAdapterProtocol
proxy?.subscribeForUpdate(downloadNotification: notifyDownload)
service = connection.remoteObjectProxyWithErrorHandler(proxyErrorHandler) as? pEpMacOSAdapterProtocol
service.subscribeForUpdate(downloadNotification: notifyDownload)
statusText.title = NSLocalizedString("Connected.", comment: "")
}
else {
NSLog("pEpNotifications: %@", "cannot connect to pEp.foundation.adapter.macOS")
@ -108,7 +109,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
}
internal func applicationWillTerminate(_ aNotification: Notification) {
proxy?.unsubscribeForUpdate()
service.unsubscribeForUpdate()
connection?.invalidate()
}
}

BIN
pEpNotifications/pEpNotifications/de.lproj/Localizable.strings View File


Loading…
Cancel
Save