@ -0,0 +1,12 @@ | |||
// | |||
// PEPMacOSAdapterXPCService.h | |||
// PEPMacOSAdapterXPCService | |||
// | |||
// Created by David Alarcon on 10/2/21. | |||
// | |||
#import <Foundation/Foundation.h> | |||
@interface PEPMacOSAdapterXPCService : NSObject | |||
@end |
@ -0,0 +1,12 @@ | |||
// | |||
// PEPMacOSAdapterXPCService.m | |||
// PEPMacOSAdapterXPCService | |||
// | |||
// Created by David Alarcon on 10/2/21. | |||
// | |||
#import "PEPMacOSAdapterXPCService.h" | |||
@implementation PEPMacOSAdapterXPCService | |||
@end |
@ -0,0 +1,30 @@ | |||
// | |||
// PEPNotificationXPCApiProtocol.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
/// Notification types | |||
// TODO: Maybe does not belong to this protocol | |||
typedef enum { ready = 0, downloading, downloadArrived, noDownloadAvailable } DNType; | |||
/// Callback protocol to notify about download events | |||
@protocol PEPNotificationXPCApiProtocol <NSObject> | |||
/// notification about download events | |||
- (void)notifyDownload:(int)type withName:(NSString*)name withFilename:(NSString*)filename; | |||
@end | |||
/// This is the object from the client where we deliver notifications to | |||
@interface PEPNotification : NSObject <PEPNotificationXPCApiProtocol> | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,20 @@ | |||
// | |||
// PEPNotificationXPCService.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPNotificationXPCService : NSObject | |||
/// Begin listening for incoming XPC connections | |||
- (void)start; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,13 @@ | |||
// | |||
// PEPNotificationXPCService.m | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import "PEPNotificationXPCService.h" | |||
@implementation PEPNotificationXPCService | |||
@end |
@ -0,0 +1,35 @@ | |||
// | |||
// PEPMacOSAdapterProtocol.h | |||
// pEpMacOSAdapter | |||
// | |||
// Created by Volker Birk on 20.04.20. | |||
// Copyleft © 2020 p≡p foundation. | |||
// This file is under GNU General Public License 3.0 | |||
// | |||
#import <Foundation/Foundation.h> | |||
/// This protocol is providing the XPC interface to the User Interface program pEpNotifications | |||
@protocol PEPUpdateDownloadXPCApiProtocol | |||
/** | |||
subscribe to the published notifications about downloads arriving | |||
- Parameter downloading: block to call back when a download is going to happen | |||
- Parameter downloadArrived: block to call back when a download arrived | |||
*/ | |||
- (void)subscribeForUpdate:(NSXPCListenerEndpoint*)endpoint; | |||
/// unsubscribe from receiving notifications about downloads arriving | |||
- (void)unsubscribeForUpdate; | |||
/// search for immediate updates | |||
- (void)updateNow; | |||
/// schedules updates each 2 hours | |||
- (void)scheduleUpdates; | |||
/// stop auto updates | |||
- (void)stopUpdates; | |||
@end |
@ -0,0 +1,147 @@ | |||
// | |||
// PEPUpdateDownloader.mm | |||
// pEpMacOSAdapter | |||
// | |||
// Created by Volker Birk on 26.05.20. | |||
// Copyright © 2020 p≡p foundation. All rights reserved. | |||
// This file is under GNU General Public License 3.0 | |||
// | |||
#import "PEPUpdateDownloader.h" | |||
#include "downloadclient.hh" | |||
const double CYCLE = 7200.0; // 7200 seconds = 2 hours | |||
NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater"; | |||
@implementation PEPUpdateDownloader | |||
- (id)init | |||
{ | |||
self = [super init]; | |||
if (self) { | |||
self.configPath = CONFIG_PATH; | |||
} | |||
return self; | |||
} | |||
- (void)scheduleUpdates | |||
{ | |||
if (!self.timer) { | |||
NSLog(@"schedule updates"); | |||
dispatch_async(dispatch_get_main_queue(), ^{ | |||
self.timer = [NSTimer scheduledTimerWithTimeInterval:CYCLE | |||
target:self | |||
selector:@selector(updateAll) | |||
userInfo:nil | |||
repeats:YES]; | |||
}); | |||
} | |||
else { | |||
NSLog(@"timer already there"); | |||
} | |||
} | |||
- (void)stopUpdates | |||
{ | |||
if (self.timer) { | |||
NSLog(@"stop auto updates"); | |||
[self.timer invalidate]; | |||
self.timer = nil; | |||
} | |||
} | |||
- (void)updateAll | |||
{ | |||
NSLog(@"update all registered products"); | |||
NSFileManager *localFileManager=[NSFileManager new]; | |||
NSDirectoryEnumerator *dirEnum = [localFileManager enumeratorAtPath:_configPath]; | |||
NSString *configFile; | |||
while (dirEnum && (configFile = [dirEnum nextObject])) { | |||
if ([[configFile pathExtension] isEqualToString: @"plist"]) { | |||
NSError *err = nil; | |||
[self updateWithFile:[NSString stringWithFormat:@"%@/%@", _configPath, configFile] error:&err]; | |||
} | |||
} | |||
} | |||
- (void)updateWithFile:(NSString*)configFile error:(NSError **)err | |||
{ | |||
NSLog(@"update product with config file %@", configFile); | |||
NSInputStream *is = [NSInputStream inputStreamWithFileAtPath:configFile]; | |||
[is open]; | |||
NSDictionary* plist = [NSPropertyListSerialization | |||
propertyListWithStream:is options:NSPropertyListMutableContainers | |||
format:nil error:err]; | |||
[is close]; | |||
if (plist) { | |||
NSString* name = [plist objectForKey:@"name"]; | |||
NSString* url = [plist objectForKey:@"url"]; | |||
if (name && url) { | |||
[self update:name usingUrl:url]; | |||
} | |||
} | |||
else if (err) { | |||
NSLog(@"%@ %@ %@ %@", (*err).localizedDescription, | |||
(*err).localizedFailureReason, (*err).localizedRecoveryOptions, | |||
(*err).localizedRecoverySuggestion); | |||
} | |||
} | |||
- (void)update:(NSString*)name usingUrl:(NSString*)url | |||
{ | |||
NSLog(@"update %@ using %@", name, url); | |||
pEp::UpdateClient::product p = { name.UTF8String, url.UTF8String }; | |||
std::string keyfile = _configPath.UTF8String; | |||
keyfile += std::string("/"); | |||
keyfile += p.name; | |||
keyfile += std::string(".der"); | |||
NSLog(@"using key from %s", keyfile.c_str()); | |||
NSString* cwd = [NSFileManager defaultManager].currentDirectoryPath; | |||
NSString* dir = @"/tmp"; | |||
[[NSFileManager defaultManager] changeCurrentDirectoryPath:dir]; | |||
std::string _filename; | |||
pEp::notifyRead_t notifyRead = [=]()->void{ | |||
NSLog(@"downloading: %@", name); | |||
if (_subscriber) { | |||
[_subscriber notifyDownload:(int)downloading withName:name withFilename:@""]; | |||
} | |||
}; | |||
try { | |||
_filename = pEp::UpdateClient::update(p, keyfile, notifyRead); | |||
if (_filename.length()) { | |||
NSString* filename = [NSString stringWithUTF8String:_filename.c_str()]; | |||
NSString* download = [NSString stringWithFormat:@"%@/%@", dir, filename]; | |||
[[NSFileManager defaultManager] changeCurrentDirectoryPath:cwd]; | |||
NSLog(@"download arrived %@", download); | |||
if (_subscriber) { | |||
[_subscriber notifyDownload:(int)downloadArrived withName:name withFilename:download]; | |||
} | |||
} | |||
else { | |||
NSLog(@"no download available for %@", name); | |||
if (_subscriber) { | |||
[_subscriber notifyDownload:(int)noDownloadAvailable withName:name withFilename:@""]; | |||
} | |||
} | |||
} | |||
catch (std::exception& e) { | |||
NSLog(@"pEp::UpdateClient::update({\"%s\", \"%s\"}, \"%s\"): %s", | |||
p.name.c_str(), p.url.c_str(), keyfile.c_str(), e.what()); | |||
} | |||
} | |||
@end |
@ -0,0 +1,19 @@ | |||
// | |||
// PEPUpdateDownloadXPCApi.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import "PEPUpdateDownloadXPCApiProtocol.h" | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPUpdateDownloadXPCApi : NSObject <PEPUpdateDownloadXPCApiProtocol> | |||
@property (retain) NSXPCConnection* clientConnection; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,67 @@ | |||
// | |||
// PEPUpdateDownloadXPCApi.m | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import "PEPUpdateDownloadXPCApi.h" | |||
#import "PEPNotificationXPCApiProtocol.h" | |||
#import "PEPUpdateDownloader.h" | |||
extern PEPUpdateDownloader* updater; | |||
@implementation PEPUpdateDownloadXPCApi | |||
- (void)subscribeForUpdate:(NSXPCListenerEndpoint*)endpoint { | |||
NSLog(@"subscribeForUpdate called"); | |||
if (!updater) { | |||
updater = [PEPUpdateDownloader new]; | |||
} | |||
///NotificationXPCService *service = .... | |||
///[service start]; | |||
if (updater) { | |||
_clientConnection = [[NSXPCConnection alloc] initWithListenerEndpoint:endpoint]; | |||
_clientConnection.remoteObjectInterface = [NSXPCInterface | |||
interfaceWithProtocol:@protocol(PEPNotificationXPCApiProtocol)]; | |||
_clientConnection.interruptionHandler = ^(){NSLog(@"interruption"); updater.subscriber=nil;}; | |||
_clientConnection.invalidationHandler = ^(){NSLog(@"invalidation"); updater.subscriber=nil;}; | |||
[_clientConnection resume]; | |||
PEPNotification* downloadNotification = [_clientConnection remoteObjectProxyWithErrorHandler:^(NSError*err) { | |||
NSLog(@"%@", err); | |||
}]; | |||
updater.subscriber = downloadNotification; | |||
if (downloadNotification) { | |||
[downloadNotification notifyDownload:ready withName:@"" withFilename:@""]; | |||
} | |||
} | |||
} | |||
- (void)unsubscribeForUpdate { | |||
NSLog(@"unsubscribeForUpdate called"); | |||
if (updater) updater.subscriber = nil; | |||
} | |||
- (void)updateNow { | |||
NSLog(@"updateNow called"); | |||
if (updater) [updater updateAll]; | |||
} | |||
- (void)scheduleUpdates { | |||
NSLog(@"scheduleUpdates called"); | |||
if (updater) [updater scheduleUpdates]; | |||
} | |||
- (void)stopUpdates { | |||
NSLog(@"stopUpdates called"); | |||
if (updater) [updater stopUpdates]; | |||
} | |||
@end |
@ -0,0 +1,20 @@ | |||
// | |||
// PEPUpdateDownloadXPCService.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPUpdateDownloadXPCService : NSObject <NSXPCListenerDelegate> | |||
/// Begin listening for incoming XPC connections | |||
- (void)start; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,78 @@ | |||
// | |||
// PEPUpdateDownloadXPCService.m | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import "PEPUpdateDownloadXPCService.h" | |||
@import AppKit; | |||
#import "PEPUpdateDownloadXPCApiProtocol.h" | |||
#import "PEPUpdateDownloadXPCApi.h" | |||
@interface PEPUpdateDownloadXPCService () | |||
@property (nonatomic, strong, readwrite) NSXPCListener *listener; | |||
@end | |||
@implementation PEPUpdateDownloadXPCService | |||
- (instancetype)init { | |||
if (self = [super init]) { | |||
_listener = [[NSXPCListener alloc] initWithMachServiceName:@"foundation.pEp.adapter.macOS_OpenStep"]; | |||
NSLog(@"starting agent"); | |||
_listener.delegate = self; | |||
} | |||
return self; | |||
} | |||
- (void)start { | |||
[self.listener resume]; | |||
BOOL opened = [self startPEPUpdatesApp]; | |||
assert(opened); | |||
} | |||
// MARK: - Private | |||
- (BOOL)startPEPUpdatesApp { | |||
NSURL *url = [NSURL | |||
fileURLWithPath:@"/Library/Application Support/pEp/pEp.app/Contents/Library/LoginItems/p≡p updates.app"]; | |||
return [[NSWorkspace sharedWorkspace] openURL:url]; | |||
} | |||
// MARK: - NSXPCListenerDelegate | |||
- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { | |||
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. | |||
NSLog(@"incoming connection"); | |||
// Configure the connection. | |||
// First, set the interface that the exported object implements. | |||
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(PEPUpdateDownloadXPCApiProtocol)]; | |||
// Next, set the object that the connection exports. All messages sent on | |||
// the connection to this service will be sent to the exported object to | |||
// handle. The connection retains the exported object. | |||
PEPUpdateDownloadXPCApi *exportedObject = [PEPUpdateDownloadXPCApi new]; | |||
newConnection.exportedObject = exportedObject; | |||
if (!newConnection.exportedInterface || !newConnection.exportedObject) { | |||
NSLog(@"failed to allocate object and interface"); | |||
return NO; | |||
} | |||
// Resuming the connection allows the system to deliver more incoming messages. | |||
[newConnection resume]; | |||
// Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. | |||
NSLog(@"connection accepted"); | |||
return YES; | |||
} | |||
@end |
@ -0,0 +1,467 @@ | |||
// !$*UTF8*$! | |||
{ | |||
archiveVersion = 1; | |||
classes = { | |||
}; | |||
objectVersion = 50; | |||
objects = { | |||
/* Begin PBXBuildFile section */ | |||
4E61821525D58162007E040F /* PEPUpdateDownloadApiClientService.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E61821325D58162007E040F /* PEPUpdateDownloadApiClientService.h */; settings = {ATTRIBUTES = (Public, ); }; }; | |||
4E61821625D58162007E040F /* PEPUpdateDownloadApiClientService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E61821425D58162007E040F /* PEPUpdateDownloadApiClientService.m */; }; | |||
4E797B9725D523FD0090F900 /* PEPUpdatesXPCService.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797B9625D523FD0090F900 /* PEPUpdatesXPCService.h */; }; | |||
4E797B9925D523FD0090F900 /* PEPUpdatesXPCService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E797B9825D523FD0090F900 /* PEPUpdatesXPCService.m */; }; | |||
4E797BB825D5255F0090F900 /* PEPNotificationXPCApiProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797BAA25D5255F0090F900 /* PEPNotificationXPCApiProtocol.h */; }; | |||
4E797BB925D5255F0090F900 /* PEPNotificationXPCService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E797BAC25D5255F0090F900 /* PEPNotificationXPCService.m */; }; | |||
4E797BBA25D5255F0090F900 /* PEPNotificationXPCService.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797BAD25D5255F0090F900 /* PEPNotificationXPCService.h */; }; | |||
4E797BBB25D5255F0090F900 /* PEPUpdateDownloadXPCApiProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797BB025D5255F0090F900 /* PEPUpdateDownloadXPCApiProtocol.h */; }; | |||
4E797BBC25D5255F0090F900 /* PEPUpdateDownloader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4E797BB125D5255F0090F900 /* PEPUpdateDownloader.mm */; }; | |||
4E797BBD25D5255F0090F900 /* PEPUpdateDownloadXPCApi.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797BB325D5255F0090F900 /* PEPUpdateDownloadXPCApi.h */; }; | |||
4E797BBE25D5255F0090F900 /* PEPUpdateDownloadXPCService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E797BB425D5255F0090F900 /* PEPUpdateDownloadXPCService.m */; }; | |||
4E797BBF25D5255F0090F900 /* PEPUpdateDownloadXPCApi.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E797BB525D5255F0090F900 /* PEPUpdateDownloadXPCApi.m */; }; | |||
4E797BC025D5255F0090F900 /* PEPUpdateDownloadXPCService.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797BB625D5255F0090F900 /* PEPUpdateDownloadXPCService.h */; settings = {ATTRIBUTES = (Public, ); }; }; | |||
4E797BC125D5255F0090F900 /* PEPUpdateDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E797BB725D5255F0090F900 /* PEPUpdateDownloader.h */; }; | |||
4E797D8C25D543520090F900 /* libdownloadclient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E797D2225D53CCC0090F900 /* libdownloadclient.a */; }; | |||
/* End PBXBuildFile section */ | |||
/* Begin PBXFileReference section */ | |||
4E61821325D58162007E040F /* PEPUpdateDownloadApiClientService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPUpdateDownloadApiClientService.h; sourceTree = "<group>"; }; | |||
4E61821425D58162007E040F /* PEPUpdateDownloadApiClientService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPUpdateDownloadApiClientService.m; sourceTree = "<group>"; }; | |||
4E797B9325D523FD0090F900 /* libPEPUpdatesXPCService.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPEPUpdatesXPCService.a; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4E797B9625D523FD0090F900 /* PEPUpdatesXPCService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPUpdatesXPCService.h; sourceTree = "<group>"; }; | |||
4E797B9825D523FD0090F900 /* PEPUpdatesXPCService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPUpdatesXPCService.m; sourceTree = "<group>"; }; | |||
4E797BAA25D5255F0090F900 /* PEPNotificationXPCApiProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPNotificationXPCApiProtocol.h; sourceTree = "<group>"; }; | |||
4E797BAC25D5255F0090F900 /* PEPNotificationXPCService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPNotificationXPCService.m; sourceTree = "<group>"; }; | |||
4E797BAD25D5255F0090F900 /* PEPNotificationXPCService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPNotificationXPCService.h; sourceTree = "<group>"; }; | |||
4E797BB025D5255F0090F900 /* PEPUpdateDownloadXPCApiProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPUpdateDownloadXPCApiProtocol.h; sourceTree = "<group>"; }; | |||
4E797BB125D5255F0090F900 /* PEPUpdateDownloader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PEPUpdateDownloader.mm; sourceTree = "<group>"; }; | |||
4E797BB325D5255F0090F900 /* PEPUpdateDownloadXPCApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPUpdateDownloadXPCApi.h; sourceTree = "<group>"; }; | |||
4E797BB425D5255F0090F900 /* PEPUpdateDownloadXPCService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPUpdateDownloadXPCService.m; sourceTree = "<group>"; }; | |||
4E797BB525D5255F0090F900 /* PEPUpdateDownloadXPCApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPUpdateDownloadXPCApi.m; sourceTree = "<group>"; }; | |||
4E797BB625D5255F0090F900 /* PEPUpdateDownloadXPCService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPUpdateDownloadXPCService.h; sourceTree = "<group>"; }; | |||
4E797BB725D5255F0090F900 /* PEPUpdateDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPUpdateDownloader.h; sourceTree = "<group>"; }; | |||
4E797BC625D526640090F900 /* libdownloadclient.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libdownloadclient.a; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4E797D2225D53CCC0090F900 /* libdownloadclient.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libdownloadclient.a; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
/* End PBXFileReference section */ | |||
/* Begin PBXFrameworksBuildPhase section */ | |||
4E797B9125D523FD0090F900 /* Frameworks */ = { | |||
isa = PBXFrameworksBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
4E797D8C25D543520090F900 /* libdownloadclient.a in Frameworks */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXFrameworksBuildPhase section */ | |||
/* Begin PBXGroup section */ | |||
4E61820925D57E19007E040F /* PEPUpdateDownloadXPCApiClient */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BAF25D5255F0090F900 /* Interface */, | |||
4E797BB225D5255F0090F900 /* XPCService */, | |||
); | |||
path = PEPUpdateDownloadXPCApiClient; | |||
sourceTree = "<group>"; | |||
}; | |||
4E61820A25D57EBE007E040F /* PEPUpdateDownloadXPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E61820B25D57EEC007E040F /* Interface */, | |||
4E61820C25D57EF3007E040F /* XPCService */, | |||
4E61823525D591A2007E040F /* UpdateDownloader */, | |||
); | |||
path = PEPUpdateDownloadXPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E61820B25D57EEC007E040F /* Interface */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BB625D5255F0090F900 /* PEPUpdateDownloadXPCService.h */, | |||
); | |||
path = Interface; | |||
sourceTree = "<group>"; | |||
}; | |||
4E61820C25D57EF3007E040F /* XPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BB425D5255F0090F900 /* PEPUpdateDownloadXPCService.m */, | |||
4E797BB325D5255F0090F900 /* PEPUpdateDownloadXPCApi.h */, | |||
4E797BB525D5255F0090F900 /* PEPUpdateDownloadXPCApi.m */, | |||
); | |||
path = XPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E61820D25D57F21007E040F /* Shared */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BB025D5255F0090F900 /* PEPUpdateDownloadXPCApiProtocol.h */, | |||
); | |||
path = Shared; | |||
sourceTree = "<group>"; | |||
}; | |||
4E61823525D591A2007E040F /* UpdateDownloader */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BB725D5255F0090F900 /* PEPUpdateDownloader.h */, | |||
4E797BB125D5255F0090F900 /* PEPUpdateDownloader.mm */, | |||
); | |||
path = UpdateDownloader; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797B8A25D523FD0090F900 = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797B9525D523FD0090F900 /* PEPUpdatesXPCService */, | |||
4E797B9425D523FD0090F900 /* Products */, | |||
4E797BC525D526640090F900 /* Frameworks */, | |||
); | |||
sourceTree = "<group>"; | |||
}; | |||
4E797B9425D523FD0090F900 /* Products */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797B9325D523FD0090F900 /* libPEPUpdatesXPCService.a */, | |||
); | |||
name = Products; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797B9525D523FD0090F900 /* PEPUpdatesXPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BAE25D5255F0090F900 /* PEPUpdateDownloadXPCService */, | |||
4E797BA825D5255F0090F900 /* PEPNotificationXPCService */, | |||
4E797B9625D523FD0090F900 /* PEPUpdatesXPCService.h */, | |||
4E797B9825D523FD0090F900 /* PEPUpdatesXPCService.m */, | |||
); | |||
path = PEPUpdatesXPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BA825D5255F0090F900 /* PEPNotificationXPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BA925D5255F0090F900 /* Interface */, | |||
4E797BAB25D5255F0090F900 /* XPCService */, | |||
); | |||
path = PEPNotificationXPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BA925D5255F0090F900 /* Interface */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BAA25D5255F0090F900 /* PEPNotificationXPCApiProtocol.h */, | |||
); | |||
path = Interface; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BAB25D5255F0090F900 /* XPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797BAC25D5255F0090F900 /* PEPNotificationXPCService.m */, | |||
4E797BAD25D5255F0090F900 /* PEPNotificationXPCService.h */, | |||
); | |||
path = XPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BAE25D5255F0090F900 /* PEPUpdateDownloadXPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E61820D25D57F21007E040F /* Shared */, | |||
4E61820925D57E19007E040F /* PEPUpdateDownloadXPCApiClient */, | |||
4E61820A25D57EBE007E040F /* PEPUpdateDownloadXPCService */, | |||
); | |||
path = PEPUpdateDownloadXPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BAF25D5255F0090F900 /* Interface */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E61821325D58162007E040F /* PEPUpdateDownloadApiClientService.h */, | |||
); | |||
path = Interface; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BB225D5255F0090F900 /* XPCService */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E61821425D58162007E040F /* PEPUpdateDownloadApiClientService.m */, | |||
); | |||
path = XPCService; | |||
sourceTree = "<group>"; | |||
}; | |||
4E797BC525D526640090F900 /* Frameworks */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4E797D2225D53CCC0090F900 /* libdownloadclient.a */, | |||
4E797BC625D526640090F900 /* libdownloadclient.a */, | |||
); | |||
name = Frameworks; | |||
sourceTree = "<group>"; | |||
}; | |||
/* End PBXGroup section */ | |||
/* Begin PBXHeadersBuildPhase section */ | |||
4E797B8F25D523FD0090F900 /* Headers */ = { | |||
isa = PBXHeadersBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
4E797BC125D5255F0090F900 /* PEPUpdateDownloader.h in Headers */, | |||
4E797BBA25D5255F0090F900 /* PEPNotificationXPCService.h in Headers */, | |||
4E797BB825D5255F0090F900 /* PEPNotificationXPCApiProtocol.h in Headers */, | |||
4E61821525D58162007E040F /* PEPUpdateDownloadApiClientService.h in Headers */, | |||
4E797BBD25D5255F0090F900 /* PEPUpdateDownloadXPCApi.h in Headers */, | |||
4E797BC025D5255F0090F900 /* PEPUpdateDownloadXPCService.h in Headers */, | |||
4E797BBB25D5255F0090F900 /* PEPUpdateDownloadXPCApiProtocol.h in Headers */, | |||
4E797B9725D523FD0090F900 /* PEPUpdatesXPCService.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXHeadersBuildPhase section */ | |||
/* Begin PBXNativeTarget section */ | |||
4E797B9225D523FD0090F900 /* PEPUpdatesXPCService */ = { | |||
isa = PBXNativeTarget; | |||
buildConfigurationList = 4E797B9C25D523FD0090F900 /* Build configuration list for PBXNativeTarget "PEPUpdatesXPCService" */; | |||
buildPhases = ( | |||
4E797B8F25D523FD0090F900 /* Headers */, | |||
4E797B9025D523FD0090F900 /* Sources */, | |||
4E797B9125D523FD0090F900 /* Frameworks */, | |||
); | |||
buildRules = ( | |||
); | |||
dependencies = ( | |||
); | |||
name = PEPUpdatesXPCService; | |||
productName = PEPUpdatesXPCService; | |||
productReference = 4E797B9325D523FD0090F900 /* libPEPUpdatesXPCService.a */; | |||
productType = "com.apple.product-type.library.static"; | |||
}; | |||
/* End PBXNativeTarget section */ | |||
/* Begin PBXProject section */ | |||
4E797B8B25D523FD0090F900 /* Project object */ = { | |||
isa = PBXProject; | |||
attributes = { | |||
LastUpgradeCheck = 1240; | |||
TargetAttributes = { | |||
4E797B9225D523FD0090F900 = { | |||
CreatedOnToolsVersion = 12.4; | |||
}; | |||
}; | |||
}; | |||
buildConfigurationList = 4E797B8E25D523FD0090F900 /* Build configuration list for PBXProject "PEPUpdatesXPCService" */; | |||
compatibilityVersion = "Xcode 9.3"; | |||
developmentRegion = en; | |||
hasScannedForEncodings = 0; | |||
knownRegions = ( | |||
en, | |||
Base, | |||
); | |||
mainGroup = 4E797B8A25D523FD0090F900; | |||
productRefGroup = 4E797B9425D523FD0090F900 /* Products */; | |||
projectDirPath = ""; | |||
projectRoot = ""; | |||
targets = ( | |||
4E797B9225D523FD0090F900 /* PEPUpdatesXPCService */, | |||
); | |||
}; | |||
/* End PBXProject section */ | |||
/* Begin PBXSourcesBuildPhase section */ | |||
4E797B9025D523FD0090F900 /* Sources */ = { | |||
isa = PBXSourcesBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
4E797BBE25D5255F0090F900 /* PEPUpdateDownloadXPCService.m in Sources */, | |||
4E797BB925D5255F0090F900 /* PEPNotificationXPCService.m in Sources */, | |||
4E61821625D58162007E040F /* PEPUpdateDownloadApiClientService.m in Sources */, | |||
4E797BBF25D5255F0090F900 /* PEPUpdateDownloadXPCApi.m in Sources */, | |||
4E797B9925D523FD0090F900 /* PEPUpdatesXPCService.m in Sources */, | |||
4E797BBC25D5255F0090F900 /* PEPUpdateDownloader.mm in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXSourcesBuildPhase section */ | |||
/* Begin XCBuildConfiguration section */ | |||
4E797B9A25D523FD0090F900 /* Debug */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ALWAYS_SEARCH_USER_PATHS = NO; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | |||
CLANG_CXX_LIBRARY = "libc++"; | |||
CLANG_ENABLE_MODULES = YES; | |||
CLANG_ENABLE_OBJC_ARC = YES; | |||
CLANG_ENABLE_OBJC_WEAK = YES; | |||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
CLANG_WARN_BOOL_CONVERSION = YES; | |||
CLANG_WARN_COMMA = YES; | |||
CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | |||
CLANG_WARN_EMPTY_BODY = YES; | |||
CLANG_WARN_ENUM_CONVERSION = YES; | |||
CLANG_WARN_INFINITE_RECURSION = YES; | |||
CLANG_WARN_INT_CONVERSION = YES; | |||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | |||
CLANG_WARN_UNREACHABLE_CODE = YES; | |||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
COPY_PHASE_STRIP = NO; | |||
DEBUG_INFORMATION_FORMAT = dwarf; | |||
ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
ENABLE_TESTABILITY = YES; | |||
GCC_C_LANGUAGE_STANDARD = gnu11; | |||
GCC_DYNAMIC_NO_PIC = NO; | |||
GCC_NO_COMMON_BLOCKS = YES; | |||
GCC_OPTIMIZATION_LEVEL = 0; | |||
GCC_PREPROCESSOR_DEFINITIONS = ( | |||
"DEBUG=1", | |||
"$(inherited)", | |||
); | |||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
GCC_WARN_UNUSED_FUNCTION = YES; | |||
GCC_WARN_UNUSED_VARIABLE = YES; | |||
HEADER_SEARCH_PATHS = ( | |||
"$(PROJECT_DIR)/../../../local/include", | |||
"$(PROJECT_DIR)/../../../downloadclient", | |||
); | |||
MACOSX_DEPLOYMENT_TARGET = 11.1; | |||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | |||
MTL_FAST_MATH = YES; | |||
ONLY_ACTIVE_ARCH = YES; | |||
OTHER_LDFLAGS = "$(OTHER_LDFLAGS)"; | |||
SDKROOT = macosx; | |||
USER_HEADER_SEARCH_PATHS = ""; | |||
}; | |||
name = Debug; | |||
}; | |||
4E797B9B25D523FD0090F900 /* Release */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ALWAYS_SEARCH_USER_PATHS = NO; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | |||
CLANG_CXX_LIBRARY = "libc++"; | |||
CLANG_ENABLE_MODULES = YES; | |||
CLANG_ENABLE_OBJC_ARC = YES; | |||
CLANG_ENABLE_OBJC_WEAK = YES; | |||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
CLANG_WARN_BOOL_CONVERSION = YES; | |||
CLANG_WARN_COMMA = YES; | |||
CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | |||
CLANG_WARN_EMPTY_BODY = YES; | |||
CLANG_WARN_ENUM_CONVERSION = YES; | |||
CLANG_WARN_INFINITE_RECURSION = YES; | |||
CLANG_WARN_INT_CONVERSION = YES; | |||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | |||
CLANG_WARN_UNREACHABLE_CODE = YES; | |||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
COPY_PHASE_STRIP = NO; | |||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | |||
ENABLE_NS_ASSERTIONS = NO; | |||
ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
GCC_C_LANGUAGE_STANDARD = gnu11; | |||
GCC_NO_COMMON_BLOCKS = YES; | |||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
GCC_WARN_UNUSED_FUNCTION = YES; | |||
GCC_WARN_UNUSED_VARIABLE = YES; | |||
HEADER_SEARCH_PATHS = ( | |||
"$(PROJECT_DIR)/../../../local/include", | |||
"$(PROJECT_DIR)/../../../downloadclient", | |||
); | |||
MACOSX_DEPLOYMENT_TARGET = 11.1; | |||
MTL_ENABLE_DEBUG_INFO = NO; | |||
MTL_FAST_MATH = YES; | |||
OTHER_LDFLAGS = "$(OTHER_LDFLAGS)"; | |||
SDKROOT = macosx; | |||
USER_HEADER_SEARCH_PATHS = ""; | |||
}; | |||
name = Release; | |||
}; | |||
4E797B9D25D523FD0090F900 /* Debug */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
CODE_SIGN_STYLE = Automatic; | |||
DEVELOPMENT_TEAM = NQLYU6MGPN; | |||
EXECUTABLE_PREFIX = lib; | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(PROJECT_DIR)", | |||
); | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
SKIP_INSTALL = YES; | |||
USER_HEADER_SEARCH_PATHS = "$(inherited)"; | |||
}; | |||
name = Debug; | |||
}; | |||
4E797B9E25D523FD0090F900 /* Release */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
CODE_SIGN_STYLE = Automatic; | |||
DEVELOPMENT_TEAM = NQLYU6MGPN; | |||
EXECUTABLE_PREFIX = lib; | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(PROJECT_DIR)", | |||
); | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
SKIP_INSTALL = YES; | |||
USER_HEADER_SEARCH_PATHS = "$(inherited)"; | |||
}; | |||
name = Release; | |||
}; | |||
/* End XCBuildConfiguration section */ | |||
/* Begin XCConfigurationList section */ | |||
4E797B8E25D523FD0090F900 /* Build configuration list for PBXProject "PEPUpdatesXPCService" */ = { | |||
isa = XCConfigurationList; | |||
buildConfigurations = ( | |||
4E797B9A25D523FD0090F900 /* Debug */, | |||
4E797B9B25D523FD0090F900 /* Release */, | |||
); | |||
defaultConfigurationIsVisible = 0; | |||
defaultConfigurationName = Release; | |||
}; | |||
4E797B9C25D523FD0090F900 /* Build configuration list for PBXNativeTarget "PEPUpdatesXPCService" */ = { | |||
isa = XCConfigurationList; | |||
buildConfigurations = ( | |||
4E797B9D25D523FD0090F900 /* Debug */, | |||
4E797B9E25D523FD0090F900 /* Release */, | |||
); | |||
defaultConfigurationIsVisible = 0; | |||
defaultConfigurationName = Release; | |||
}; | |||
/* End XCConfigurationList section */ | |||
}; | |||
rootObject = 4E797B8B25D523FD0090F900 /* Project object */; | |||
} |
@ -0,0 +1,81 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<Scheme | |||
LastUpgradeVersion = "1240" | |||
version = "1.3"> | |||
<BuildAction | |||
parallelizeBuildables = "NO" | |||
buildImplicitDependencies = "NO"> | |||
<BuildActionEntries> | |||
<BuildActionEntry | |||
buildForTesting = "YES" | |||
buildForRunning = "YES" | |||
buildForProfiling = "YES" | |||
buildForArchiving = "YES" | |||
buildForAnalyzing = "YES"> | |||
<BuildableReference | |||
BuildableIdentifier = "primary" | |||
BlueprintIdentifier = "35380AC5247BBB03004A08A6" | |||
BuildableName = "libdownloadclient.a" | |||
BlueprintName = "downloadclient" | |||
ReferencedContainer = "container:../../../downloadclient/downloadclient.xcodeproj"> | |||
</BuildableReference> | |||
</BuildActionEntry> | |||
<BuildActionEntry | |||
buildForTesting = "YES" | |||
buildForRunning = "YES" | |||
buildForProfiling = "YES" | |||
buildForArchiving = "YES" | |||
buildForAnalyzing = "YES"> | |||
<BuildableReference | |||
BuildableIdentifier = "primary" | |||
BlueprintIdentifier = "4E797B9225D523FD0090F900" | |||
BuildableName = "libPEPUpdatesXPCService.a" | |||
BlueprintName = "PEPUpdatesXPCService" | |||
ReferencedContainer = "container:PEPUpdatesXPCService.xcodeproj"> | |||
</BuildableReference> | |||
</BuildActionEntry> | |||
</BuildActionEntries> | |||
</BuildAction> | |||
<TestAction | |||
buildConfiguration = "Debug" | |||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | |||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | |||
shouldUseLaunchSchemeArgsEnv = "YES"> | |||
<Testables> | |||
</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"> | |||
</LaunchAction> | |||
<ProfileAction | |||
buildConfiguration = "Release" | |||
shouldUseLaunchSchemeArgsEnv = "YES" | |||
savedToolIdentifier = "" | |||
useCustomWorkingDirectory = "NO" | |||
debugDocumentVersioning = "YES"> | |||
<MacroExpansion> | |||
<BuildableReference | |||
BuildableIdentifier = "primary" | |||
BlueprintIdentifier = "4E797B9225D523FD0090F900" | |||
BuildableName = "libPEPUpdatesXPCService.a" | |||
BlueprintName = "PEPUpdatesXPCService" | |||
ReferencedContainer = "container:PEPUpdatesXPCService.xcodeproj"> | |||
</BuildableReference> | |||
</MacroExpansion> | |||
</ProfileAction> | |||
<AnalyzeAction | |||
buildConfiguration = "Debug"> | |||
</AnalyzeAction> | |||
<ArchiveAction | |||
buildConfiguration = "Release" | |||
revealArchiveInOrganizer = "YES"> | |||
</ArchiveAction> | |||
</Scheme> |
@ -0,0 +1,30 @@ | |||
// | |||
// PEPNotificationXPCApiProtocol.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
/// Notification types | |||
// TODO: Maybe does not belong to this protocol | |||
typedef enum { ready = 0, downloading, downloadArrived, noDownloadAvailable } DNType; | |||
/// Callback protocol to notify about download events | |||
@protocol PEPNotificationXPCApiProtocol <NSObject> | |||
/// notification about download events | |||
- (void)notifyDownload:(int)type withName:(NSString*)name withFilename:(NSString*)filename; | |||
@end | |||
/// This is the object from the client where we deliver notifications to | |||
@interface PEPNotification : NSObject <PEPNotificationXPCApiProtocol> | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,20 @@ | |||
// | |||
// PEPNotificationXPCService.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPNotificationXPCService : NSObject | |||
/// Begin listening for incoming XPC connections | |||
- (void)start; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,13 @@ | |||
// | |||
// PEPNotificationXPCService.m | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import "PEPNotificationXPCService.h" | |||
@implementation PEPNotificationXPCService | |||
@end |
@ -0,0 +1,21 @@ | |||
// | |||
// PEPUpdateDownloadApiClientService.h | |||
// PEPUpdatesXPCService | |||
// | |||
// Created by David Alarcon on 11/2/21. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import "PEPUpdateDownloadXPCApiProtocol.h" | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPUpdateDownloadApiClientService : NSObject <PEPUpdateDownloadXPCApiProtocol> | |||
- (void)start; | |||
- (void)stop; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,78 @@ | |||
// | |||
// PEPUpdateDownloadApiClientService.m | |||
// PEPUpdatesXPCService | |||
// | |||
// Created by David Alarcon on 11/2/21. | |||
// | |||
#import "PEPUpdateDownloadApiClientService.h" | |||
@interface PEPUpdateDownloadApiClientService () | |||
@property (nonatomic, strong) NSXPCConnection *connection; | |||
@property (nonatomic) id<PEPUpdateDownloadXPCApiProtocol> pEpUpdateDownload; | |||
@end | |||
@implementation PEPUpdateDownloadApiClientService | |||
- (void)start { | |||
[self connectToXPCService]; | |||
} | |||
- (void)stop { | |||
self.connection = nil; | |||
} | |||
// MARK: - Private | |||
- (void)connectToXPCService { | |||
self.connection = [[NSXPCConnection alloc] initWithMachServiceName:pEpUpdateDownloadXPCMachName | |||
options:0]; | |||
NSXPCInterface *remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(PEPUpdateDownloadXPCApiProtocol)]; | |||
self.connection.remoteObjectInterface = remoteObjectInterface; | |||
__weak typeof(self) weakSelf = self; | |||
self.connection.invalidationHandler = ^{ | |||
__strong typeof(weakSelf) strongSelf = weakSelf; | |||
strongSelf.connection = nil; | |||
NSLog(@"Connection has been invalidated.\n"); | |||
}; | |||
self.connection.interruptionHandler = ^{ | |||
__strong typeof(self) strongSelf = weakSelf; | |||
strongSelf.connection.interruptionHandler = nil; | |||
NSLog(@"Connection has been interrupted.\n"); | |||
}; | |||
// New connections always start in a suspended state | |||
[self.connection resume]; | |||
// The remote object | |||
self.pEpUpdateDownload = [self.connection remoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) { | |||
}]; | |||
} | |||
// MARK: - PEPUpdateDownloadXPCApiProtocol | |||
- (void)subscribeForUpdate:(NSXPCListenerEndpoint *)endpoint { | |||
[self.pEpUpdateDownload subscribeForUpdate:endpoint]; | |||
} | |||
- (void)unsubscribeForUpdate { | |||
[self.pEpUpdateDownload unsubscribeForUpdate]; | |||
} | |||
- (void)scheduleUpdates { | |||
[self.pEpUpdateDownload scheduleUpdates]; | |||
} | |||
- (void)stopUpdates { | |||
[self.pEpUpdateDownload stopUpdates]; | |||
} | |||
- (void)updateNow { | |||
[self.pEpUpdateDownload updateNow]; | |||
} | |||
@end |
@ -0,0 +1,20 @@ | |||
// | |||
// PEPUpdateDownloadXPCService.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPUpdateDownloadXPCService : NSObject <NSXPCListenerDelegate> | |||
/// Begin listening for incoming XPC connections | |||
- (void)start; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,43 @@ | |||
// | |||
// PEPUpdateDownloader.h | |||
// pEpMacOSAdapter | |||
// | |||
// Created by Volker Birk on 26.05.20. | |||
// Copyright © 2020 p≡p foundation. All rights reserved. | |||
// This file is under GNU General Public License 3.0 | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import "PEPNotificationXPCApiProtocol.h" | |||
/// object encapsulating the update client functionality of downloadclient | |||
@interface PEPUpdateDownloader : NSObject | |||
/// default 2 hours = 7200 seconds | |||
@property (retain) NSTimer* timer; | |||
/// path with config files | |||
@property (retain) NSString* configPath; | |||
/// subscriber for notifications | |||
@property (retain) PEPNotification* subscriber; | |||
/// initializes the PEPUpdateDownloader | |||
- (id)init; | |||
/// schedules updates each 2 hours | |||
- (void)scheduleUpdates; | |||
/// stop auto updates | |||
- (void)stopUpdates; | |||
/// update all configured software | |||
- (void)updateAll; | |||
/// update software described by config file | |||
- (void)updateWithFile:(NSString*)configFile error:(NSError **)err; | |||
/// update a product from URL of update server | |||
- (void)update:(NSString*)name usingUrl:(NSString*)url; | |||
@end |
@ -0,0 +1,147 @@ | |||
// | |||
// PEPUpdateDownloader.mm | |||
// pEpMacOSAdapter | |||
// | |||
// Created by Volker Birk on 26.05.20. | |||
// Copyright © 2020 p≡p foundation. All rights reserved. | |||
// This file is under GNU General Public License 3.0 | |||
// | |||
#import "PEPUpdateDownloader.h" | |||
#include "downloadclient.hh" | |||
const double CYCLE = 7200.0; // 7200 seconds = 2 hours | |||
NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater"; | |||
@implementation PEPUpdateDownloader | |||
- (id)init | |||
{ | |||
self = [super init]; | |||
if (self) { | |||
self.configPath = CONFIG_PATH; | |||
} | |||
return self; | |||
} | |||
- (void)scheduleUpdates | |||
{ | |||
if (!self.timer) { | |||
NSLog(@"schedule updates"); | |||
dispatch_async(dispatch_get_main_queue(), ^{ | |||
self.timer = [NSTimer scheduledTimerWithTimeInterval:CYCLE | |||
target:self | |||
selector:@selector(updateAll) | |||
userInfo:nil | |||
repeats:YES]; | |||
}); | |||
} | |||
else { | |||
NSLog(@"timer already there"); | |||
} | |||
} | |||
- (void)stopUpdates | |||
{ | |||
if (self.timer) { | |||
NSLog(@"stop auto updates"); | |||
[self.timer invalidate]; | |||
self.timer = nil; | |||
} | |||
} | |||
- (void)updateAll | |||
{ | |||
NSLog(@"update all registered products"); | |||
NSFileManager *localFileManager=[NSFileManager new]; | |||
NSDirectoryEnumerator *dirEnum = [localFileManager enumeratorAtPath:_configPath]; | |||
NSString *configFile; | |||
while (dirEnum && (configFile = [dirEnum nextObject])) { | |||
if ([[configFile pathExtension] isEqualToString: @"plist"]) { | |||
NSError *err = nil; | |||
[self updateWithFile:[NSString stringWithFormat:@"%@/%@", _configPath, configFile] error:&err]; | |||
} | |||
} | |||
} | |||
- (void)updateWithFile:(NSString*)configFile error:(NSError **)err | |||
{ | |||
NSLog(@"update product with config file %@", configFile); | |||
NSInputStream *is = [NSInputStream inputStreamWithFileAtPath:configFile]; | |||
[is open]; | |||
NSDictionary* plist = [NSPropertyListSerialization | |||
propertyListWithStream:is options:NSPropertyListMutableContainers | |||
format:nil error:err]; | |||
[is close]; | |||
if (plist) { | |||
NSString* name = [plist objectForKey:@"name"]; | |||
NSString* url = [plist objectForKey:@"url"]; | |||
if (name && url) { | |||
[self update:name usingUrl:url]; | |||
} | |||
} | |||
else if (err) { | |||
NSLog(@"%@ %@ %@ %@", (*err).localizedDescription, | |||
(*err).localizedFailureReason, (*err).localizedRecoveryOptions, | |||
(*err).localizedRecoverySuggestion); | |||
} | |||
} | |||
- (void)update:(NSString*)name usingUrl:(NSString*)url | |||
{ | |||
NSLog(@"update %@ using %@", name, url); | |||
pEp::UpdateClient::product p = { name.UTF8String, url.UTF8String }; | |||
std::string keyfile = _configPath.UTF8String; | |||
keyfile += std::string("/"); | |||
keyfile += p.name; | |||
keyfile += std::string(".der"); | |||
NSLog(@"using key from %s", keyfile.c_str()); | |||
NSString* cwd = [NSFileManager defaultManager].currentDirectoryPath; | |||
NSString* dir = @"/tmp"; | |||
[[NSFileManager defaultManager] changeCurrentDirectoryPath:dir]; | |||
std::string _filename; | |||
pEp::notifyRead_t notifyRead = [=]()->void{ | |||
NSLog(@"downloading: %@", name); | |||
if (_subscriber) { | |||
[_subscriber notifyDownload:(int)downloading withName:name withFilename:@""]; | |||
} | |||
}; | |||
try { | |||
_filename = pEp::UpdateClient::update(p, keyfile, notifyRead); | |||
if (_filename.length()) { | |||
NSString* filename = [NSString stringWithUTF8String:_filename.c_str()]; | |||
NSString* download = [NSString stringWithFormat:@"%@/%@", dir, filename]; | |||
[[NSFileManager defaultManager] changeCurrentDirectoryPath:cwd]; | |||
NSLog(@"download arrived %@", download); | |||
if (_subscriber) { | |||
[_subscriber notifyDownload:(int)downloadArrived withName:name withFilename:download]; | |||
} | |||
} | |||
else { | |||
NSLog(@"no download available for %@", name); | |||
if (_subscriber) { | |||
[_subscriber notifyDownload:(int)noDownloadAvailable withName:name withFilename:@""]; | |||
} | |||
} | |||
} | |||
catch (std::exception& e) { | |||
NSLog(@"pEp::UpdateClient::update({\"%s\", \"%s\"}, \"%s\"): %s", | |||
p.name.c_str(), p.url.c_str(), keyfile.c_str(), e.what()); | |||
} | |||
} | |||
@end |
@ -0,0 +1,19 @@ | |||
// | |||
// PEPUpdateDownloadXPCApi.h | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import "PEPUpdateDownloadXPCApiProtocol.h" | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface PEPUpdateDownloadXPCApi : NSObject <PEPUpdateDownloadXPCApiProtocol> | |||
@property (retain) NSXPCConnection* clientConnection; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,81 @@ | |||
// | |||
// PEPUpdateDownloadXPCApi.m | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import "PEPUpdateDownloadXPCApi.h" | |||
#import "PEPNotificationXPCApiProtocol.h" | |||
#import "PEPUpdateDownloader.h" | |||
//extern PEPUpdateDownloader* updater; | |||
@interface PEPUpdateDownloadXPCApi () | |||
@property (nonatomic) PEPUpdateDownloader *updater; | |||
@end | |||
@implementation PEPUpdateDownloadXPCApi | |||
- (void)subscribeForUpdate:(NSXPCListenerEndpoint*)endpoint { | |||
NSLog(@"subscribeForUpdate called"); | |||
if (!self.updater) { | |||
self.updater = [PEPUpdateDownloader new]; | |||
} | |||
///NotificationXPCService *service = .... | |||
///[service start]; | |||
if (self.updater) { | |||
_clientConnection = [[NSXPCConnection alloc] initWithListenerEndpoint:endpoint]; | |||
_clientConnection.remoteObjectInterface = [NSXPCInterface | |||
interfaceWithProtocol:@protocol(PEPNotificationXPCApiProtocol)]; | |||
__weak typeof(self) weakSelf = self; | |||
_clientConnection.interruptionHandler = ^(){ | |||
__strong typeof(self) strongSelf = weakSelf; | |||
NSLog(@"interruption"); | |||
strongSelf.updater.subscriber = nil; | |||
}; | |||
_clientConnection.invalidationHandler = ^(){ | |||
__strong typeof(self) strongSelf = weakSelf; | |||
NSLog(@"invalidation"); | |||
strongSelf.updater.subscriber = nil; | |||
}; | |||
[_clientConnection resume]; | |||
PEPNotification* downloadNotification = [_clientConnection remoteObjectProxyWithErrorHandler:^(NSError*err) { | |||
NSLog(@"%@", err); | |||
}]; | |||
self.updater.subscriber = downloadNotification; | |||
if (downloadNotification) { | |||
[downloadNotification notifyDownload:ready withName:@"" withFilename:@""]; | |||
} | |||
} | |||
} | |||
- (void)unsubscribeForUpdate { | |||
NSLog(@"unsubscribeForUpdate called"); | |||
if (self.updater) self.updater.subscriber = nil; | |||
} | |||
- (void)updateNow { | |||
NSLog(@"updateNow called"); | |||
if (self.updater) [self.updater updateAll]; | |||
} | |||
- (void)scheduleUpdates { | |||
NSLog(@"scheduleUpdates called"); | |||
if (self.updater) [self.updater scheduleUpdates]; | |||
} | |||
- (void)stopUpdates { | |||
NSLog(@"stopUpdates called"); | |||
if (self.updater) [self.updater stopUpdates]; | |||
} | |||
@end |
@ -0,0 +1,78 @@ | |||
// | |||
// PEPUpdateDownloadXPCService.m | |||
// foundation.pEp.adapter.macOS | |||
// | |||
// Created by David Alarcon on 9/2/21. | |||
// Copyright © 2021 p≡p foundation. All rights reserved. | |||
// | |||
#import "PEPUpdateDownloadXPCService.h" | |||
@import AppKit; | |||
#import "PEPUpdateDownloadXPCApiProtocol.h" | |||
#import "PEPUpdateDownloadXPCApi.h" | |||
@interface PEPUpdateDownloadXPCService () | |||
@property (nonatomic, strong, readwrite) NSXPCListener *listener; | |||
@end | |||
@implementation PEPUpdateDownloadXPCService | |||
- (instancetype)init { | |||
if (self = [super init]) { | |||
_listener = [[NSXPCListener alloc] initWithMachServiceName:pEpUpdateDownloadXPCMachName]; | |||
NSLog(@"starting agent"); | |||
_listener.delegate = self; | |||
} | |||
return self; | |||
} | |||
- (void)start { | |||
[self.listener resume]; | |||
BOOL opened = [self startPEPUpdatesApp]; | |||
assert(opened); | |||
} | |||
// MARK: - Private | |||
- (BOOL)startPEPUpdatesApp { | |||
NSURL *url = [NSURL | |||
fileURLWithPath:@"/Library/Application Support/pEp/pEp.app/Contents/Library/LoginItems/p≡p updates.app"]; | |||
return [[NSWorkspace sharedWorkspace] openURL:url]; | |||
} | |||
// MARK: - NSXPCListenerDelegate | |||
- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { | |||
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. | |||
NSLog(@"incoming connection"); | |||
// Configure the connection. | |||
// First, set the interface that the exported object implements. | |||
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(PEPUpdateDownloadXPCApiProtocol)]; | |||
// Next, set the object that the connection exports. All messages sent on | |||
// the connection to this service will be sent to the exported object to | |||
// handle. The connection retains the exported object. | |||
PEPUpdateDownloadXPCApi *exportedObject = [PEPUpdateDownloadXPCApi new]; | |||
newConnection.exportedObject = exportedObject; | |||
if (!newConnection.exportedInterface || !newConnection.exportedObject) { | |||
NSLog(@"failed to allocate object and interface"); | |||
return NO; | |||
} | |||
// Resuming the connection allows the system to deliver more incoming messages. | |||
[newConnection resume]; | |||
// Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. | |||
NSLog(@"connection accepted"); | |||
return YES; | |||
} | |||
@end |
@ -0,0 +1,37 @@ | |||
// | |||
// PEPMacOSAdapterProtocol.h | |||
// pEpMacOSAdapter | |||
// | |||
// Created by Volker Birk on 20.04.20. | |||
// Copyleft © 2020 p≡p foundation. | |||
// This file is under GNU General Public License 3.0 | |||
// | |||
#import <Foundation/Foundation.h> | |||
static NSString *pEpUpdateDownloadXPCMachName = @"foundation.pEp.adapter.macOS_OpenStep"; | |||
/// This protocol is providing the XPC interface to the User Interface program pEpNotifications | |||
@protocol PEPUpdateDownloadXPCApiProtocol | |||
/** | |||
subscribe to the published notifications about downloads arriving | |||
- Parameter downloading: block to call back when a download is going to happen | |||
- Parameter downloadArrived: block to call back when a download arrived | |||
*/ | |||
- (void)subscribeForUpdate:(NSXPCListenerEndpoint*)endpoint; | |||
/// unsubscribe from receiving notifications about downloads arriving | |||
- (void)unsubscribeForUpdate; | |||
/// search for immediate updates | |||
- (void)updateNow; | |||
/// schedules updates each 2 hours | |||
- (void)scheduleUpdates; | |||
/// stop auto updates | |||
- (void)stopUpdates; | |||
@end |
@ -0,0 +1,12 @@ | |||
// | |||
// PEPUpdatesXPCService.h | |||
// PEPUpdatesXPCService | |||
// | |||
// Created by David Alarcon on 11/2/21. | |||
// | |||
#import <Foundation/Foundation.h> | |||
@interface PEPUpdatesXPCService : NSObject | |||
@end |
@ -0,0 +1,12 @@ | |||
// | |||
// PEPUpdatesXPCService.m | |||
// PEPUpdatesXPCService | |||
// | |||
// Created by David Alarcon on 11/2/21. | |||
// | |||
#import "PEPUpdatesXPCService.h" | |||
@implementation PEPUpdatesXPCService | |||
@end |
@ -0,0 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<Workspace | |||
version = "1.0"> | |||
<FileRef | |||
location = "self:"> | |||
</FileRef> | |||
</Workspace> |
@ -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> |