Rename SonarResponder to FlipperResponder
Summary: Rename SonarResponder to FlipperResponder Reviewed By: passy Differential Revision: D9939713 fbshipit-source-id: 6792ec6529907ee98a070af9e26064bb5fcc07ef
This commit is contained in:
committed by
Facebook Github Bot
parent
0e753e684f
commit
79b2cf712d
@@ -6,13 +6,13 @@
|
||||
*
|
||||
*/
|
||||
#import <Sonar/FlipperResponder.h>
|
||||
#import <FlipperKit/SonarResponder.h>
|
||||
#import <FlipperKit/FlipperResponder.h>
|
||||
|
||||
/**
|
||||
SonarCppBridgingResponder is a simple ObjC wrapper around SonarResponder
|
||||
SonarCppBridgingResponder is a simple ObjC wrapper around FlipperResponder
|
||||
that forwards messages to the underlying C++ responder. This class allows
|
||||
pure Objective-C plugins to send messages to the underlying responder.
|
||||
*/
|
||||
@interface SonarCppBridgingResponder : NSObject <SonarResponder>
|
||||
@interface SonarCppBridgingResponder : NSObject <FlipperResponder>
|
||||
- (instancetype)initWithCppResponder:(std::unique_ptr<facebook::flipper::FlipperResponder>)responder;
|
||||
@end
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - SonarResponder
|
||||
#pragma mark - FlipperResponder
|
||||
|
||||
- (void)success:(NSDictionary *)response { responder_->success(facebook::cxxutils::convertIdToFollyDynamic(response, true)); }
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol SonarResponder;
|
||||
@protocol FlipperResponder;
|
||||
@protocol SonarWebSocket;
|
||||
|
||||
typedef void (^SonarReceiver)(NSDictionary*, id<SonarResponder>);
|
||||
typedef void (^SonarReceiver)(NSDictionary*, id<FlipperResponder>);
|
||||
|
||||
/**
|
||||
Represents a connection between the Desktop and mobile plugins with corresponding identifiers.
|
||||
|
||||
25
iOS/FlipperKit/FlipperResponder.h
Normal file
25
iOS/FlipperKit/FlipperResponder.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
Acts as a hook for providing return values to remote called from Sonar desktop plugins.
|
||||
*/
|
||||
@protocol FlipperResponder
|
||||
|
||||
/**
|
||||
Respond with a successful return value.
|
||||
*/
|
||||
- (void)success:(NSDictionary *)response;
|
||||
|
||||
/**
|
||||
Respond with an error.
|
||||
*/
|
||||
- (void)error:(NSDictionary *)response;
|
||||
|
||||
@end
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#import <FlipperKit/FlipperClient.h>
|
||||
#import <FlipperKit/FlipperConnection.h>
|
||||
#import <FlipperKit/SonarResponder.h>
|
||||
#import <FlipperKit/FlipperResponder.h>
|
||||
#import <FlipperKit/SKMacros.h>
|
||||
#import "SKDescriptorMapper.h"
|
||||
#import "SKNodeDescriptor.h"
|
||||
@@ -83,15 +83,15 @@
|
||||
// In order to avoid a retain cycle (Connection -> Block -> SonarKitLayoutPlugin -> Connection ...)
|
||||
__weak SonarKitLayoutPlugin *weakSelf = self;
|
||||
|
||||
[connection receive:@"getRoot" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"getRoot" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{ [weakSelf onCallGetRoot: responder]; });
|
||||
}];
|
||||
|
||||
[connection receive:@"getNodes" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"getNodes" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{ [weakSelf onCallGetNodes: params[@"ids"] withResponder: responder]; });
|
||||
}];
|
||||
|
||||
[connection receive:@"setData" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"setData" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{
|
||||
[weakSelf onCallSetData: params[@"id"]
|
||||
withPath: params[@"path"]
|
||||
@@ -100,19 +100,19 @@
|
||||
});
|
||||
}];
|
||||
|
||||
[connection receive:@"setHighlighted" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"setHighlighted" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{ [weakSelf onCallSetHighlighted: params[@"id"] withResponder: responder]; });
|
||||
}];
|
||||
|
||||
[connection receive:@"setSearchActive" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"setSearchActive" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{ [weakSelf onCallSetSearchActive: [params[@"active"] boolValue] withConnection: connection]; });
|
||||
}];
|
||||
|
||||
[connection receive:@"isConsoleEnabled" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"isConsoleEnabled" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{ [responder success: @{@"isEnabled": @NO}];});
|
||||
}];
|
||||
|
||||
[connection receive:@"getSearchResults" withBlock:^(NSDictionary *params, id<SonarResponder> responder) {
|
||||
[connection receive:@"getSearchResults" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
FlipperPerformBlockOnMainThread(^{ [weakSelf onCallGetSearchResults: params[@"query"] withResponder: responder]; });
|
||||
}];
|
||||
}
|
||||
@@ -124,13 +124,13 @@
|
||||
[self onCallSetSearchActive: NO withConnection: nil];
|
||||
}
|
||||
|
||||
- (void)onCallGetRoot:(id<SonarResponder>)responder {
|
||||
- (void)onCallGetRoot:(id<FlipperResponder>)responder {
|
||||
const auto rootNode= [self getNode: [self trackObject: _rootNode]];
|
||||
|
||||
[responder success: rootNode];
|
||||
}
|
||||
|
||||
- (void)onCallGetNodes:(NSArray<NSDictionary *> *)nodeIds withResponder:(id<SonarResponder>)responder {
|
||||
- (void)onCallGetNodes:(NSArray<NSDictionary *> *)nodeIds withResponder:(id<FlipperResponder>)responder {
|
||||
NSMutableArray<NSDictionary *> *elements = [NSMutableArray new];
|
||||
|
||||
for (id nodeId in nodeIds) {
|
||||
@@ -174,7 +174,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onCallGetSearchResults:(NSString *)query withResponder:(id<SonarResponder>)responder {
|
||||
- (void)onCallGetSearchResults:(NSString *)query withResponder:(id<FlipperResponder>)responder {
|
||||
const auto alreadyAddedElements = [NSMutableSet<NSString *> new];
|
||||
SKSearchResultNode *matchTree = [self searchForQuery:(NSString *)[query lowercaseString] fromNode:(id)_rootNode withElementsAlreadyAdded: alreadyAddedElements];
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- (void)onCallSetHighlighted:(NSString *)objectId withResponder:(id<SonarResponder>)responder {
|
||||
- (void)onCallSetHighlighted:(NSString *)objectId withResponder:(id<FlipperResponder>)responder {
|
||||
if (_lastHighlightedNode != nil) {
|
||||
id lastHighlightedObject = [_trackedObjects objectForKey: _lastHighlightedNode];
|
||||
if (lastHighlightedObject == nil) {
|
||||
|
||||
@@ -64,7 +64,7 @@ Pod::Spec.new do |spec|
|
||||
'iOS/Plugins/SonarKitNetworkPlugin/SonarKitNetworkPlugin/SKResponseInfo.h',
|
||||
'iOS/Plugins/SonarKitNetworkPlugin/SonarKitNetworkPlugin/SonarKitNetworkPlugin.h',
|
||||
'iOS/FBDefines/FBMacros.h',
|
||||
'iOS/FlipperKit/**/{FlipperStateUpdateListener,FlipperClient,FlipperPlugin,FlipperConnection,SonarResponder,SKMacros}.h'
|
||||
'iOS/FlipperKit/**/{FlipperStateUpdateListener,FlipperClient,FlipperPlugin,FlipperConnection,FlipperResponder,SKMacros}.h'
|
||||
header_search_paths = "\"$(PODS_ROOT)/FlipperKit/iOS/FlipperKit\" \"$(PODS_ROOT)\"/Headers/Private/FlipperKit/** \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/PeerTalkSonar\""
|
||||
ss.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
|
||||
"DEFINES_MODULE" => "YES",
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FlipperKit/SonarResponder.h>
|
||||
#import <FlipperKit/FlipperResponder.h>
|
||||
|
||||
@interface SonarResponderMock : NSObject<SonarResponder>
|
||||
@interface SonarResponderMock : NSObject<FlipperResponder>
|
||||
|
||||
@property (nonatomic, readonly) NSArray<NSDictionary *> *successes;
|
||||
@property (nonatomic, readonly) NSArray<NSDictionary *> *errors;
|
||||
|
||||
Reference in New Issue
Block a user