From e9125b84bc974282fee6dbae2540a4cd5bcc64fd Mon Sep 17 00:00:00 2001 From: Ahmed alaa Date: Thu, 20 Mar 2025 23:37:13 +0200 Subject: [PATCH 1/4] fix: prevent not sending the unSent xhrRequest --- src/utils/XhrNetworkInterceptor.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/utils/XhrNetworkInterceptor.ts b/src/utils/XhrNetworkInterceptor.ts index 4443940362..615bf4f522 100644 --- a/src/utils/XhrNetworkInterceptor.ts +++ b/src/utils/XhrNetworkInterceptor.ts @@ -85,7 +85,7 @@ const getTraceparentHeader = async (networkData: NetworkData) => { }); }; -export const injectHeaders = async ( +export const injectHeaders = ( networkData: NetworkData, featureFlags: { isW3cExternalTraceIDEnabled: boolean; @@ -113,10 +113,7 @@ export const injectHeaders = async ( return injectionMethodology; }; -const identifyCaughtHeader = async ( - networkData: NetworkData, - isW3cCaughtHeaderEnabled: boolean, -) => { +const identifyCaughtHeader = (networkData: NetworkData, isW3cCaughtHeaderEnabled: boolean) => { if (isW3cCaughtHeaderEnabled) { networkData.w3cCaughtHeader = networkData.requestHeaders.traceparent; return networkData.requestHeaders.traceparent; @@ -314,7 +311,11 @@ export default { if (traceparent) { this.setRequestHeader('Traceparent', traceparent); } - originalXHRSend.apply(this, [data]); + if (this.readyState === this.UNSENT) { + return; // Prevent sending the request if not opened + } + + originalXHRSend.apply(this, [data]); // This line is essential }; isInterceptorEnabled = true; }, From d8059650913ccd28f5d0cd58cec4e262df82f303 Mon Sep 17 00:00:00 2001 From: Ahmed alaa Date: Thu, 20 Mar 2025 23:43:06 +0200 Subject: [PATCH 2/4] fix: prevent not sending the unSent xhrRequest --- src/utils/XhrNetworkInterceptor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/XhrNetworkInterceptor.ts b/src/utils/XhrNetworkInterceptor.ts index 615bf4f522..4eee6dd90c 100644 --- a/src/utils/XhrNetworkInterceptor.ts +++ b/src/utils/XhrNetworkInterceptor.ts @@ -315,7 +315,7 @@ export default { return; // Prevent sending the request if not opened } - originalXHRSend.apply(this, [data]); // This line is essential + originalXHRSend.apply(this, [data]); }; isInterceptorEnabled = true; }, From b2f3c21f11c865023219d150b84788aec1c2be69 Mon Sep 17 00:00:00 2001 From: kholood Date: Thu, 13 Mar 2025 13:55:10 +0200 Subject: [PATCH 3/4] fix:crash on non fatal --- ios/RNInstabug/InstabugCrashReportingBridge.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ios/RNInstabug/InstabugCrashReportingBridge.m b/ios/RNInstabug/InstabugCrashReportingBridge.m index c73a85d5bc..ed6c8921fa 100644 --- a/ios/RNInstabug/InstabugCrashReportingBridge.m +++ b/ios/RNInstabug/InstabugCrashReportingBridge.m @@ -40,6 +40,15 @@ + (BOOL)requiresMainQueueSetup userAttributes:(nullable NSDictionary *)userAttributes fingerprint:(nullable NSString *)fingerprint nonFatalExceptionLevel:(IBGNonFatalLevel)nonFatalExceptionLevel resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { + + if([fingerprint isKindOfClass:NSNull.class]){ + fingerprint = nil; + } + + if([userAttributes isKindOfClass:NSNull.class]){ + userAttributes = nil; + } + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(queue, ^{ [IBGCrashReporting cp_reportNonFatalCrashWithStackTrace:stackTrace level:nonFatalExceptionLevel groupingString:fingerprint userAttributes:userAttributes]; From e9fa1c34ad647a781f0994285610ab532a22ba2f Mon Sep 17 00:00:00 2001 From: kholood Date: Fri, 14 Mar 2025 16:39:26 +0200 Subject: [PATCH 4/4] chore: add ios custom build --- RNInstabug.podspec | 2 +- examples/default/ios/Podfile | 1 + examples/default/ios/Podfile.lock | 14 ++++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/RNInstabug.podspec b/RNInstabug.podspec index 40c480f4cb..21ae5fc720 100644 --- a/RNInstabug.podspec +++ b/RNInstabug.podspec @@ -16,5 +16,5 @@ Pod::Spec.new do |s| s.source_files = "ios/**/*.{h,m,mm}" s.dependency 'React-Core' - use_instabug!(s) + s.dependency 'Instabug' end diff --git a/examples/default/ios/Podfile b/examples/default/ios/Podfile index 3526171cd4..b452aeb739 100644 --- a/examples/default/ios/Podfile +++ b/examples/default/ios/Podfile @@ -15,6 +15,7 @@ target 'InstabugExample' do config = use_native_modules! rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path + pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/bug-INSD-13172_defensive_checks_for_cp_crash_reporting_apis/14.2.0/Instabug.podspec' # Flags change depending on the env values. flags = get_default_flags() diff --git a/examples/default/ios/Podfile.lock b/examples/default/ios/Podfile.lock index 6572db6072..3642aff1d9 100644 --- a/examples/default/ios/Podfile.lock +++ b/examples/default/ios/Podfile.lock @@ -31,7 +31,7 @@ PODS: - hermes-engine (0.75.4): - hermes-engine/Pre-built (= 0.75.4) - hermes-engine/Pre-built (0.75.4) - - Instabug (14.1.0) + - Instabug (14.2.0) - instabug-reactnative-ndk (0.1.0): - DoubleConversion - glog @@ -1624,7 +1624,7 @@ PODS: - ReactCommon/turbomodule/core - Yoga - RNInstabug (14.1.0): - - Instabug (= 14.1.0) + - Instabug - React-Core - RNReanimated (3.16.1): - DoubleConversion @@ -1768,6 +1768,7 @@ DEPENDENCIES: - fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) + - Instabug (from `https://ios-releases.instabug.com/custom/bug-INSD-13172_defensive_checks_for_cp_crash_reporting_apis/14.2.0/Instabug.podspec`) - instabug-reactnative-ndk (from `../node_modules/instabug-reactnative-ndk`) - OCMock - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) @@ -1847,7 +1848,6 @@ SPEC REPOS: trunk: - Google-Maps-iOS-Utils - GoogleMaps - - Instabug - OCMock - SocketRocket @@ -1865,6 +1865,8 @@ EXTERNAL SOURCES: hermes-engine: :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" :tag: hermes-2024-08-15-RNv0.75.1-4b3bf912cc0f705b51b71ce1a5b8bd79b93a451b + Instabug: + :podspec: https://ios-releases.instabug.com/custom/bug-INSD-13172_defensive_checks_for_cp_crash_reporting_apis/14.2.0/Instabug.podspec instabug-reactnative-ndk: :path: "../node_modules/instabug-reactnative-ndk" RCT-Folly: @@ -2017,7 +2019,7 @@ SPEC CHECKSUMS: Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0 - Instabug: 8cbca8974168c815658133e2813f5ac3a36f8e20 + Instabug: bbf4326971f2bfff4837ee21380294684edf434b instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641 OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74 RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740 @@ -2084,7 +2086,7 @@ SPEC CHECKSUMS: ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8 - RNInstabug: 96e629f47c0af2e9455fbcf800d12049f980d873 + RNInstabug: b77a5561ccf3806073944bc085a4e4b31f91d31d RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958 RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d @@ -2092,6 +2094,6 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 055f92ad73f8c8600a93f0e25ac0b2344c3b07e6 -PODFILE CHECKSUM: 63bf073bef3872df95ea45e7c9c023a331ebb3c3 +PODFILE CHECKSUM: d0f5dd57994563cb2f723e9f4877847ff62de5b2 COCOAPODS: 1.14.0