Browse Source

connect

works_for_me
Volker Birk 1 year ago
parent
commit
49a3276212
8 changed files with 132 additions and 8 deletions
  1. +2
    -1
      .gitignore
  2. +7
    -0
      pEpNotifications/pEpNotifications.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  3. +8
    -0
      pEpNotifications/pEpNotifications.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  4. +98
    -0
      pEpNotifications/pEpNotifications.xcodeproj/xcshareddata/xcschemes/p≡p updates.xcscheme
  5. +12
    -6
      pEpNotifications/pEpNotifications/AppDelegate.swift
  6. BIN
      pEpNotifications/pEpNotifications/de.lproj/Localizable.strings
  7. BIN
      pEpNotifications/pEpNotifications/en.lproj/Localizable.strings
  8. +5
    -1
      pEpNotifications/pEpNotifications/pEpNotifications.entitlements

+ 2
- 1
.gitignore View File

@ -157,6 +157,7 @@ dkms.conf
ws
*.d.*
*.d
foundation.pEp.*
foundation.pEp.adapter.macOS
.??*.swp
.DS_Store
debug.log

+ 7
- 0
pEpNotifications/pEpNotifications.xcodeproj/project.xcworkspace/contents.xcworkspacedata View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

+ 8
- 0
pEpNotifications/pEpNotifications.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

+ 98
- 0
pEpNotifications/pEpNotifications.xcodeproj/xcshareddata/xcschemes/p≡p updates.xcscheme View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3527B2AD24802F84007A6276"
BuildableName = "p&#x2261;p updates.app"
BlueprintName = "p&#x2261;p updates"
ReferencedContainer = "container:pEpNotifications.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3527B2C224802F87007A6276"
BuildableName = "pEpNotificationsTests.xctest"
BlueprintName = "pEpNotificationsTests"
ReferencedContainer = "container:pEpNotifications.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3527B2CD24802F87007A6276"
BuildableName = "pEpNotificationsUITests.xctest"
BlueprintName = "pEpNotificationsUITests"
ReferencedContainer = "container:pEpNotifications.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3527B2AD24802F84007A6276"
BuildableName = "p&#x2261;p updates.app"
BlueprintName = "p&#x2261;p updates"
ReferencedContainer = "container:pEpNotifications.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3527B2AD24802F84007A6276"
BuildableName = "p&#x2261;p updates.app"
BlueprintName = "p&#x2261;p updates"
ReferencedContainer = "container:pEpNotifications.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

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

@ -61,7 +61,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
@objc func updateNow() {
proxy?.updateNow()
NSLog("pEpNotifications: %@", "update fired")
notifyDownload(notification: DNType.downloadArrived, name: "p≡p for Thunderbird", download: "/bla")
// notifyDownload(notification: DNType.downloadArrived, name: "pp for Thunderbird", download: "/bla")
}
@objc func userNotificationCenter(_ : NSUserNotificationCenter, didActivate: NSUserNotification) {
@ -70,9 +70,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
}
}
func proxyErrorHandler(err: Error) -> Void {
NSLog("%@", err.localizedDescription)
statusText.title = NSLocalizedString("Connection failed", comment: "")
}
internal func applicationDidFinishLaunching(_ aNotification: Notification) {
let statusBar = NSStatusBar.system
// configure Menu Item Extra
statusBarItem = statusBar.statusItem(withLength: NSStatusItem.squareLength)
@ -83,18 +88,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// connect to XPC service
connection = NSXPCConnection.init(serviceName: "pEp.foundation.pEpMacOSAdapter")
connection = NSXPCConnection.init(machServiceName: "foundation.pEp.adapter.macOS")
if connection != nil {
connection.remoteObjectInterface = NSXPCInterface.init(with: pEpMacOSAdapterProtocol.self)
connection.resume()
statusText.title = NSLocalizedString("Connected.", comment: "")
// subscribe
proxy = connection.remoteObjectProxy as? pEpMacOSAdapterProtocol
statusText.title = NSLocalizedString("Connecting…", comment: "")
proxy = connection.remoteObjectProxyWithErrorHandler(proxyErrorHandler) as? pEpMacOSAdapterProtocol
proxy?.subscribeForUpdate(downloadNotification: notifyDownload)
}
else {
NSLog("pEpNotifications: %@", "cannot connect to pEp.foundation.pEpMacOSAdapter")
NSLog("pEpNotifications: %@", "cannot connect to pEp.foundation.adapter.macOS")
}
nc.removeAllDeliveredNotifications()


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


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


+ 5
- 1
pEpNotifications/pEpNotifications/pEpNotifications.entitlements View File

@ -3,6 +3,10 @@
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<false/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<array>
<string>foundation.pEp.adapter.macOS</string>
</array>
</dict>
</plist>

Loading…
Cancel
Save