Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'dev' into fit52/async-network-interceptor
# Conflicts: #	CHANGELOG.md #	android/build.gradle #	android/native.gradle #	android/src/main/java/com/instabug/reactlibrary/RNInstabugAPMModule.java #	android/src/test/java/com/instabug/reactlibrary/RNInstabugReactnativeModuleTest.java #	examples/default/ios/InstabugTests/InstabugSampleTests.m #	examples/default/ios/Podfile.lock #	examples/default/package.json #	examples/default/src/screens/apm/APMScreen.tsx #	examples/default/yarn.lock #	ios/native.rb #	package.json #	src/modules/NetworkLogger.ts #	src/utils/XhrNetworkInterceptor.ts #	test/mocks/mockInstabug.ts #	test/modules/NetworkLogger.spec.ts
  • Loading branch information
ahmedAlaaInstabug committed May 20, 2025
commit e1663a4d1d42b1c6b886bad028068a668c53a89c
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Changelog

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

## Fixed
### Added

- Add support for BugReporting user consents. ([#1383](https://github.com/Instabug/Instabug-React-Native/pull/1383))

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

### Added

- Add support for enable/disable capturing network body. ([#1362](https://github.com/Instabug/Instabug-React-Native/pull/1362))

### Changed

- Intercept incomplete network Requests ([#1365](https://github.com/Instabug/Instabug-React-Native/pull/1365))
- Bump Instabug iOS SDK to v14.3.0 ([#1367](https://github.com/Instabug/Instabug-React-Native/pull/1367)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/14.3.0).

- Bump Instabug Android SDK to v14.3.0 ([#1375](https://github.com/Instabug/Instabug-React-Native/pull/1375)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.3.0).

## [14.1.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.0.0...v14.1.0) (January 2, 2025)

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ android {
minSdkVersion getExtOrDefault('minSdkVersion').toInteger()
targetSdkVersion getExtOrDefault('targetSdkVersion').toInteger()
versionCode 1
versionName "14.1.0"
versionName "14.3.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
Expand Down
2 changes: 1 addition & 1 deletion android/native.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project.ext.instabug = [
version: '14.1.0'
version: '14.3.0.6752106-SNAPSHOT'
]

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,14 @@
import com.facebook.react.bridge.ReadableMap;
import com.instabug.apm.APM;
import com.instabug.apm.model.ExecutionTrace;
import com.instabug.apm.networking.APMNetworkLogger;
import com.instabug.apm.networkinterception.cp.APMCPNetworkLog;
import com.instabug.apm.networking.ApmNetworkLoggerHelper;
import com.instabug.reactlibrary.utils.EventEmitterModule;
import com.instabug.apm.networkinterception.cp.APMCPNetworkLog;
import com.instabug.reactlibrary.utils.MainThreadHandler;

import java.lang.reflect.Method;

import java.util.HashMap;

import javax.annotation.Nonnull;

import static com.instabug.reactlibrary.utils.InstabugUtil.getMethod;

public class RNInstabugAPMModule extends EventEmitterModule {

public RNInstabugAPMModule(ReactApplicationContext reactApplicationContext) {
Expand Down Expand Up @@ -399,69 +393,25 @@ private void networkLogAndroid(final double requestStartTime,
@Nullable final ReadableMap w3cAttributes,
@Nullable final String gqlQueryName,
@Nullable final String serverErrorMessage
) {
try {
APMNetworkLogger networkLogger = new APMNetworkLogger();

final boolean hasError = errorDomain != null && !errorDomain.isEmpty();
final String errorMessage = hasError ? errorDomain : null;
Boolean isW3cHeaderFound=false;
Long partialId=null;
Long networkStartTimeInSeconds=null;


try {
if (!w3cAttributes.isNull("isW3cHeaderFound")) {
isW3cHeaderFound = w3cAttributes.getBoolean("isW3cHeaderFound");
}

if (!w3cAttributes.isNull("partialId")) {
partialId =(long) w3cAttributes.getDouble("partialId");
networkStartTimeInSeconds = (long) w3cAttributes.getDouble("networkStartTimeInSeconds");
}

} catch (Exception e) {
e.printStackTrace();
}
APMCPNetworkLog.W3CExternalTraceAttributes w3cExternalTraceAttributes =
new APMCPNetworkLog.W3CExternalTraceAttributes(
isW3cHeaderFound,
partialId,
networkStartTimeInSeconds,
w3cAttributes.getString("w3cGeneratedHeader"),
w3cAttributes.getString("w3cCaughtHeader")
);
try {
Method method = getMethod(Class.forName("com.instabug.apm.networking.APMNetworkLogger"), "log", long.class, long.class, String.class, String.class, long.class, String.class, String.class, String.class, String.class, String.class, long.class, int.class, String.class, String.class, String.class, String.class, APMCPNetworkLog.W3CExternalTraceAttributes.class);
if (method != null) {
method.invoke(
networkLogger,
(long) requestStartTime * 1000,
(long) requestDuration,
requestHeaders,
requestBody,
(long) requestBodySize,
requestMethod,
requestUrl,
requestContentType,
responseHeaders,
responseBody,
(long)responseBodySize,
(int) statusCode,
responseContentType,
errorMessage,
gqlQueryName,
serverErrorMessage,
w3cExternalTraceAttributes
);
} else {
Log.e("IB-CP-Bridge", "APMNetworkLogger.log was not found by reflection");
}
} catch (Throwable e) {
e.printStackTrace();
}
} catch(Throwable e) {
e.printStackTrace();
}
) {
ApmNetworkLoggerHelper.log(
requestStartTime,
requestDuration,
requestHeaders,
requestBody,
requestBodySize,
requestMethod,
requestUrl,
requestContentType,
responseHeaders,
responseBody,
responseBodySize,
statusCode,
responseContentType,
errorDomain,
w3cAttributes,
gqlQueryName,
serverErrorMessage
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -662,4 +662,19 @@ public void testW3CCaughtHeaderFlag(){
boolean expected=internalAPM._isFeatureEnabled(CoreFeature.W3C_ATTACHING_CAPTURED_HEADER);
verify(promise).resolve(expected);
}


@Test
public void testSetNetworkLogBodyEnabled() {
rnModule.setNetworkLogBodyEnabled(true);

mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(true));
}

@Test
public void testSetNetworkLogBodyDisabled() {
rnModule.setNetworkLogBodyEnabled(false);

mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(false));
}
}
9 changes: 9 additions & 0 deletions examples/default/ios/InstabugTests/InstabugSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -609,4 +609,13 @@ - (void) testIsW3CaughtHeaderEnabled {
}


- (void)testSetNetworkLogBodyEnabled {
id mock = OCMClassMock([IBGNetworkLogger class]);
BOOL isEnabled = YES;

OCMStub([mock setLogBodyEnabled:isEnabled]);
[self.instabugBridge setNetworkLogBodyEnabled:isEnabled];
OCMVerify([mock setLogBodyEnabled:isEnabled]);
}

@end
14 changes: 7 additions & 7 deletions examples/default/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.0)
- instabug-reactnative-ndk (0.1.0):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1319,7 +1319,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-webview (13.12.3):
- react-native-webview (13.13.2):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1623,8 +1623,8 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNInstabug (14.1.0):
- Instabug (= 14.1.0)
- RNInstabug (14.3.0):
- Instabug (= 14.3.0)
- React-Core
- RNReanimated (3.16.1):
- DoubleConversion
Expand Down Expand Up @@ -2017,7 +2017,7 @@ SPEC CHECKSUMS:
Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a
GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac
hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0
Instabug: 8cbca8974168c815658133e2813f5ac3a36f8e20
Instabug: 97a4e694731f46bbc02dbe49ab29cc552c5e2f41
instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641
OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
Expand Down Expand Up @@ -2055,7 +2055,7 @@ SPEC CHECKSUMS:
react-native-maps: 72a8a903f8a1b53e2c777ba79102078ab502e0bf
react-native-safe-area-context: 142fade490cbebbe428640b8cbdb09daf17e8191
react-native-slider: 4a0f3386a38fc3d2d955efc515aef7096f7d1ee4
react-native-webview: 926d2665cf3196e39c4449a72d136d0a53b9df8a
react-native-webview: c0b91a4598bd54e9fbc70353aebf1e9bab2e5bb9
React-nativeconfig: 8c83d992b9cc7d75b5abe262069eaeea4349f794
React-NativeModulesApple: 9f7920224a3b0c7d04d77990067ded14cee3c614
React-perflogger: 59e1a3182dca2cee7b9f1f7aab204018d46d1914
Expand Down Expand Up @@ -2084,7 +2084,7 @@ SPEC CHECKSUMS:
ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad
RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb
RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8
RNInstabug: 96e629f47c0af2e9455fbcf800d12049f980d873
RNInstabug: c55b6c697b39d3cbe51b1ab9b729f0b55ed619f1
RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb
RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958
RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d
Expand Down
2 changes: 1 addition & 1 deletion examples/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"react-native-screens": "^3.35.0",
"react-native-svg": "^15.8.0",
"react-native-vector-icons": "^10.2.0",
"react-native-webview": "^13.12.3",
"react-native-webview": "^13.13.2",
"react-query": "^3.39.3"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/default/src/screens/apm/APMScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const APMScreen: React.FC<NativeStackScreenProps<HomeStackParamList, 'APM
<ListTile title="Traces" onPress={() => navigation.navigate('ExecutionTraces')} />
<ListTile title="Flows" onPress={() => navigation.navigate('AppFlows')} />
<ListTile title="WebViews" onPress={() => navigation.navigate('WebViews')} />
<ListTile title="Complex Views" onPress={() => navigation.navigate('ComplexViews')} />
</Screen>
);
};
13 changes: 4 additions & 9 deletions examples/default/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2041,11 +2041,6 @@
prompts "^2.4.2"
semver "^7.5.2"

"@react-native-community/netinfo@^11.4.1":
version "11.4.1"
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-11.4.1.tgz#a3c247aceab35f75dd0aa4bfa85d2be5a4508688"
integrity sha512-B0BYAkghz3Q2V09BF88RA601XursIEA111tnc2JOaN7axJWmNefmfjZqw/KdSxKZp7CZUuPpjBmz/WCR9uaHYg==

"@react-native-community/slider@^4.5.5":
version "4.5.5"
resolved "https://registry.yarnpkg.com/@react-native-community/slider/-/slider-4.5.5.tgz#d70fc5870477760033769bbd6625d57e7d7678b2"
Expand Down Expand Up @@ -6334,10 +6329,10 @@ react-native-vector-icons@^10.2.0:
prop-types "^15.7.2"
yargs "^16.1.1"

react-native-webview@^13.12.3:
version "13.12.3"
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-13.12.3.tgz#3aa9d2fc982ba2681e56d3e96e22b63a0d929270"
integrity sha512-Y1I5YyDYyE7NC96RHLhd2nxh7ymLYOYLTefgx5ixxw2OToQK0ow3OJ+o77QcI1Tuevj5PCxwqC/14ceS/7yPJQ==
react-native-webview@^13.13.2:
version "13.13.2"
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-13.13.2.tgz#6d72fd8492f11accbcf3be4d1386fa961e424357"
integrity sha512-zACPDTF0WnaEnKZ9mA/r/UpcOpV2gQM06AAIrOOexnO8UJvXL8Pjso0b/wTqKFxUZZnmjKuwd8gHVUosVOdVrw==
dependencies:
escape-string-regexp "^4.0.0"
invariant "2.2.4"
Expand Down
2 changes: 1 addition & 1 deletion ios/native.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$instabug = { :version => '14.1.0' }
$instabug = { :version => '14.3.0' }

def use_instabug! (spec = nil)
version = $instabug[:version]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "instabug-reactnative",
"description": "React Native plugin for integrating the Instabug SDK",
"version": "14.1.0",
"version": "14.3.0",
"author": "Instabug (https://instabug.com)",
"repository": "github:Instabug/Instabug-React-Native",
"homepage": "https://www.instabug.com/platforms/react-native",
Expand Down
1 change: 1 addition & 0 deletions src/modules/NetworkLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import xhr, { NetworkData, ProgressCallback } from '../utils/XhrNetworkIntercept
import { isContentTypeNotAllowed, reportNetworkLog } from '../utils/InstabugUtils';
import { InstabugRNConfig } from '../utils/config';
import { Logger } from '../utils/logger';
import { NativeInstabug } from '../native/NativeInstabug';

export type { NetworkData };

Expand Down
1 change: 1 addition & 0 deletions test/mocks/mockInstabug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const mockInstabug: InstabugNativeModule = {
isW3ExternalGeneratedHeaderEnabled: jest.fn(),
isW3CaughtHeaderEnabled: jest.fn(),
registerW3CFlagsChangeListener: jest.fn(),
setNetworkLogBodyEnabled: jest.fn(),
};

export default mockInstabug;
1 change: 1 addition & 0 deletions test/modules/NetworkLogger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Interceptor from '../../src/utils/XhrNetworkInterceptor';
import { isContentTypeNotAllowed, reportNetworkLog } from '../../src/utils/InstabugUtils';
import InstabugConstants from '../../src/utils/InstabugConstants';
import { Logger } from '../../src/utils/logger';
import { NativeInstabug } from '../../src/native/NativeInstabug';

const clone = <T>(obj: T): T => {
return JSON.parse(JSON.stringify(obj));
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.