Skip to content

Commit 7bbd601

Browse files
Merge remote-tracking branch 'origin/dev' into feat/dev-into-network-spans
# Conflicts: # android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java # src/modules/NetworkLogger.ts # test/mocks/mockInstabug.ts # test/modules/NetworkLogger.spec.ts
2 parents 6a2d4c4 + 29db04b commit 7bbd601

File tree

14 files changed

+89
-6
lines changed

14 files changed

+89
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...dev)
2+
3+
### Added
4+
5+
- Add support for enable/disable capturing network body. ([#1362](https://github.com/Instabug/Instabug-React-Native/pull/1362))
6+
17
# Changelog
28

39
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...dev)

RNInstabug.podspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ Pod::Spec.new do |s|
1616
s.source_files = "ios/**/*.{h,m,mm}"
1717

1818
s.dependency 'React-Core'
19-
use_instabug!(s)
19+
# use_instabug!(s)
20+
s.dependency 'Instabug'
21+
2022
end

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,4 +1313,21 @@ public void invoke() {
13131313
}
13141314
});
13151315
}
1316+
/**
1317+
* Enables or disables capturing network body.
1318+
* @param isEnabled A boolean to enable/disable capturing network body.
1319+
*/
1320+
@ReactMethod
1321+
public void setNetworkLogBodyEnabled(final boolean isEnabled) {
1322+
MainThreadHandler.runOnMainThread(new Runnable() {
1323+
@Override
1324+
public void run() {
1325+
try {
1326+
Instabug.setNetworkLogBodyEnabled(isEnabled);
1327+
} catch (Exception e) {
1328+
e.printStackTrace();
1329+
}
1330+
}
1331+
});
1332+
}
13161333
}

android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,4 +676,18 @@ public void testEnableAutoMasking(){
676676

677677
mockInstabug.verify(() -> Instabug.setAutoMaskScreenshotsTypes(MaskingType.LABELS,MaskingType.MEDIA,MaskingType.TEXT_INPUTS,MaskingType.MASK_NOTHING));
678678
}
679+
680+
@Test
681+
public void testSetNetworkLogBodyEnabled() {
682+
rnModule.setNetworkLogBodyEnabled(true);
683+
684+
mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(true));
685+
}
686+
687+
@Test
688+
public void testSetNetworkLogBodyDisabled() {
689+
rnModule.setNetworkLogBodyEnabled(false);
690+
691+
mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(false));
692+
}
679693
}

examples/default/ios/InstabugTests/InstabugSampleTests.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,4 +625,13 @@ - (void)testEnableAutoMasking {
625625
OCMVerify([mock setAutoMaskScreenshots:IBGAutoMaskScreenshotOptionLabels | IBGAutoMaskScreenshotOptionTextInputs | IBGAutoMaskScreenshotOptionMedia | IBGAutoMaskScreenshotOptionMaskNothing]);
626626
}
627627

628+
- (void)testSetNetworkLogBodyEnabled {
629+
id mock = OCMClassMock([IBGNetworkLogger class]);
630+
BOOL isEnabled = YES;
631+
632+
OCMStub([mock setLogBodyEnabled:isEnabled]);
633+
[self.instabugBridge setNetworkLogBodyEnabled:isEnabled];
634+
OCMVerify([mock setLogBodyEnabled:isEnabled]);
635+
}
636+
628637
@end

examples/default/ios/Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target 'InstabugExample' do
1515
config = use_native_modules!
1616
rn_maps_path = '../node_modules/react-native-maps'
1717
pod 'react-native-google-maps', :path => rn_maps_path
18+
pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-support_cp_network_filtering_obfuscation-base/14.3.0/Instabug.podspec'
1819
# Flags change depending on the env values.
1920
flags = get_default_flags()
2021

examples/default/ios/Podfile.lock

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ PODS:
16241624
- ReactCommon/turbomodule/core
16251625
- Yoga
16261626
- RNInstabug (14.1.0):
1627-
- Instabug (= 14.3.0)
1627+
- Instabug
16281628
- React-Core
16291629
- RNReanimated (3.16.1):
16301630
- DoubleConversion
@@ -1768,6 +1768,7 @@ DEPENDENCIES:
17681768
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
17691769
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
17701770
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
1771+
- Instabug (from `https://ios-releases.instabug.com/custom/feature-support_cp_network_filtering_obfuscation-base/14.3.0/Instabug.podspec`)
17711772
- instabug-reactnative-ndk (from `../node_modules/instabug-reactnative-ndk`)
17721773
- OCMock
17731774
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
@@ -1847,7 +1848,6 @@ SPEC REPOS:
18471848
trunk:
18481849
- Google-Maps-iOS-Utils
18491850
- GoogleMaps
1850-
- Instabug
18511851
- OCMock
18521852
- SocketRocket
18531853

