Summary: Add the affiliates bit that the linter is checking for. Reviewed By: jknoxville Differential Revision: D15164826 fbshipit-source-id: 500ffe89ec0c2fd3acfbc374408d16a337cecfa4
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
* file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
#import "FlipperCppBridgingConnection.h"
|
|
|
|
#import <FBCxxUtils/FBCxxFollyDynamicConvert.h>
|
|
|
|
#import "FlipperCppBridgingResponder.h"
|
|
|
|
@implementation FlipperCppBridgingConnection
|
|
{
|
|
std::shared_ptr<facebook::flipper::FlipperConnection> conn_;
|
|
}
|
|
|
|
- (instancetype)initWithCppConnection:(std::shared_ptr<facebook::flipper::FlipperConnection>)conn
|
|
{
|
|
if (self = [super init]) {
|
|
conn_ = conn;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - SonarConnection
|
|
|
|
- (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<facebook::flipper::FlipperResponder> responder) {
|
|
@autoreleasepool {
|
|
FlipperCppBridgingResponder *const objCResponder =
|
|
[[FlipperCppBridgingResponder alloc] initWithCppResponder:responder];
|
|
receiver(facebook::cxxutils::convertFollyDynamicToId(message), objCResponder);
|
|
}
|
|
};
|
|
conn_->receive([method UTF8String], lambda);
|
|
}
|
|
|
|
@end
|