From 11e53947964d2b31bbb5ce42b9880b46664bd7c7 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Wed, 12 Jun 2024 11:30:13 -0700 Subject: [PATCH] Revert D58288489: Multisect successfully blamed "D58288489: [RN][Fusebox][iOS] Implement new HostTargetMetadata fields (iOS)" for one test failure (#44911) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44911 This diff reverts D58288489 D58288489: [RN][Fusebox][iOS] Implement new HostTargetMetadata fields (iOS) by huntie causes the following test failure: Tests affected: - [fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/jsinspector-modern:testsAndroid - main](https://www.internalfb.com/intern/test/844425054538351/) Here's the Multisect link: https://www.internalfb.com/multisect/5466028 Here are the tasks that are relevant to this breakage: T191385299: 50+ tests unhealthy for react_native The backout may land if someone accepts it. If this diff has been generated in error, you can Commandeer and Abandon it. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D58475289 fbshipit-source-id: 3a4476d1350c4986cdb673bdb4ac52af353a00ea --- packages/react-native/React/Base/RCTBridge.mm | 7 ---- .../React/DevSupport/RCTInspectorUtils.h | 23 ---------- .../React/DevSupport/RCTInspectorUtils.mm | 42 ------------------- .../jsinspector-modern/HostTarget.cpp | 4 -- .../jsinspector-modern/HostTarget.h | 7 +--- .../platform/ios/ReactCommon/RCTHost.mm | 7 ---- 6 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 packages/react-native/React/DevSupport/RCTInspectorUtils.h delete mode 100644 packages/react-native/React/DevSupport/RCTInspectorUtils.mm diff --git a/packages/react-native/React/Base/RCTBridge.mm b/packages/react-native/React/Base/RCTBridge.mm index 42b7590c7f878c..be1b40fe146c85 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -20,7 +20,6 @@ #import #import #import "RCTDevLoadingViewProtocol.h" -#import "RCTInspectorUtils.h" #import "RCTJSThread.h" #import "RCTLog.h" #import "RCTModuleData.h" @@ -200,14 +199,8 @@ void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled) facebook::react::jsinspector_modern::HostTargetMetadata getMetadata() override { - auto metadata = [RCTInspectorUtils getHostMetadata]; - return { - .appIdentifier = metadata.appIdentifier, - .deviceName = metadata.deviceName, .integrationName = "iOS Bridge (RCTBridge)", - .platform = metadata.platform, - .reactNativeVersion = metadata.reactNativeVersion, }; } diff --git a/packages/react-native/React/DevSupport/RCTInspectorUtils.h b/packages/react-native/React/DevSupport/RCTInspectorUtils.h deleted file mode 100644 index d4b14415876a53..00000000000000 --- a/packages/react-native/React/DevSupport/RCTInspectorUtils.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 - -#import - -struct CommonHostMetadata { - std::string appIdentifier; - std::string deviceName; - std::string platform; - std::string reactNativeVersion; -}; - -@interface RCTInspectorUtils : NSObject - -+ (CommonHostMetadata)getHostMetadata; - -@end diff --git a/packages/react-native/React/DevSupport/RCTInspectorUtils.mm b/packages/react-native/React/DevSupport/RCTInspectorUtils.mm deleted file mode 100644 index fd4821d19ea461..00000000000000 --- a/packages/react-native/React/DevSupport/RCTInspectorUtils.mm +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -#import -#import - -@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 diff --git a/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.cpp b/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.cpp index 7a74ccf36b1335..00810280c05eb5 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.cpp @@ -223,11 +223,7 @@ bool HostTargetController::decrementPauseOverlayCounter() { folly::dynamic hostMetadataToDynamic(const HostTargetMetadata& metadata) { folly::dynamic result = folly::dynamic::object; - result["appIdentifier"] = metadata.appIdentifier.value_or(nullptr); - result["deviceName"] = metadata.deviceName.value_or(nullptr); result["integrationName"] = metadata.integrationName.value_or(nullptr); - result["platform"] = metadata.platform.value_or(nullptr); - result["reactNativeVersion"] = metadata.reactNativeVersion.value_or(nullptr); return result; } diff --git a/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.h b/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.h index 6a56ea2407906e..9fb5ab26f3691d 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/HostTarget.h @@ -37,11 +37,7 @@ class HostCommandSender; class HostTarget; struct HostTargetMetadata { - std::optional appIdentifier; - std::optional deviceName; std::optional integrationName; - std::optional platform; - std::optional reactNativeVersion; }; /** @@ -94,8 +90,7 @@ class HostTargetDelegate { virtual ~HostTargetDelegate(); /** - * Returns a metadata object describing the host. This is called on an - * initial response to @cdp ReactNativeApplication.enable. + * Returns a metadata object describing the host. */ virtual HostTargetMetadata getMetadata() = 0; diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm index 8a93548b094ed1..8e0b105f2c54a7 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm @@ -13,7 +13,6 @@ #import #import #import -#import #import #import #import @@ -43,14 +42,8 @@ @interface RCTHost () jsinspector_modern::HostTargetMetadata getMetadata() override { - auto metadata = [RCTInspectorUtils getHostMetadata]; - return { - .appIdentifier = metadata.appIdentifier, - .deviceName = metadata.deviceName, .integrationName = "iOS Bridgeless (RCTHost)", - .platform = metadata.platform, - .reactNativeVersion = metadata.reactNativeVersion, }; }