@@ -1865,6 +1865,8 @@ EXTERNAL SOURCES:
18651865
hermes-engine:
18661866
:podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
18671867
:tag: hermes-2024-08-15-RNv0.75.1-4b3bf912cc0f705b51b71ce1a5b8bd79b93a451b
1868+
Instabug:
1869+
:podspec: https://ios-releases.instabug.com/custom/feature-support_cp_network_filtering_obfuscation-base/14.3.0/Instabug.podspec
18681870
instabug-reactnative-ndk:
18691871
:path: "../node_modules/instabug-reactnative-ndk"
18701872
RCT-Folly:
@@ -2017,7 +2019,7 @@ SPEC CHECKSUMS:
20172019
Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a
20182020
GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac
20192021
hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0
2020-
Instabug: 97a4e694731f46bbc02dbe49ab29cc552c5e2f41
2022+
Instabug: 56c200f9af7772dd57b30b8d1aad605980cc4c71
20212023
instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641
20222024
OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74
20232025
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
@@ -2084,14 +2086,14 @@ SPEC CHECKSUMS:
20842086
ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad
20852087
RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb
20862088
RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8
2087-
RNInstabug: 4e49b8da38b1f6a0fdeca226cec844d553c8d785
2089+
RNInstabug: b77a5561ccf3806073944bc085a4e4b31f91d31d
20882090
RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb
20892091
RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958
20902092
RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d
20912093
RNVectorIcons: 6382277afab3c54658e9d555ee0faa7a37827136
20922094
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
20932095
Yoga: 055f92ad73f8c8600a93f0e25ac0b2344c3b07e6
20942096

2095-
PODFILE CHECKSUM: 63bf073bef3872df95ea45e7c9c023a331ebb3c3
2097+
PODFILE CHECKSUM: 7d44257b7d13c9b09806f318160658af940e8e2a
20962098

20972099
COCOAPODS: 1.14.0

ios/RNInstabug/InstabugCrashReportingBridge.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ + (BOOL)requiresMainQueueSetup
2929
RCT_EXPORT_METHOD(sendJSCrash:(NSDictionary *)stackTrace
3030
resolver:(RCTPromiseResolveBlock)resolve
3131
rejecter:(RCTPromiseRejectBlock)reject) {
32+
3233
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul);
3334
dispatch_async(queue, ^{
3435
[IBGCrashReporting cp_reportFatalCrashWithStackTrace:stackTrace];
@@ -40,6 +41,14 @@ + (BOOL)requiresMainQueueSetup
4041
userAttributes:(nullable NSDictionary *)userAttributes fingerprint:(nullable NSString *)fingerprint nonFatalExceptionLevel:(IBGNonFatalLevel)nonFatalExceptionLevel
4142
resolver:(RCTPromiseResolveBlock)resolve
4243
rejecter:(RCTPromiseRejectBlock)reject) {
44+
45+
if([fingerprint isKindOfClass:NSNull.class]){
46+
fingerprint = nil;
47+
}
48+
49+
if([userAttributes isKindOfClass:NSNull.class]){
50+
userAttributes = nil;
51+
}
4352
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
4453
dispatch_async(queue, ^{
4554
[IBGCrashReporting cp_reportNonFatalCrashWithStackTrace:stackTrace level:nonFatalExceptionLevel groupingString:fingerprint userAttributes:userAttributes];

ios/RNInstabug/InstabugReactBridge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,6 @@ w3cExternalTraceAttributes:(NSDictionary * _Nullable)w3cExternalTraceAttributes;
139139
- (void)removeFeatureFlags:(NSArray *)featureFlags;
140140
- (void)removeAllFeatureFlags;
141141
- (void)enableAutoMasking:(NSArray *)autoMaskingTypes;
142+
- (void)setNetworkLogBodyEnabled:(BOOL)isEnabled;
142143

143144
@end

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,4 +451,7 @@ + (BOOL)iOSVersionIsLessThan:(NSString *)iOSVersion {
451451
[Instabug setAutoMaskScreenshots: autoMaskingOptions];
452452

453453
};
454+
RCT_EXPORT_METHOD(setNetworkLogBodyEnabled:(BOOL)isEnabled) {
455+
IBGNetworkLogger.logBodyEnabled = isEnabled;
456+
}
454457
@end

0 commit comments

Comments
 (0)