forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new HostTargetMetadata fields (iOS) (facebook#44893)
Summary: Pull Request resolved: facebook#44893 Adds the following debugger metadata fields (sent over the `ReactNativeApplication.metadataUpdated` CDP event), and implements these on iOS (Bridge and Bridgeless). - `appIdentifier` - `deviceName` - `platform` - `reactNativeVersion` Changelog: [Internal] Reviewed By: robhogan Differential Revision: D58288489 fbshipit-source-id: 7105ad3b70d409bcd98b232154ebd6b7c827fb2b
- Loading branch information
1 parent
aced407
commit 14914bd
Showing
6 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/react-native/React/DevSupport/RCTInspectorUtils.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* 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> | ||
|
||
#import <string> | ||
|
||
struct CommonHostMetadata { | ||
std::string appIdentifier; | ||
std::string deviceName; | ||
std::string platform; | ||
std::string reactNativeVersion; | ||
}; | ||
|
||
@interface RCTInspectorUtils : NSObject | ||
|
||
+ (CommonHostMetadata)getHostMetadata; | ||
|
||
@end |
42 changes: 42 additions & 0 deletions
42
packages/react-native/React/DevSupport/RCTInspectorUtils.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import "RCTInspectorUtils.h" | ||
|
||
#import <React/RCTConstants.h> | ||
#import <React/RCTVersion.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@implementation RCTInspectorUtils | ||
|
||
+ (CommonHostMetadata)getHostMetadata | ||
{ | ||
UIDevice *device = [UIDevice currentDevice]; | ||
|
||
NSString *appIdentifier = [[NSBundle mainBundle] bundleIdentifier]; | ||
NSString *platform = RCTPlatformName; | ||
NSString *deviceName = [device name]; | ||
|
||
auto version = RCTGetReactNativeVersion(); | ||
NSString *reactNativeVersion = | ||
[NSString stringWithFormat:@"%i.%i.%i%@", | ||
[version[@"minor"] intValue], | ||
[version[@"major"] intValue], | ||
[version[@"patch"] intValue], | ||
[version[@"prerelease"] isKindOfClass:[NSNull class]] | ||
? @"" | ||
: [@"-" stringByAppendingString:[version[@"prerelease"] stringValue]]]; | ||
|
||
return { | ||
.appIdentifier = [appIdentifier UTF8String], | ||
.platform = [platform UTF8String], | ||
.deviceName = [deviceName UTF8String], | ||
.reactNativeVersion = [reactNativeVersion UTF8String], | ||
}; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters