Add metadata.customAttributes field

Summary:
`customAttributes` will be used by the UI Debugger to pass styleID for Bloks model attributes.
(replicating corresponding [Android implementation](https://www.internalfb.com/code/fbsource/[33c33fa7f582]/xplat/sonar/android/src/facebook/java/com/facebook/flipper/uidebugger/bloks/descriptors/BloksDebugComponentDescriptor.kt?lines=138-139%2C170-171))

Reviewed By: antonk52

Differential Revision: D47494013

fbshipit-source-id: 257387d4af94235b23d636047326532d7071e8dd
This commit is contained in:
Ivan Misuno
2023-07-21 14:32:22 -07:00
committed by Facebook GitHub Bot
parent b22ac16c3c
commit 1753581028
5 changed files with 74 additions and 57 deletions

View File

@@ -7,6 +7,7 @@
#if FB_SONARKIT_ENABLED
#import "NSDictionary+Foundation.h"
#import "NSSet+Foundation.h"
#import "UIDMetadata+Foundation.h"
@@ -14,12 +15,20 @@ FB_LINKABLE(UIDMetadata_Foundation)
@implementation UIDMetadata (Foundation)
- (id)toFoundation {
return @{
NSMutableDictionary* result = [NSMutableDictionary dictionary];
[result addEntriesFromDictionary:@{
@"id" : self.identifier,
@"type" : self.type,
@"name" : self.name,
@"mutable" : [NSNumber numberWithBool:self.isMutable],
};
}];
if (self.customAttributes != nil) {
result[@"customAttributes"] = [self.customAttributes toFoundation];
}
return [result copy];
}
@end