diff --git a/iOS/FlipperKit/CppBridge/FlipperCppBridgingConnection.mm b/iOS/FlipperKit/CppBridge/FlipperCppBridgingConnection.mm index 817c097a4..711d89ae4 100644 --- a/iOS/FlipperKit/CppBridge/FlipperCppBridgingConnection.mm +++ b/iOS/FlipperKit/CppBridge/FlipperCppBridgingConnection.mm @@ -11,13 +11,12 @@ #import "FlipperCppBridgingResponder.h" -@implementation FlipperCppBridgingConnection -{ +@implementation FlipperCppBridgingConnection { std::shared_ptr conn_; } -- (instancetype)initWithCppConnection:(std::shared_ptr)conn -{ +- (instancetype)initWithCppConnection: + (std::shared_ptr)conn { if (self = [super init]) { conn_ = conn; } @@ -26,27 +25,31 @@ #pragma mark - SonarConnection -- (void)send:(NSString *)method withParams:(NSDictionary *)params -{ - conn_->send([method UTF8String], facebook::cxxutils::convertIdToFollyDynamic(params, true)); +- (void)send:(NSString*)method withParams:(NSDictionary*)params { + conn_->send( + [method UTF8String], + facebook::cxxutils::convertIdToFollyDynamic(params, true)); } -- (void)receive:(NSString *)method withBlock:(SonarReceiver)receiver -{ - const auto lambda = [receiver](const folly::dynamic &message, - std::shared_ptr responder) { - @autoreleasepool { - FlipperCppBridgingResponder *const objCResponder = - [[FlipperCppBridgingResponder alloc] initWithCppResponder:responder]; - receiver(facebook::cxxutils::convertFollyDynamicToId(message), objCResponder); - } - }; - conn_->receive([method UTF8String], lambda); +- (void)receive:(NSString*)method withBlock:(SonarReceiver)receiver { + const auto lambda = + [receiver]( + const folly::dynamic& message, + std::shared_ptr responder) { + @autoreleasepool { + FlipperCppBridgingResponder* const objCResponder = + [[FlipperCppBridgingResponder alloc] + initWithCppResponder:responder]; + receiver( + facebook::cxxutils::convertFollyDynamicToId(message), + objCResponder); + } + }; + conn_->receive([method UTF8String], lambda); } -- (void)errorWithMessage:(NSString *)message stackTrace:(NSString *)stacktrace { +- (void)errorWithMessage:(NSString*)message stackTrace:(NSString*)stacktrace { conn_->error([message UTF8String], [stacktrace UTF8String]); } - @end diff --git a/iOS/FlipperKit/FlipperConnection.h b/iOS/FlipperKit/FlipperConnection.h index b7489776e..a4b90767c 100644 --- a/iOS/FlipperKit/FlipperConnection.h +++ b/iOS/FlipperKit/FlipperConnection.h @@ -13,24 +13,25 @@ typedef void (^SonarReceiver)(NSDictionary*, id); /** -Represents a connection between the Desktop and mobile plugins with corresponding identifiers. +Represents a connection between the Desktop and mobile plugins with +corresponding identifiers. */ @protocol FlipperConnection /** Invoke a method on the Sonar desktop plugin with with a matching identifier. */ -- (void)send:(NSString *)method withParams:(NSDictionary *)params; +- (void)send:(NSString*)method withParams:(NSDictionary*)params; /** -Register a receiver to be notified of incoming calls of the given method from the Sonar desktop -plugin with a matching identifier. +Register a receiver to be notified of incoming calls of the given method from +the Sonar desktop plugin with a matching identifier. */ -- (void)receive:(NSString *)method withBlock:(SonarReceiver)receiver; +- (void)receive:(NSString*)method withBlock:(SonarReceiver)receiver; /** Report an error to the Flipper desktop app */ -- (void)errorWithMessage:(NSString *)message stackTrace:(NSString *)stacktrace; +- (void)errorWithMessage:(NSString*)message stackTrace:(NSString*)stacktrace; @end