Browse Source

APPLEMAIL-42 Add colorFromRating xpc call.

APPLEMAIL-42
David Alarcon 1 year ago
parent
commit
a86ec68c05
5 changed files with 79 additions and 0 deletions
  1. +5
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/Interface/PEPObjCAdapterXPCApiClientService.h
  2. +24
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/XPCService/PEPObjCAdapterXPCApiClientService.m
  3. +29
    -0
      Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCService/XPCService/PEPObjCAdapterXPCApi.m
  4. +7
    -0
      Subprojects/PEPObjCAdapterXPCService/Shared/PEPObjCAdapterXpcApiProtocol.h
  5. +14
    -0
      pEpMacOSAdapter.xcodeproj/xcshareddata/xcschemes/pEpMacOSAdapter.xcscheme

+ 5
- 0
Subprojects/PEPObjCAdapterXPCService/PEPObjCAdapterXPCApiClient/Interface/PEPObjCAdapterXPCApiClientService.h View File

@ -19,6 +19,11 @@ NS_ASSUME_NONNULL_BEGIN
- (void)start;
- (void)stop;
/// Wraps color_from_rating.
- (void)colorFromRating:(PEPRating)rating
errorCallback:(void (^)(NSError * _Nonnull))errorCallback
successCallback:(void (^)(PEPColor))successCallback;
@end
NS_ASSUME_NONNULL_END

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

@ -87,4 +87,28 @@ successCallback:(nonnull void (^)(PEPIdentity * _Nonnull))successCallback {
}];
}
- (void)outgoingRatingForMessage:(PEPMessage *)theMessage
errorCallback:(void (^)(NSError * _Nonnull))errorCallback
successCallback:(void (^)(PEPRating))successCallback {
[[self.connection remoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) {
errorCallback(error);
}] outgoingRatingForMessage:theMessage resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
PEPRating pEpRating = [(NSNumber *)[result.result firstObject] intValue];
successCallback(pEpRating);
}];
}
- (PEPColor)colorFromRating:(PEPRating)rating {
__block PEPColor color = PEPColorNoColor;
[[self.connection synchronousRemoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) {
NSLog(@"[PEP4I meant I'll keep working on it a little bit more, and we APPLEMAIL] Error: %@", error);
}] colorFromRating:rating resultBlock:^(PEPObjCAdapterXpcApiResult * _Nonnull result) {
color = [(NSNumber *)[result.result firstObject] intValue];
}];
return color;
}
@end

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

@ -46,4 +46,33 @@
}];
}
- (void)outgoingRatingForMessage:(PEPMessage *)theMessage
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s", __PRETTY_FUNCTION__);
PEPSession *session = [PEPSession new];
[session outgoingRatingForMessage:theMessage 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)colorFromRating:(PEPRating)rating
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult * _Nonnull))resultCallback {
NSLog(@"%s, __PRETTY_FUNCTION__");
PEPSession *session = [PEPSession new];
PEPColor color = [session colorFromRating:rating];
PEPObjCAdapterXpcApiResult *result = [[PEPObjCAdapterXpcApiResult alloc]
initWithResult:@[@(color)]
error:nil];
resultCallback(result);
}
@end

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

@ -23,6 +23,13 @@ NS_ASSUME_NONNULL_BEGIN
extraKeys:(PEPStringList *_Nullable)extraKeys
encFormat:(PEPEncFormat)encFormat
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)outgoingRatingForMessage:(PEPMessage *)theMessage
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
- (void)colorFromRating:(PEPRating)rating
resultBlock:(void (^)(PEPObjCAdapterXpcApiResult *))resultCallback;
@end
NS_ASSUME_NONNULL_END

+ 14
- 0
pEpMacOSAdapter.xcodeproj/xcshareddata/xcschemes/pEpMacOSAdapter.xcscheme View File

@ -104,6 +104,20 @@
ReferencedContainer = "container:pEpMacOSAdapter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4E44A4C226247559001F9D55"
BuildableName = "Install pEpMacOSAdapter Service"
BlueprintName = "Install pEpMacOSAdapter Service"
ReferencedContainer = "container:pEpMacOSAdapter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction


Loading…
Cancel
Save