Skip to content

Commit e1663a4

Browse files
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
2 parents a467f2e + 457f7e8 commit e1663a4

39 files changed

+525
-122
lines changed

CHANGELOG.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# Changelog
22

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

5-
## Fixed
5+
### Added
6+
7+
- Add support for BugReporting user consents. ([#1383](https://github.com/Instabug/Instabug-React-Native/pull/1383))
8+
9+
## [14.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...14.3.0)
10+
11+
### Added
12+
13+
- Add support for enable/disable capturing network body. ([#1362](https://github.com/Instabug/Instabug-React-Native/pull/1362))
14+
15+
### Changed
616

7-
- Intercept incomplete network Requests ([#1365](https://github.com/Instabug/Instabug-React-Native/pull/1365))
17+
- 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).
818

19+
- 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).
920

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

RNInstabug.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ Pod::Spec.new do |s|
1717

1818
s.dependency 'React-Core'
1919
use_instabug!(s)
20+
2021
end

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ android {
5757
minSdkVersion getExtOrDefault('minSdkVersion').toInteger()
5858
targetSdkVersion getExtOrDefault('targetSdkVersion').toInteger()
5959
versionCode 1
60-
versionName "14.1.0"
60+
versionName "14.3.0"
6161
multiDexEnabled true
6262
ndk {
6363
abiFilters "armeabi-v7a", "x86"

android/native.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project.ext.instabug = [
2-
version: '14.1.0'
2+
version: '14.3.0.6752106-SNAPSHOT'
33
]
44

55
dependencies {
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package com.instabug.apm.networking;
2+
3+
import androidx.annotation.Nullable;
4+
5+
import com.facebook.react.bridge.ReadableMap;
6+
import com.instabug.apm.networking.mapping.NetworkRequestAttributes;
7+
import com.instabug.apm.networkinterception.cp.APMCPNetworkLog;
8+
9+
public class ApmNetworkLoggerHelper {
10+
11+
/// Log network request to the Android SDK using a package private API [APMNetworkLogger.log]
12+
static public void log(final double requestStartTime,
13+
final double requestDuration,
14+
final String requestHeaders,
15+
final String requestBody,
16+
final double requestBodySize,
17+
final String requestMethod,
18+
final String requestUrl,
19+
final String requestContentType,
20+
final String responseHeaders,
21+
final String responseBody,
22+
final double responseBodySize,
23+
final double statusCode,
24+
final String responseContentType,
25+
@Nullable final String errorDomain,
26+
@Nullable final ReadableMap w3cAttributes,
27+
@Nullable final String gqlQueryName,
28+
@Nullable final String serverErrorMessage
29+
) {
30+
try {
31+
final APMNetworkLogger apmNetworkLogger = new APMNetworkLogger();
32+
final boolean hasError = errorDomain != null && !errorDomain.isEmpty();
33+
final String errorMessage = hasError ? errorDomain : null;
34+
boolean isW3cHeaderFound = false;
35+
Long partialId = null;
36+
Long networkStartTimeInSeconds = null;
37+
38+
39+
try {
40+
if (!w3cAttributes.isNull("isW3cHeaderFound")) {
41+
isW3cHeaderFound = w3cAttributes.getBoolean("isW3cHeaderFound");
42+
}
43+
44+
if (!w3cAttributes.isNull("partialId")) {
45+
partialId = (long) w3cAttributes.getDouble("partialId");
46+
networkStartTimeInSeconds = (long) w3cAttributes.getDouble("networkStartTimeInSeconds");
47+
}
48+
49+
} catch (Exception e) {
50+
e.printStackTrace();
51+
}
52+
APMCPNetworkLog.W3CExternalTraceAttributes w3cExternalTraceAttributes =
53+
new APMCPNetworkLog.W3CExternalTraceAttributes(
54+
isW3cHeaderFound,
55+
partialId,
56+
networkStartTimeInSeconds,
57+
w3cAttributes.getString("w3cGeneratedHeader"),
58+
w3cAttributes.getString("w3cCaughtHeader")
59+
);
60+
NetworkRequestAttributes requestAttributes = new NetworkRequestAttributes(
61+
(long) requestStartTime * 1000,
62+
(long) requestDuration,
63+
requestHeaders,
64+
requestBody,
65+
(long) requestBodySize,
66+
requestMethod,
67+
requestUrl,
68+
requestContentType,
69+
responseHeaders,
70+
responseBody,
71+
(long) responseBodySize,
72+
(int) statusCode,
73+
responseContentType,
74+
gqlQueryName,
75+
errorMessage,
76+
serverErrorMessage
77+
);
78+
79+
apmNetworkLogger.log(
80+
requestAttributes,
81+
w3cExternalTraceAttributes
82+
);
83+
} catch (Throwable e) {
84+
e.printStackTrace();
85+
}
86+
87+
}
88+
89+
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static Map<String, Object> getAll() {
6060
putAll(locales);
6161
putAll(placeholders);
6262
putAll(launchType);
63+
putAll(userConsentActionType);
6364
}};
6465
}
6566

@@ -142,6 +143,12 @@ static Map<String, Object> getAll() {
142143
put("reproStepsDisabled", ReproMode.Disable);
143144
}};
144145

146+
static final ArgsMap<String> userConsentActionType = new ArgsMap<String>() {{
147+
put("dropAutoCapturedMedia", com.instabug.bug.userConsent.ActionType.DROP_AUTO_CAPTURED_MEDIA);
148+
put("dropLogs", com.instabug.bug.userConsent.ActionType.DROP_LOGS);
149+
put("noChat", com.instabug.bug.userConsent.ActionType.NO_CHAT);
150+
}};
151+
145152
static final ArgsMap<Integer> sdkLogLevels = new ArgsMap<Integer>() {{
146153
put("sdkDebugLogsLevelNone", com.instabug.library.LogLevel.NONE);
147154
put("sdkDebugLogsLevelError", com.instabug.library.LogLevel.ERROR);

0 commit comments

Comments
 (0)