From fbfb251177b1c9ddc3c41b0956c00b82f99a67d9 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Tue, 4 Feb 2025 09:26:11 -0800 Subject: [PATCH] Enable profiling builds identification for iOS (#49137) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49137 # Changelog: [Internal] Similarly as D66501768, adding new `profiling` query parameter to inspector url for registering profiling fields. Reviewed By: huntie Differential Revision: D69057572 fbshipit-source-id: d11d88c7e5260d4ca405564d180d8a0edcb39596 --- .../DevSupport/RCTInspectorDevServerHelper.mm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm b/packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm index 1c69f263c63..a9aedcaddf8 100644 --- a/packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -100,6 +100,9 @@ static NSString *getInspectorDeviceId() static NSURL *getInspectorDeviceUrl(NSURL *bundleURL) { + auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance(); + BOOL isProfilingBuild = inspectorFlags.getIsProfilingBuild(); + NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] @@ -108,11 +111,13 @@ static NSURL *getInspectorDeviceUrl(NSURL *bundleURL) NSString *escapedInspectorDeviceId = [getInspectorDeviceId() stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; - return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@&device=%@", - getServerHost(bundleURL), - escapedDeviceName, - escapedAppName, - escapedInspectorDeviceId]]; + return [NSURL + URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@&device=%@&profiling=%@", + getServerHost(bundleURL), + escapedDeviceName, + escapedAppName, + escapedInspectorDeviceId, + isProfilingBuild ? @"true" : @"false"]]; } @implementation RCTInspectorDevServerHelper