Skip to content

Commit be14bf5

Browse files
committed
Merge remote-tracking branch 'origin/dev' into feat/support-expo-updates
2 parents f0293bb + 94b5e5b commit be14bf5

32 files changed

+568
-190
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44

55
### Added
66

7-
- Add support for xCode 16. ([#1370](https://github.com/Instabug/Instabug-React-Native/pull/1370))
87
- Add support for expo updates versioning ([#1391](https://github.com/Instabug/Instabug-React-Native/pull/1391))
98

9+
- Add support enable/disable screenshot auto masking. ([#1389](https://github.com/Instabug/Instabug-React-Native/pull/1389))
10+
11+
- Add support for BugReporting user consents. ([#1383](https://github.com/Instabug/Instabug-React-Native/pull/1383))
12+
13+
- Add support for xCode 16. ([#1370](https://github.com/Instabug/Instabug-React-Native/pull/1370))
14+
15+
### Fixed
16+
17+
- Not sending the inComplete xhrRequest. ([#1365](https://github.com/Instabug/Instabug-React-Native/pull/1365))
18+
19+
- Added more search capabilities to the find-token.sh script. e.g., searching in .env file for react config. [#1366](https://github.com/Instabug/Instabug-React-Native/pull/1366)
20+
1021
## [14.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...14.3.0)
1122

1223
### Added
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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.instabug.library.sessionreplay.model.SessionMetadata;
1919
import com.instabug.library.ui.onboarding.WelcomeMessage;
2020
import com.instabug.library.util.overairversion.OverAirVersionType;
21+
import com.instabug.library.MaskingType;
2122

2223
import java.util.ArrayList;
2324
import java.util.HashMap;
@@ -62,6 +63,8 @@ static Map<String, Object> getAll() {
6263
putAll(placeholders);
6364
putAll(launchType);
6465
putAll(overAirUpdateService);
66+
putAll(autoMaskingTypes);
67+
putAll(userConsentActionType);
6568
}};
6669
}
6770

@@ -144,6 +147,12 @@ static Map<String, Object> getAll() {
144147
put("reproStepsDisabled", ReproMode.Disable);
145148
}};
146149

150+
static final ArgsMap<String> userConsentActionType = new ArgsMap<String>() {{
151+
put("dropAutoCapturedMedia", com.instabug.bug.userConsent.ActionType.DROP_AUTO_CAPTURED_MEDIA);
152+
put("dropLogs", com.instabug.bug.userConsent.ActionType.DROP_LOGS);
153+
put("noChat", com.instabug.bug.userConsent.ActionType.NO_CHAT);
154+
}};
155+
147156
static final ArgsMap<Integer> sdkLogLevels = new ArgsMap<Integer>() {{
148157
put("sdkDebugLogsLevelNone", com.instabug.library.LogLevel.NONE);
149158
put("sdkDebugLogsLevelError", com.instabug.library.LogLevel.ERROR);
@@ -260,5 +269,10 @@ static Map<String, Object> getAll() {
260269
put(SessionMetadata.LaunchType.COLD,"cold");
261270
put(SessionMetadata.LaunchType.WARM,"warm" );
262271
}};
263-
272+
public static final ArgsMap<Integer> autoMaskingTypes = new ArgsMap<Integer>() {{
273+
put("labels", MaskingType.LABELS);
274+
put("textInputs", MaskingType.TEXT_INPUTS);
275+
put("media", MaskingType.MEDIA);
276+
put("none", MaskingType.MASK_NOTHING);
277+
}};
264278
}

0 commit comments

Comments
 (0)