@@ -10,6 +10,7 @@ import UpdateChecker
1010import UserDefaultsObserver
1111import UserNotifications
1212import XcodeInspector
13+ import XPCShared
1314
1415let bundleIdentifierBase = Bundle . main
1516 . object ( forInfoDictionaryKey: " BUNDLE_IDENTIFIER_BASE " ) as! String
@@ -19,7 +20,7 @@ let serviceIdentifier = bundleIdentifierBase + ".ExtensionService"
1920class AppDelegate : NSObject , NSApplicationDelegate , NSWindowDelegate {
2021 let service = Service . shared
2122 var statusBarItem : NSStatusItem !
22- var xpcListener : ( NSXPCListener , ServiceDelegate ) ?
23+ var xpcController : XPCController ?
2324 let updateChecker =
2425 UpdateChecker (
2526 hostBundle: locateHostBundleURL ( url: Bundle . main. bundleURL)
@@ -35,7 +36,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
3536 ] as CFDictionary )
3637 setupQuitOnUpdate ( )
3738 setupQuitOnUserTerminated ( )
38- xpcListener = setupXPCListener ( )
39+ xpcController = . init ( )
3940 Logger . service. info ( " XPC Service started. " )
4041 NSApp . setActivationPolicy ( . accessory)
4142 buildStatusBarMenu ( )
@@ -48,7 +49,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
4849 }
4950 }
5051 }
51-
52+
5253 @objc func quit( ) {
5354 Task { @MainActor in
5455 await service. prepareForExit ( )
@@ -125,14 +126,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
125126 }
126127 }
127128
128- func setupXPCListener( ) -> ( NSXPCListener , ServiceDelegate ) {
129- let listener = NSXPCListener ( machServiceName: serviceIdentifier)
130- let delegate = ServiceDelegate ( )
131- listener. delegate = delegate
132- listener. resume ( )
133- return ( listener, delegate)
134- }
135-
136129 func requestAccessoryAPIPermission( ) {
137130 AXIsProcessTrustedWithOptions ( [
138131 kAXTrustedCheckOptionPrompt. takeRetainedValue ( ) as NSString : true ,
0 commit comments