Extra data send from iOS to Flipper Desktop
Summary: Added `extraInfo` for node descriptor for ios. Analogical to android node descriptor Reviewed By: cuva, Andrey-Mishanin Differential Revision: D23105947 fbshipit-source-id: f21541e97d79c0009815f94e733a056320324459
This commit is contained in:
committed by
Facebook GitHub Bot
parent
939ed27aad
commit
41f1a0b454
@@ -116,6 +116,20 @@ static std::vector<std::pair<NSString*, SKSubDescriptor>>& subDescriptors() {
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSArray<SKNamed<NSDictionary<NSString*, NSObject*>*>*>*)extraInfoForNode:
|
||||
(SKComponentLayoutWrapper*)node {
|
||||
NSMutableArray<SKNamed<NSDictionary<NSString*, NSObject*>*>*>* data =
|
||||
[NSMutableArray new];
|
||||
NSMutableDictionary<NSString*, NSObject*>* metaData =
|
||||
[[NSMutableDictionary alloc] init];
|
||||
|
||||
[metaData setObject:node.component.className forKey:@"className"];
|
||||
[metaData setObject:@"CK" forKey:@"framework"];
|
||||
|
||||
[data addObject:[SKNamed newWithName:@"metaData" withValue:metaData]];
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString*, NSObject*>*)propsForFlexboxChild:
|
||||
(CKFlexboxComponentChild)child {
|
||||
return @{
|
||||
|
||||
@@ -484,6 +484,7 @@
|
||||
|
||||
NSMutableArray* attributes = [NSMutableArray new];
|
||||
NSMutableDictionary* data = [NSMutableDictionary new];
|
||||
NSMutableDictionary* extraInfo = [NSMutableDictionary new];
|
||||
|
||||
const auto* nodeAttributes = [nodeDescriptor attributesForNode:node];
|
||||
for (const SKNamed<NSString*>* namedPair in nodeAttributes) {
|
||||
@@ -502,6 +503,11 @@
|
||||
data[namedPair.name] = namedPair.value;
|
||||
}
|
||||
|
||||
const auto* nodeExtraInfo = [nodeDescriptor extraInfoForNode:node];
|
||||
for (const SKNamed<NSDictionary*>* namedPair in nodeExtraInfo) {
|
||||
extraInfo[namedPair.name] = namedPair.value;
|
||||
}
|
||||
|
||||
NSMutableArray* children = [self getChildrenForNode:node
|
||||
withDescriptor:nodeDescriptor];
|
||||
|
||||
@@ -514,6 +520,7 @@
|
||||
@"attributes" : attributes,
|
||||
@"data" : data,
|
||||
@"decoration" : [nodeDescriptor decorationForNode:node] ?: @"(unknown)",
|
||||
@"extraInfo" : extraInfo,
|
||||
};
|
||||
|
||||
return nodeDic;
|
||||
|
||||
@@ -77,6 +77,12 @@ typedef void (^SKNodeUpdateData)(id value);
|
||||
*/
|
||||
- (NSArray<SKNamed<NSDictionary*>*>*)dataForNode:(T)node;
|
||||
|
||||
/**
|
||||
Get the extra info to pass it back to Sonar application without showing them in
|
||||
the sidebar.
|
||||
*/
|
||||
- (NSArray<SKNamed<NSDictionary*>*>*)extraInfoForNode:(T)node;
|
||||
|
||||
/**
|
||||
Get the attributes for this node. Attributes will be showed in the Sonar
|
||||
application right next to the name of the node.
|
||||
|
||||
@@ -59,6 +59,10 @@
|
||||
return @[];
|
||||
}
|
||||
|
||||
- (NSArray<SKNamed<NSDictionary*>*>*)extraInfoForNode:(id)node {
|
||||
return @[];
|
||||
}
|
||||
|
||||
- (NSArray<SKNamed<NSString*>*>*)attributesForNode:(id)node {
|
||||
return @[];
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"extraInfo" : @{},
|
||||
@"decoration" : @"",
|
||||
}]));
|
||||
}
|
||||
@@ -114,6 +115,7 @@
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"extraInfo" : @{},
|
||||
@"decoration" : @"",
|
||||
},
|
||||
@{
|
||||
@@ -122,6 +124,7 @@
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"extraInfo" : @{},
|
||||
@"decoration" : @"",
|
||||
},
|
||||
@{
|
||||
@@ -130,6 +133,7 @@
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"extraInfo" : @{},
|
||||
@"decoration" : @"",
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user