@sentry/react-native 6.0.0-rc.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +67 -66
- package/android/src/main/java/io/sentry/react/RNSentryMapConverter.java +110 -110
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +868 -813
- package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +128 -121
- package/android/src/main/java/io/sentry/react/RNSentryPackage.java +8 -14
- package/android/src/main/java/io/sentry/react/RNSentryReactFragmentLifecycleTracer.java +76 -70
- package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +29 -38
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +164 -165
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +164 -165
- package/dist/js/integrations/nativelinkederrors.js +7 -2
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +3 -1
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +37 -5
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +9 -1
- package/package.json +9 -9
- package/plugin/build/utils.js +6 -6
- package/plugin/build/withSentry.js +2 -2
- package/plugin/build/withSentryAndroid.js +2 -2
- package/plugin/build/withSentryIOS.js +3 -3
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,14 @@ _Bad software is everywhere, and we're tired of it. Sentry is on a mission to he
|
|
|
19
19
|
[](https://discord.gg/PXa5Apfe7K)
|
|
20
20
|
[](https://expo.dev/)
|
|
21
21
|
|
|
22
|
+
## Releases
|
|
23
|
+
|
|
24
|
+
This repo uses the following ways to release SDK updates:
|
|
25
|
+
|
|
26
|
+
- `Pre-release`: We create pre-releases (alpha, beta, RC,…) for larger and potentially more impactful changes, such as new features or major versions.
|
|
27
|
+
- `Latest`: We continuously release major/minor/hotfix versions from the `main` branch. These releases go through all our internal quality gates and are very safe to use and intended to be the default for most teams.
|
|
28
|
+
- `Stable`: We promote releases from `Latest` when they have been used in the field for some time and in scale, considering time since release, adoption, and other quality and stability metrics. These releases will be indicated on [the releases page](https://github.com/getsentry/sentry-react-native/releases/) with the `Stable` suffix.
|
|
29
|
+
|
|
22
30
|
## Requirements
|
|
23
31
|
|
|
24
32
|
- `react-native >= 0.65.0`
|
package/RNSentry.podspec
CHANGED
|
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
|
|
|
37
37
|
|
|
38
38
|
s.compiler_flags = other_cflags
|
|
39
39
|
|
|
40
|
-
s.dependency 'Sentry/HybridSDK', '8.
|
|
40
|
+
s.dependency 'Sentry/HybridSDK', '8.38.0'
|
|
41
41
|
|
|
42
42
|
if defined? install_modules_dependencies
|
|
43
43
|
# Default React Native dependencies for 0.71 and above (new and legacy architecture)
|
package/android/build.gradle
CHANGED
|
@@ -1,87 +1,88 @@
|
|
|
1
1
|
package io.sentry.react;
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReadableMap;
|
|
4
|
-
|
|
5
|
-
import org.jetbrains.annotations.NotNull;
|
|
6
|
-
import org.jetbrains.annotations.Nullable;
|
|
7
|
-
|
|
8
|
-
import java.util.Map;
|
|
9
|
-
|
|
10
4
|
import io.sentry.Breadcrumb;
|
|
11
5
|
import io.sentry.SentryLevel;
|
|
6
|
+
import java.util.Map;
|
|
7
|
+
import org.jetbrains.annotations.NotNull;
|
|
8
|
+
import org.jetbrains.annotations.Nullable;
|
|
12
9
|
|
|
13
|
-
public class RNSentryBreadcrumb {
|
|
10
|
+
public final class RNSentryBreadcrumb {
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (maybeCategory == null || !maybeCategory.equals("navigation")) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
12
|
+
private RNSentryBreadcrumb() {
|
|
13
|
+
throw new AssertionError("Utility class should not be instantiated");
|
|
14
|
+
}
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
@Nullable
|
|
17
|
+
public static String getCurrentScreenFrom(ReadableMap from) {
|
|
18
|
+
final @Nullable String maybeCategory =
|
|
19
|
+
from.hasKey("category") ? from.getString("category") : null;
|
|
20
|
+
if (maybeCategory == null || !"navigation".equals(maybeCategory)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} catch (Throwable exception) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
24
|
+
final @Nullable ReadableMap maybeData = from.hasKey("data") ? from.getMap("data") : null;
|
|
25
|
+
if (maybeData == null) {
|
|
26
|
+
return null;
|
|
33
27
|
}
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
try {
|
|
30
|
+
// getString might throw if cast to string fails (data.to is not enforced by TS to be a
|
|
31
|
+
// string)
|
|
32
|
+
return maybeData.hasKey("to") ? maybeData.getString("to") : null;
|
|
33
|
+
} catch (Throwable exception) { // NOPMD - We don't want to crash in any case
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
@NotNull
|
|
39
|
+
public static Breadcrumb fromMap(ReadableMap from) {
|
|
40
|
+
final @NotNull Breadcrumb breadcrumb = new Breadcrumb();
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
if (from.hasKey("message")) {
|
|
43
|
+
breadcrumb.setMessage(from.getString("message"));
|
|
44
|
+
}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
if (from.hasKey("type")) {
|
|
47
|
+
breadcrumb.setType(from.getString("type"));
|
|
48
|
+
}
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
breadcrumb.setLevel(SentryLevel.FATAL);
|
|
55
|
-
break;
|
|
56
|
-
case "warning":
|
|
57
|
-
breadcrumb.setLevel(SentryLevel.WARNING);
|
|
58
|
-
break;
|
|
59
|
-
case "debug":
|
|
60
|
-
breadcrumb.setLevel(SentryLevel.DEBUG);
|
|
61
|
-
break;
|
|
62
|
-
case "error":
|
|
63
|
-
breadcrumb.setLevel(SentryLevel.ERROR);
|
|
64
|
-
break;
|
|
65
|
-
case "info":
|
|
66
|
-
default:
|
|
67
|
-
breadcrumb.setLevel(SentryLevel.INFO);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
50
|
+
if (from.hasKey("category")) {
|
|
51
|
+
breadcrumb.setCategory(from.getString("category"));
|
|
52
|
+
}
|
|
71
53
|
|
|
54
|
+
if (from.hasKey("level")) {
|
|
55
|
+
switch (from.getString("level")) {
|
|
56
|
+
case "fatal":
|
|
57
|
+
breadcrumb.setLevel(SentryLevel.FATAL);
|
|
58
|
+
break;
|
|
59
|
+
case "warning":
|
|
60
|
+
breadcrumb.setLevel(SentryLevel.WARNING);
|
|
61
|
+
break;
|
|
62
|
+
case "debug":
|
|
63
|
+
breadcrumb.setLevel(SentryLevel.DEBUG);
|
|
64
|
+
break;
|
|
65
|
+
case "error":
|
|
66
|
+
breadcrumb.setLevel(SentryLevel.ERROR);
|
|
67
|
+
break;
|
|
68
|
+
case "info":
|
|
69
|
+
default:
|
|
70
|
+
breadcrumb.setLevel(SentryLevel.INFO);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
75
|
+
if (from.hasKey("data")) {
|
|
76
|
+
final ReadableMap data = from.getMap("data");
|
|
77
|
+
for (final Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
78
|
+
final Object value = entry.getValue();
|
|
79
|
+
// data is ConcurrentHashMap and can't have null values
|
|
80
|
+
if (value != null) {
|
|
81
|
+
breadcrumb.setData(entry.getKey(), entry.getValue());
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
return breadcrumb;
|
|
83
|
+
}
|
|
85
84
|
}
|
|
86
85
|
|
|
86
|
+
return breadcrumb;
|
|
87
|
+
}
|
|
87
88
|
}
|
|
@@ -5,130 +5,130 @@ import com.facebook.react.bridge.ReadableArray;
|
|
|
5
5
|
import com.facebook.react.bridge.ReadableMap;
|
|
6
6
|
import com.facebook.react.bridge.WritableArray;
|
|
7
7
|
import com.facebook.react.bridge.WritableMap;
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
8
|
+
import io.sentry.ILogger;
|
|
9
|
+
import io.sentry.SentryLevel;
|
|
10
|
+
import io.sentry.android.core.AndroidLogger;
|
|
11
11
|
import java.math.BigDecimal;
|
|
12
12
|
import java.math.BigInteger;
|
|
13
13
|
import java.util.List;
|
|
14
14
|
import java.util.Map;
|
|
15
|
+
import org.jetbrains.annotations.Nullable;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import io.sentry.android.core.AndroidLogger;
|
|
17
|
+
public final class RNSentryMapConverter {
|
|
18
|
+
public static final String NAME = "RNSentry.MapConverter";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
public static final String NAME = "RNSentry.MapConverter";
|
|
20
|
+
private static final ILogger logger = new AndroidLogger(NAME);
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
private RNSentryMapConverter() {
|
|
23
|
+
throw new AssertionError("Utility class should not be instantiated");
|
|
24
|
+
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
public static Object convertToWritable(@Nullable Object serialized) {
|
|
27
|
+
if (serialized instanceof List) {
|
|
28
|
+
WritableArray writable = Arguments.createArray();
|
|
29
|
+
for (Object item : (List<?>) serialized) {
|
|
30
|
+
addValueToWritableArray(writable, convertToWritable(item));
|
|
31
|
+
}
|
|
32
|
+
return writable;
|
|
33
|
+
} else if (serialized instanceof Map) {
|
|
34
|
+
WritableMap writable = Arguments.createMap();
|
|
35
|
+
for (Map.Entry<?, ?> entry : ((Map<?, ?>) serialized).entrySet()) {
|
|
36
|
+
Object key = entry.getKey();
|
|
37
|
+
Object value = entry.getValue();
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} else {
|
|
41
|
-
logger.log(SentryLevel.ERROR, "Only String keys are supported in Map.", key);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return writable;
|
|
45
|
-
} else if (serialized instanceof Byte) {
|
|
46
|
-
return Integer.valueOf((Byte) serialized);
|
|
47
|
-
} else if (serialized instanceof Short) {
|
|
48
|
-
return Integer.valueOf((Short) serialized);
|
|
49
|
-
} else if (serialized instanceof Float) {
|
|
50
|
-
return Double.valueOf((Float) serialized);
|
|
51
|
-
} else if (serialized instanceof Long) {
|
|
52
|
-
return Double.valueOf((Long) serialized);
|
|
53
|
-
} else if (serialized instanceof BigInteger) {
|
|
54
|
-
return ((BigInteger) serialized).doubleValue();
|
|
55
|
-
} else if (serialized instanceof BigDecimal) {
|
|
56
|
-
return ((BigDecimal) serialized).doubleValue();
|
|
57
|
-
} else if (serialized instanceof Integer
|
|
58
|
-
|| serialized instanceof Double
|
|
59
|
-
|| serialized instanceof Boolean
|
|
60
|
-
|| serialized == null
|
|
61
|
-
|| serialized instanceof String) {
|
|
62
|
-
return serialized;
|
|
39
|
+
if (key instanceof String) {
|
|
40
|
+
addValueToWritableMap(writable, (String) key, convertToWritable(value));
|
|
63
41
|
} else {
|
|
64
|
-
|
|
65
|
-
return null;
|
|
42
|
+
logger.log(SentryLevel.ERROR, "Only String keys are supported in Map.", key);
|
|
66
43
|
}
|
|
44
|
+
}
|
|
45
|
+
return writable;
|
|
46
|
+
} else if (serialized instanceof Byte) {
|
|
47
|
+
return Integer.valueOf((Byte) serialized);
|
|
48
|
+
} else if (serialized instanceof Short) {
|
|
49
|
+
return Integer.valueOf((Short) serialized);
|
|
50
|
+
} else if (serialized instanceof Float) {
|
|
51
|
+
return Double.valueOf((Float) serialized);
|
|
52
|
+
} else if (serialized instanceof Long) {
|
|
53
|
+
return Double.valueOf((Long) serialized);
|
|
54
|
+
} else if (serialized instanceof BigInteger) {
|
|
55
|
+
return ((BigInteger) serialized).doubleValue();
|
|
56
|
+
} else if (serialized instanceof BigDecimal) {
|
|
57
|
+
return ((BigDecimal) serialized).doubleValue();
|
|
58
|
+
} else if (serialized instanceof Integer
|
|
59
|
+
|| serialized instanceof Double
|
|
60
|
+
|| serialized instanceof Boolean
|
|
61
|
+
|| serialized == null
|
|
62
|
+
|| serialized instanceof String) {
|
|
63
|
+
return serialized;
|
|
64
|
+
} else {
|
|
65
|
+
logger.log(
|
|
66
|
+
SentryLevel.ERROR, "Supplied serialized value could not be converted." + serialized);
|
|
67
|
+
return null;
|
|
67
68
|
}
|
|
69
|
+
}
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"Could not convert object: " + value);
|
|
99
|
-
}
|
|
71
|
+
private static void addValueToWritableArray(WritableArray writableArray, Object value) {
|
|
72
|
+
if (value == null) {
|
|
73
|
+
writableArray.pushNull();
|
|
74
|
+
} else if (value instanceof Boolean) {
|
|
75
|
+
writableArray.pushBoolean((Boolean) value);
|
|
76
|
+
} else if (value instanceof Double) {
|
|
77
|
+
writableArray.pushDouble((Double) value);
|
|
78
|
+
} else if (value instanceof Float) {
|
|
79
|
+
writableArray.pushDouble(((Float) value).doubleValue());
|
|
80
|
+
} else if (value instanceof Integer) {
|
|
81
|
+
writableArray.pushInt((Integer) value);
|
|
82
|
+
} else if (value instanceof Short) {
|
|
83
|
+
writableArray.pushInt(((Short) value).intValue());
|
|
84
|
+
} else if (value instanceof Byte) {
|
|
85
|
+
writableArray.pushInt(((Byte) value).intValue());
|
|
86
|
+
} else if (value instanceof Long) {
|
|
87
|
+
writableArray.pushDouble(((Long) value).doubleValue());
|
|
88
|
+
} else if (value instanceof BigInteger) {
|
|
89
|
+
writableArray.pushDouble(((BigInteger) value).doubleValue());
|
|
90
|
+
} else if (value instanceof BigDecimal) {
|
|
91
|
+
writableArray.pushDouble(((BigDecimal) value).doubleValue());
|
|
92
|
+
} else if (value instanceof String) {
|
|
93
|
+
writableArray.pushString((String) value);
|
|
94
|
+
} else if (value instanceof ReadableMap) {
|
|
95
|
+
writableArray.pushMap((ReadableMap) value);
|
|
96
|
+
} else if (value instanceof ReadableArray) {
|
|
97
|
+
writableArray.pushArray((ReadableArray) value);
|
|
98
|
+
} else {
|
|
99
|
+
logger.log(SentryLevel.ERROR, "Could not convert object: " + value);
|
|
100
100
|
}
|
|
101
|
+
}
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"Could not convert object" + value);
|
|
132
|
-
}
|
|
103
|
+
private static void addValueToWritableMap(WritableMap writableMap, String key, Object value) {
|
|
104
|
+
if (value == null) {
|
|
105
|
+
writableMap.putNull(key);
|
|
106
|
+
} else if (value instanceof Boolean) {
|
|
107
|
+
writableMap.putBoolean(key, (Boolean) value);
|
|
108
|
+
} else if (value instanceof Double) {
|
|
109
|
+
writableMap.putDouble(key, (Double) value);
|
|
110
|
+
} else if (value instanceof Float) {
|
|
111
|
+
writableMap.putDouble(key, ((Float) value).doubleValue());
|
|
112
|
+
} else if (value instanceof Integer) {
|
|
113
|
+
writableMap.putInt(key, (Integer) value);
|
|
114
|
+
} else if (value instanceof Short) {
|
|
115
|
+
writableMap.putInt(key, ((Short) value).intValue());
|
|
116
|
+
} else if (value instanceof Byte) {
|
|
117
|
+
writableMap.putInt(key, ((Byte) value).intValue());
|
|
118
|
+
} else if (value instanceof Long) {
|
|
119
|
+
writableMap.putDouble(key, ((Long) value).doubleValue());
|
|
120
|
+
} else if (value instanceof BigInteger) {
|
|
121
|
+
writableMap.putDouble(key, ((BigInteger) value).doubleValue());
|
|
122
|
+
} else if (value instanceof BigDecimal) {
|
|
123
|
+
writableMap.putDouble(key, ((BigDecimal) value).doubleValue());
|
|
124
|
+
} else if (value instanceof String) {
|
|
125
|
+
writableMap.putString(key, (String) value);
|
|
126
|
+
} else if (value instanceof ReadableArray) {
|
|
127
|
+
writableMap.putArray(key, (ReadableArray) value);
|
|
128
|
+
} else if (value instanceof ReadableMap) {
|
|
129
|
+
writableMap.putMap(key, (ReadableMap) value);
|
|
130
|
+
} else {
|
|
131
|
+
logger.log(SentryLevel.ERROR, "Could not convert object" + value);
|
|
133
132
|
}
|
|
133
|
+
}
|
|
134
134
|
}
|