Browse Source

Merge branch 'APPLEMAIL-45'

* APPLEMAIL-45:
  APPLEMAIL-45 Add undo xpc call.
  APPLEMAIL-45 Add xpc calls for trust and mistrust.
  Add confirm trust and deny trust xpc calls.
  APPLEMAIL-45 Add reset key xpc call.
  APPLEMAIL-45 Add trustwords call.
  APPLEMAIL-45 Add update and rateIdentity in XPC connection.
master
David Alarcon 2 weeks ago
parent
commit
6b4cb5cc2e
3 changed files with 233 additions and 0 deletions
  1. +64
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/XPCService/PEPObjCAdapterXPCApiClientService.m
  2. +143
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCService/XPCService/PEPObjCAdapterXPCApi.m
  3. +26
    -0
      Subprojects/PEPObjCAdapterXPCService/Shared/PEPObjCAdapterXpcApiProtocol.h

+ 64
- 0
Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/XPCService/PEPObjCAdapterXPCApiClientService.m View File

@ -155,6 +155,70 @@ successCallback:(nonnull void (^)(PEPIdentity * _Nonnull))successCallback {
}];
}
- (void)updateIdentity:(PEPIdentity *)identity errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(PEPIdentity * _Nonnull))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] updateIdentity:identity resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
PEPIdentity *updatedIdentity = result.result.firstObject;
successCallback(updatedIdentity);
}];
}
- (void)ratingForIdentity:(PEPIdentity *)identity errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(PEPRating))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] ratingForIdentity:identity resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
PEPRating rating = [(NSNumber *)result.result.firstObject intValue];
successCallback(rating);
}];
}
- (void)getTrustwordsIdentity1:(PEPIdentity *)identity1 identity2:(PEPIdentity *)identity2 language:(NSString *)language full:(BOOL)full errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(NSString * _Nonnull))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] getTrustwordsIdentity1:identity1 identity2:identity2 language:language full:full resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
NSString *trustwords = result.result.firstObject;
successCallback(trustwords);
}];
}
- (void)keyReset:(PEPIdentity *)identity fingerprint:(NSString *)fingerprint errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(void))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] keyReset:identity fingerprint:fingerprint resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
successCallback();
}];
}
- (void)trustPersonalKey:(PEPIdentity *)identity errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(void))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] trustPersonalKey:identity resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
successCallback();
}];
}
- (void)keyMistrusted:(PEPIdentity *)identity errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(void))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] keyMistrusted:identity resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
successCallback();
}];
}
- (void)languageList:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(NSArray<PEPLanguage *> * _Nonnull))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] languageList:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
NSArray<PEPLanguage*> *languages = result.result.firstObject;
successCallback(languages);
}];
}
- (void)keyResetTrust:(PEPIdentity *)identity errorCallback:(void (^)(NSError * _Nonnull))errorCallback successCallback:(void (^)(void))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:errorCallback] keyResetTrust:identity resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
successCallback();
}];
}
// MARK: - PEPObjCAdapterConfigurationProtocol
- (void)setPassiveModeEnabled:(BOOL)enabled {


+ 143
- 0
Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCService/XPCService/PEPObjCAdapterXPCApi.m View File

@ -131,4 +131,147 @@
[PEPObjCAdapter setPassiveModeEnabled:enabled];
}
- (void)updateIdentity:(PEPIdentity *)identity resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session updateIdentity:identity errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^(PEPIdentity * _Nonnull identity) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[identity]
error:nil];
resultCallback(result);
}];
}
- (void)ratingForIdentity:(PEPIdentity *)identity resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session ratingForIdentity:identity errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^(PEPRating rating) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[@(rating)]
error:nil];
resultCallback(result);
}];
}
- (void)getTrustwordsIdentity1:(PEPIdentity *)identity1 identity2:(PEPIdentity *)identity2 language:(NSString *)language full:(BOOL)full resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session getTrustwordsIdentity1:identity1 identity2:identity2 language:language full:full errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^(NSString * _Nonnull trustwords) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[trustwords]
error:nil];
resultCallback(result);
}];
}
- (void)keyReset:(PEPIdentity *)identity fingerprint:(NSString *)fingerprint resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session keyReset:identity fingerprint:fingerprint errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^{
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[]
error:nil];
resultCallback(result);
}];
}
- (void)trustPersonalKey:(PEPIdentity *)identity resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session trustPersonalKey:identity errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^{
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[]
error:nil];
resultCallback(result);
}];
}
- (void)keyMistrusted:(PEPIdentity *)identity resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session keyMistrusted:identity errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^{
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[]
error:nil];
resultCallback(result);
}];
}
- (void)languageList:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session languageList:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^(NSArray<PEPLanguage *> * _Nonnull languages) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[languages]
error:nil];
resultCallback(result);
}];
}
- (void)keyResetTrust:(PEPIdentity *)identity resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
id<PEPSessionProtocol> session = [PEPSession new];
[session keyResetTrust:identity errorCallback:^(NSError * _Nonnull error) {
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:nil
error:error];
resultCallback(result);
} successCallback:^{
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[]
error:nil];
resultCallback(result);
}];
}
//- (void)callTheError:(NSError * _Nonnull)error withResultCallback:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
// PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
// initWithResult:nil
// error:error];
// resultCallback(result);
//}
@end

+ 26
- 0
Subprojects/PEPObjCAdapterXPCService/Shared/PEPObjCAdapterXpcApiProtocol.h View File

@ -42,6 +42,32 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setPassiveModeEnabled:(BOOL)enabled;
- (void)updateIdentity:(PEPIdentity *)identity
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)ratingForIdentity:(PEPIdentity *)identity
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)getTrustwordsIdentity1:(PEPIdentity *)identity1
identity2:(PEPIdentity *)identity2
language:(NSString *)language
full:(BOOL)full
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)keyReset:(PEPIdentity *)identity
fingerprint:(NSString *)fingerprint
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)trustPersonalKey:(PEPIdentity *)identity
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)keyMistrusted:(PEPIdentity *)identity
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)languageList:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)keyResetTrust:(PEPIdentity *)identity
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
@end
NS_ASSUME_NONNULL_END

Loading…
Cancel
Save