From 641146ef06866bf60c4d0c8b0f39ec40d6020150 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Thu, 30 Jan 2025 09:40:50 +0100 Subject: [PATCH 1/3] fix(ios): handle `isDebuggingRemotely` being removed in 0.79 --- ios/ReactTestApp/React+Compatibility.h | 2 ++ ios/ReactTestApp/React+Compatibility.m | 14 ++++++++++++++ ios/ReactTestApp/ReactInstance.swift | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ios/ReactTestApp/React+Compatibility.h b/ios/ReactTestApp/React+Compatibility.h index 28a35d74e..bce632689 100644 --- a/ios/ReactTestApp/React+Compatibility.h +++ b/ios/ReactTestApp/React+Compatibility.h @@ -4,6 +4,8 @@ NS_ASSUME_NONNULL_BEGIN NSURL *RTADefaultJSBundleURL(); +void RTADisableRemoteDebugging(); + IMP RTASwizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector); NS_ASSUME_NONNULL_END diff --git a/ios/ReactTestApp/React+Compatibility.m b/ios/ReactTestApp/React+Compatibility.m index dda8b5df0..7f55efdde 100644 --- a/ios/ReactTestApp/React+Compatibility.m +++ b/ios/ReactTestApp/React+Compatibility.m @@ -12,6 +12,10 @@ #define MAKE_VERSION(maj, min, patch) ((maj * 1000000) + (min * 1000) + patch) +#if REACT_NATIVE_VERSION < MAKE_VERSION(0, 79, 0) +#import +#endif + IMP RTASwizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector) { Method originalMethod = class_getInstanceMethod(class, originalSelector); @@ -33,6 +37,16 @@ IMP RTASwizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector) return originalImpl; } +// MARK: - [0.79.0] `isDebuggingRemotely` was removed +// See https://github.com/facebook/react-native/commit/9aae84a688b5af87faf4b68676b6357de26f797f + +void RTADisableRemoteDebugging() +{ +#if REACT_NATIVE_VERSION < MAKE_VERSION(0, 79, 0) + [[RCTDevSettings alloc] init].isDebuggingRemotely = NO; +#endif +} + // MARK: - [0.71.13] The additional `inlineSourceMap:` was added in 0.71.13 // See https://github.com/facebook/react-native/commit/f7219ec02d71d2f0f6c71af4d5c3d4850a898fd8 diff --git a/ios/ReactTestApp/ReactInstance.swift b/ios/ReactTestApp/ReactInstance.swift index 86ee798ea..9acd712c4 100644 --- a/ios/ReactTestApp/ReactInstance.swift +++ b/ios/ReactTestApp/ReactInstance.swift @@ -81,7 +81,7 @@ final class ReactInstance: NSObject, RNXHostConfig { // When loading the embedded bundle, we must disable remote // debugging to prevent the bridge from getting stuck in // -[RCTWebSocketExecutor executeApplicationScript:sourceURL:onComplete:] - RCTDevSettings().isDebuggingRemotely = false + RTADisableRemoteDebugging(); } RCTTriggerReloadCommandListeners("ReactTestApp") return From 65e2286aa7f25d4cd9094e7655f64cf14bc31fdf Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:04:38 +0100 Subject: [PATCH 2/3] fixup! fix(ios): handle `isDebuggingRemotely` being removed in 0.79 --- ios/ReactTestApp/ReactInstance.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/ReactTestApp/ReactInstance.swift b/ios/ReactTestApp/ReactInstance.swift index 9acd712c4..79eea48e0 100644 --- a/ios/ReactTestApp/ReactInstance.swift +++ b/ios/ReactTestApp/ReactInstance.swift @@ -81,7 +81,7 @@ final class ReactInstance: NSObject, RNXHostConfig { // When loading the embedded bundle, we must disable remote // debugging to prevent the bridge from getting stuck in // -[RCTWebSocketExecutor executeApplicationScript:sourceURL:onComplete:] - RTADisableRemoteDebugging(); + RTADisableRemoteDebugging() } RCTTriggerReloadCommandListeners("ReactTestApp") return From 6e35b554223946beefd8320c4d806e66050f077d Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:22:48 +0100 Subject: [PATCH 3/3] fixup! fix(ios): handle `isDebuggingRemotely` being removed in 0.79 --- android/app/src/main/AndroidManifest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ada54b6ff..f0e3634e6 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -21,8 +21,6 @@ android:usesCleartextTraffic="true" tools:targetApi="m" > - -