Support iOS FlipperConnection send with array parameters
Summary: Achieving API parity with C++ and Android. Reviewed By: lblasa Differential Revision: D31921830 fbshipit-source-id: 873901107fc3c53166fa7bbaaff65ebdb0e53c2a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4a4cc21d89
commit
64df212cd3
@@ -14,23 +14,34 @@
|
||||
_connected = YES;
|
||||
_receivers = @{};
|
||||
_sent = @{};
|
||||
_sentWithArray = @{};
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)send:(NSString*)method withParams:(NSDictionary*)params {
|
||||
- (void)sendInternal:(NSString*)method
|
||||
withParams:(id)params
|
||||
loggedTo:(NSDictionary* __strong*)sentLog {
|
||||
if (_connected) {
|
||||
NSMutableDictionary* newSent = [NSMutableDictionary new];
|
||||
[newSent addEntriesFromDictionary:_sent];
|
||||
if (newSent[method]) {
|
||||
newSent[method] = [_sent[method] arrayByAddingObject:params];
|
||||
NSMutableDictionary* newSentLog = [NSMutableDictionary new];
|
||||
[newSentLog addEntriesFromDictionary:*sentLog];
|
||||
if (newSentLog[method]) {
|
||||
newSentLog[method] = [(*sentLog)[method] arrayByAddingObject:params];
|
||||
} else {
|
||||
newSent[method] = @[ params ];
|
||||
newSentLog[method] = @[ params ];
|
||||
}
|
||||
_sent = newSent;
|
||||
*sentLog = newSentLog;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)send:(NSString*)method withParams:(NSDictionary*)params {
|
||||
[self sendInternal:method withParams:params loggedTo:&_sent];
|
||||
}
|
||||
|
||||
- (void)send:(NSString*)method withArrayParams:(NSArray*)params {
|
||||
[self sendInternal:method withParams:params loggedTo:&_sentWithArray];
|
||||
}
|
||||
|
||||
- (void)receive:(NSString*)method withBlock:(SonarReceiver)receiver {
|
||||
if (_connected) {
|
||||
NSMutableDictionary* newReceivers = [NSMutableDictionary new];
|
||||
|
||||
Reference in New Issue
Block a user