works_for_me
Volker Birk 3 years ago
parent b84a6370b0
commit d2d570c14e

@ -23,8 +23,7 @@
35F0698B247E31B100543884 /* libcryptopp.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F0698A247E31B100543884 /* libcryptopp.dylib */; };
35F0698E247E327600543884 /* libboost_regex.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F06988247E318F00543884 /* libboost_regex.dylib */; };
35F0698F247E329400543884 /* libcryptopp.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F0698A247E31B100543884 /* libcryptopp.dylib */; };
35F06991247F00E500543884 /* public.der in Resources */ = {isa = PBXBuildFile; fileRef = 35F06990247F00E500543884 /* public.der */; };
35F06993247F013300543884 /* public.der in Resources */ = {isa = PBXBuildFile; fileRef = 35F06990247F00E500543884 /* public.der */; };
35F06993247F013300543884 /* test.der in Resources */ = {isa = PBXBuildFile; fileRef = 35F06990247F00E500543884 /* test.der */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -74,6 +73,7 @@
/* Begin PBXFileReference section */
3527B2E024802F87007A6276 /* pEpNotifications.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pEpNotifications.xcodeproj; path = pEpNotifications/pEpNotifications.xcodeproj; sourceTree = "<group>"; };
3527B2EC24806A18007A6276 /* pEpMacOSAdapterSubscriberProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pEpMacOSAdapterSubscriberProtocol.h; sourceTree = "<group>"; };
35380AD4247BBB03004A08A6 /* downloadclient.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = downloadclient.xcodeproj; path = ../downloadclient/downloadclient/downloadclient.xcodeproj; sourceTree = "<group>"; };
35380AE6247BD13A004A08A6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
35380AE8247C784E004A08A6 /* pEpUpdater.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pEpUpdater.h; sourceTree = "<group>"; };
@ -93,7 +93,7 @@
35F0697B247DC95A00543884 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
35F06988247E318F00543884 /* libboost_regex.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libboost_regex.dylib; path = ../boost_1_72_0/stage/lib/libboost_regex.dylib; sourceTree = "<group>"; };
35F0698A247E31B100543884 /* libcryptopp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcryptopp.dylib; path = ../../../../opt/local/lib/libcryptopp.dylib; sourceTree = "<group>"; };
35F06990247F00E500543884 /* public.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = public.der; sourceTree = "<group>"; };
35F06990247F00E500543884 /* test.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.der; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -146,7 +146,6 @@
isa = PBXGroup;
children = (
3527B2E024802F87007A6276 /* pEpNotifications.xcodeproj */,
35F06990247F00E500543884 /* public.der */,
35380AD4247BBB03004A08A6 /* downloadclient.xcodeproj */,
35DC18D4244DA19100FB2002 /* pEpMacOSAdapter */,
35F06978247DC95A00543884 /* pEpUpdater Test */,
@ -175,6 +174,7 @@
35DC18DB244DA19100FB2002 /* Info.plist */,
35380AE8247C784E004A08A6 /* pEpUpdater.h */,
35380AE9247C784E004A08A6 /* pEpUpdater.mm */,
3527B2EC24806A18007A6276 /* pEpMacOSAdapterSubscriberProtocol.h */,
);
path = pEpMacOSAdapter;
sourceTree = "<group>";
@ -195,6 +195,7 @@
35F06978247DC95A00543884 /* pEpUpdater Test */ = {
isa = PBXGroup;
children = (
35F06990247F00E500543884 /* test.der */,
35F06979247DC95A00543884 /* pEpUpdater_Test.m */,
35F0697B247DC95A00543884 /* Info.plist */,
);
@ -322,7 +323,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
35F06991247F00E500543884 /* public.der in Resources */,
35380AE7247BD13A004A08A6 /* README.md in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -331,7 +331,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
35F06993247F013300543884 /* public.der in Resources */,
35F06993247F013300543884 /* test.der in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -423,11 +423,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
/Users/vb/dev/boost_1_72_0,
/opt/local/include,
);
LIBRARY_SEARCH_PATHS = /Users/vb/dev/boost_1_72_0/stage/lib;
HEADER_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@ -480,11 +477,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
/Users/vb/dev/boost_1_72_0,
/opt/local/include,
);
LIBRARY_SEARCH_PATHS = /Users/vb/dev/boost_1_72_0/stage/lib;
HEADER_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
@ -495,34 +489,50 @@
35DC18DF244DA19100FB2002 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = (
/Users/vb/dev/boost_1_72_0,
/opt/local/include,
);
INFOPLIST_FILE = pEpMacOSAdapter/Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/Users/vb/dev/boost_1_72_0/stage/lib,
/opt/local/lib,
);
PRODUCT_BUNDLE_IDENTIFIER = pEp.foundation.pEpMacOSAdapter;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = macosx;
};
name = Debug;
};
35DC18E0244DA19100FB2002 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = (
/Users/vb/dev/boost_1_72_0,
/opt/local/include,
);
INFOPLIST_FILE = pEpMacOSAdapter/Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/Users/vb/dev/boost_1_72_0/stage/lib,
/opt/local/lib,
);
PRODUCT_BUNDLE_IDENTIFIER = pEp.foundation.pEpMacOSAdapter;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = macosx;
};
name = Release;
};
@ -531,6 +541,11 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Users/vb/dev/boost_1_72_0,
/opt/local/include,
);
INFOPLIST_FILE = "pEpUpdater Test/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -540,10 +555,13 @@
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/Users/vb/dev/boost_1_72_0/stage/lib,
/opt/local/lib,
);
PRODUCT_BUNDLE_IDENTIFIER = "pEp.foundation.pEpUpdater-Test";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
USE_HEADERMAP = YES;
};
name = Debug;
};
@ -552,6 +570,11 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Users/vb/dev/boost_1_72_0,
/opt/local/include,
);
INFOPLIST_FILE = "pEpUpdater Test/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -561,10 +584,13 @@
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/Users/vb/dev/boost_1_72_0/stage/lib,
/opt/local/lib,
);
PRODUCT_BUNDLE_IDENTIFIER = "pEp.foundation.pEpUpdater-Test";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
USE_HEADERMAP = YES;
};
name = Release;
};

@ -11,11 +11,19 @@
#import "pEpMacOSAdapter.h"
#import "pEpUpdater.h"
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate, pEpMacOSAdapterSubscriberProtocol>
@end
@implementation ServiceDelegate
NSMutableArray* _subscribers;
- (id)init{
self = [super init];
_subscribers = [NSMutableArray new];
return self;
}
- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
@ -34,6 +42,11 @@
return YES;
}
- (void)notifyDownloadArrived:(NSString *)download
{
}
@end
int main(int argc, const char *argv[])

@ -9,10 +9,8 @@
#import <Foundation/Foundation.h>
#import "pEpMacOSAdapterProtocol.h"
#import "pEpMacOSAdapterSubscriberProtocol.h"
// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection.
@interface pEpMacOSAdapter : NSObject <pEpMacOSAdapterProtocol>
- (void)notifyDownloadArrived:(NSString *)download;
@interface pEpMacOSAdapter : NSObject <pEpMacOSAdapterProtocol, pEpMacOSAdapterSubscriberProtocol>
@end

@ -11,27 +11,31 @@
@implementation pEpMacOSAdapter
void (^subscriber)(NSString *) = nil;
void (^_subscriber)(NSString *) = nil;
// begin pEpMacOSAdapterProtocol
- (void)subscribeForUpdate:(void (^)(NSString *))downloadArrived
{
subscriber = downloadArrived;
_subscriber = downloadArrived;
}
- (void)unsubscribeForUpdate
{
subscriber = nil;
_subscriber = nil;
}
// end pEpMacOSAdapterProtocol
// begin pEpMacOSAdapterSubscriberProtocol
- (void)notifyDownloadArrived:(NSString *)download
{
if (subscriber) {
subscriber(download);
if (_subscriber) {
_subscriber(download);
}
}
// end pEpMacOSAdapterSubscriberProtocol
@end

@ -0,0 +1,13 @@
//
// pEpMacOSAdapterNotifyProtocol.h
// pEpMacOSAdapter
//
// Created by Volker Birk on 28.05.20.
// Copyright © 2020 p≡p foundation. All rights reserved.
//
@protocol pEpMacOSAdapterSubscriberProtocol
- (void)notifyDownloadArrived:(NSString *)download;
@end

@ -77,9 +77,10 @@ static const double CYCLE = 7200.0; // 7200 seconds = 2 hours
[localFileManager changeCurrentDirectoryPath:tmp];
std::string _filename = pEp::UpdateClient::update(p, keyfile);
NSString* filename = [NSString stringWithUTF8String:_filename.c_str()];
NSString* download = [NSString stringWithFormat:@"%@%@", tmp, filename];
NSString* download = [NSString stringWithFormat:@"%@/%@", tmp, filename];
[localFileManager changeCurrentDirectoryPath:cwd];
NSLog(@"pEpMacOSAdapter: download %@", download);
}
catch (std::exception& e) {
NSLog(@"pEpMacOSAdapter: %s", e.what());

@ -25,7 +25,10 @@
- (void)testUpdate {
pEpUpdater* updater = [pEpUpdater new];
XCTAssertNil(nil);
NSString *path = [[NSBundle bundleForClass:[pEpUpdater_Test class]] pathForResource:@"test.der" ofType:nil];
updater.configPath = [path stringByDeletingLastPathComponent];
[updater update:@"test" usingUrl:@"https://fdik.org/cgidownload?hash=23232323234242"];
}
/*

Loading…
Cancel
Save