@sentry/react-native 6.1.0 → 6.3.0-beta.1
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 +5 -9
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +6 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +183 -127
- package/android/src/main/java/io/sentry/react/RNSentryTimeToDisplay.java +42 -0
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/dist/js/NativeRNSentry.d.ts +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +7 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +2 -2
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +4 -37
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.d.ts +6 -2
- package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js +44 -27
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +11 -7
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +7 -3
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts +4 -0
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js +4 -1
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +40 -2
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/metroMiddleware.d.ts +15 -0
- package/dist/js/tools/metroMiddleware.d.ts.map +1 -0
- package/dist/js/tools/metroMiddleware.js +105 -0
- package/dist/js/tools/metroMiddleware.js.map +1 -0
- package/dist/js/tools/metroconfig.d.ts +7 -1
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +9 -1
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +17 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js +7 -7
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.js +6 -2
- package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
- package/dist/js/utils/sentryeventemitterfallback.d.ts +19 -0
- package/dist/js/utils/sentryeventemitterfallback.d.ts.map +1 -0
- package/dist/js/utils/sentryeventemitterfallback.js +78 -0
- package/dist/js/utils/sentryeventemitterfallback.js.map +1 -0
- package/dist/js/vendor/react-native/index.d.ts +1 -1
- package/dist/js/vendor/react-native/index.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 +4 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +6 -0
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.h +8 -12
- package/ios/RNSentry.mm +417 -303
- package/ios/RNSentryBreadcrumb.h +2 -2
- package/ios/RNSentryBreadcrumb.m +13 -6
- package/ios/RNSentryDependencyContainer.h +2 -2
- package/ios/RNSentryDependencyContainer.m +7 -6
- package/ios/RNSentryFramesTrackerListener.h +6 -6
- package/ios/RNSentryFramesTrackerListener.m +10 -8
- package/ios/RNSentryId.m +2 -1
- package/ios/RNSentryOnDrawReporter.h +5 -5
- package/ios/RNSentryOnDrawReporter.m +26 -24
- package/ios/RNSentryRNSScreen.h +1 -1
- package/ios/RNSentryRNSScreen.m +18 -18
- package/ios/RNSentryReplay.m +42 -53
- package/ios/RNSentryReplayBreadcrumbConverter.h +3 -4
- package/ios/RNSentryReplayBreadcrumbConverter.m +139 -132
- package/ios/RNSentryTimeToDisplay.h +7 -0
- package/ios/RNSentryTimeToDisplay.m +44 -0
- package/package.json +17 -16
- package/scripts/expo-upload-sourcemaps.js +16 -0
- package/scripts/sentry-xcode-debug-files.sh +6 -0
- package/scripts/sentry-xcode.sh +4 -0
- package/sentry.gradle +13 -2
- package/src/js/NativeRNSentry.ts +1 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
- package/ts3.8/dist/js/index.d.ts +2 -2
- package/ts3.8/dist/js/integrations/debugsymbolicatorutils.d.ts +6 -2
- package/ts3.8/dist/js/integrations/spotlight.d.ts +4 -0
- package/ts3.8/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -1
- package/ts3.8/dist/js/utils/sentryeventemitterfallback.d.ts +19 -0
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +1 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +4 -0
package/README.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" alt="Sentry" width="280">
|
|
7
|
-
</picture>
|
|
8
|
-
</a>
|
|
9
|
-
</p>
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
|
|
3
|
+
<img src="https://sentry-brand.storage.googleapis.com/github-banners/github-sdk-react.jpg" alt="Sentry for React Native">
|
|
4
|
+
</a>
|
|
5
|
+
</div>
|
|
10
6
|
|
|
11
7
|
_Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us [<kbd>**Check out our open positions**</kbd>](https://sentry.io/careers/)_
|
|
12
8
|
|
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.40.1'
|
|
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
|
@@ -51,6 +51,12 @@ public final class RNSentryBreadcrumb {
|
|
|
51
51
|
breadcrumb.setCategory(from.getString("category"));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
if (from.hasKey("origin")) {
|
|
55
|
+
breadcrumb.setOrigin(from.getString("origin"));
|
|
56
|
+
} else {
|
|
57
|
+
breadcrumb.setOrigin("react-native");
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
if (from.hasKey("level")) {
|
|
55
61
|
switch (from.getString("level")) {
|
|
56
62
|
case "fatal":
|
|
@@ -20,12 +20,15 @@ import com.facebook.react.bridge.Promise;
|
|
|
20
20
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
21
21
|
import com.facebook.react.bridge.ReadableMap;
|
|
22
22
|
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
23
|
+
import com.facebook.react.bridge.ReadableType;
|
|
23
24
|
import com.facebook.react.bridge.UiThreadUtil;
|
|
24
25
|
import com.facebook.react.bridge.WritableArray;
|
|
25
26
|
import com.facebook.react.bridge.WritableMap;
|
|
26
27
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
27
28
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
29
|
+
import com.facebook.react.common.JavascriptException;
|
|
28
30
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
31
|
+
import io.sentry.Breadcrumb;
|
|
29
32
|
import io.sentry.HubAdapter;
|
|
30
33
|
import io.sentry.ILogger;
|
|
31
34
|
import io.sentry.IScope;
|
|
@@ -57,7 +60,6 @@ import io.sentry.android.core.internal.debugmeta.AssetsDebugMetaLoader;
|
|
|
57
60
|
import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
|
|
58
61
|
import io.sentry.android.core.performance.AppStartMetrics;
|
|
59
62
|
import io.sentry.protocol.SdkVersion;
|
|
60
|
-
import io.sentry.protocol.SentryException;
|
|
61
63
|
import io.sentry.protocol.SentryId;
|
|
62
64
|
import io.sentry.protocol.SentryPackage;
|
|
63
65
|
import io.sentry.protocol.User;
|
|
@@ -73,8 +75,11 @@ import java.io.FileNotFoundException;
|
|
|
73
75
|
import java.io.FileReader;
|
|
74
76
|
import java.io.IOException;
|
|
75
77
|
import java.io.InputStream;
|
|
78
|
+
import java.net.URI;
|
|
79
|
+
import java.net.URISyntaxException;
|
|
76
80
|
import java.nio.charset.Charset;
|
|
77
81
|
import java.util.HashMap;
|
|
82
|
+
import java.util.Iterator;
|
|
78
83
|
import java.util.List;
|
|
79
84
|
import java.util.Map;
|
|
80
85
|
import java.util.Properties;
|
|
@@ -126,10 +131,13 @@ public class RNSentryModuleImpl {
|
|
|
126
131
|
/** Max trace file size in bytes. */
|
|
127
132
|
private long maxTraceFileSize = 5 * 1024 * 1024;
|
|
128
133
|
|
|
134
|
+
private final @NotNull SentryDateProvider dateProvider;
|
|
135
|
+
|
|
129
136
|
public RNSentryModuleImpl(ReactApplicationContext reactApplicationContext) {
|
|
130
137
|
packageInfo = getPackageInfo(reactApplicationContext);
|
|
131
138
|
this.reactApplicationContext = reactApplicationContext;
|
|
132
139
|
this.emitNewFrameEvent = createEmitNewFrameEvent();
|
|
140
|
+
this.dateProvider = new SentryAndroidDateProvider();
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
private ReactApplicationContext getReactApplicationContext() {
|
|
@@ -141,8 +149,6 @@ public class RNSentryModuleImpl {
|
|
|
141
149
|
}
|
|
142
150
|
|
|
143
151
|
private @NotNull Runnable createEmitNewFrameEvent() {
|
|
144
|
-
final @NotNull SentryDateProvider dateProvider = new SentryAndroidDateProvider();
|
|
145
|
-
|
|
146
152
|
return () -> {
|
|
147
153
|
final SentryDate endDate = dateProvider.now();
|
|
148
154
|
WritableMap event = Arguments.createMap();
|
|
@@ -174,135 +180,151 @@ public class RNSentryModuleImpl {
|
|
|
174
180
|
public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
|
|
175
181
|
SentryAndroid.init(
|
|
176
182
|
this.getReactApplicationContext(),
|
|
177
|
-
options ->
|
|
178
|
-
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
|
|
179
|
-
if (sdkVersion == null) {
|
|
180
|
-
sdkVersion = new SdkVersion(ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
|
|
181
|
-
} else {
|
|
182
|
-
sdkVersion.setName(ANDROID_SDK_NAME);
|
|
183
|
-
}
|
|
183
|
+
options -> getSentryAndroidOptions(options, rnOptions, logger));
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
options.setSdkVersion(sdkVersion);
|
|
185
|
+
promise.resolve(true);
|
|
186
|
+
}
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// SentryAndroid needs an empty string fallback for the dsn.
|
|
198
|
-
options.setDsn("");
|
|
199
|
-
}
|
|
200
|
-
if (rnOptions.hasKey("sampleRate")) {
|
|
201
|
-
options.setSampleRate(rnOptions.getDouble("sampleRate"));
|
|
202
|
-
}
|
|
203
|
-
if (rnOptions.hasKey("sendClientReports")) {
|
|
204
|
-
options.setSendClientReports(rnOptions.getBoolean("sendClientReports"));
|
|
205
|
-
}
|
|
206
|
-
if (rnOptions.hasKey("maxBreadcrumbs")) {
|
|
207
|
-
options.setMaxBreadcrumbs(rnOptions.getInt("maxBreadcrumbs"));
|
|
208
|
-
}
|
|
209
|
-
if (rnOptions.hasKey("maxCacheItems")) {
|
|
210
|
-
options.setMaxCacheItems(rnOptions.getInt("maxCacheItems"));
|
|
211
|
-
}
|
|
212
|
-
if (rnOptions.hasKey("environment") && rnOptions.getString("environment") != null) {
|
|
213
|
-
options.setEnvironment(rnOptions.getString("environment"));
|
|
214
|
-
}
|
|
215
|
-
if (rnOptions.hasKey("release") && rnOptions.getString("release") != null) {
|
|
216
|
-
options.setRelease(rnOptions.getString("release"));
|
|
217
|
-
}
|
|
218
|
-
if (rnOptions.hasKey("dist") && rnOptions.getString("dist") != null) {
|
|
219
|
-
options.setDist(rnOptions.getString("dist"));
|
|
220
|
-
}
|
|
221
|
-
if (rnOptions.hasKey("enableAutoSessionTracking")) {
|
|
222
|
-
options.setEnableAutoSessionTracking(rnOptions.getBoolean("enableAutoSessionTracking"));
|
|
223
|
-
}
|
|
224
|
-
if (rnOptions.hasKey("sessionTrackingIntervalMillis")) {
|
|
225
|
-
options.setSessionTrackingIntervalMillis(
|
|
226
|
-
rnOptions.getInt("sessionTrackingIntervalMillis"));
|
|
227
|
-
}
|
|
228
|
-
if (rnOptions.hasKey("shutdownTimeout")) {
|
|
229
|
-
options.setShutdownTimeoutMillis(rnOptions.getInt("shutdownTimeout"));
|
|
230
|
-
}
|
|
231
|
-
if (rnOptions.hasKey("enableNdkScopeSync")) {
|
|
232
|
-
options.setEnableScopeSync(rnOptions.getBoolean("enableNdkScopeSync"));
|
|
233
|
-
}
|
|
234
|
-
if (rnOptions.hasKey("attachStacktrace")) {
|
|
235
|
-
options.setAttachStacktrace(rnOptions.getBoolean("attachStacktrace"));
|
|
236
|
-
}
|
|
237
|
-
if (rnOptions.hasKey("attachThreads")) {
|
|
238
|
-
// JS use top level stacktrace and android attaches Threads which hides them so
|
|
239
|
-
// by default we hide.
|
|
240
|
-
options.setAttachThreads(rnOptions.getBoolean("attachThreads"));
|
|
241
|
-
}
|
|
242
|
-
if (rnOptions.hasKey("attachScreenshot")) {
|
|
243
|
-
options.setAttachScreenshot(rnOptions.getBoolean("attachScreenshot"));
|
|
244
|
-
}
|
|
245
|
-
if (rnOptions.hasKey("attachViewHierarchy")) {
|
|
246
|
-
options.setAttachViewHierarchy(rnOptions.getBoolean("attachViewHierarchy"));
|
|
247
|
-
}
|
|
248
|
-
if (rnOptions.hasKey("sendDefaultPii")) {
|
|
249
|
-
options.setSendDefaultPii(rnOptions.getBoolean("sendDefaultPii"));
|
|
250
|
-
}
|
|
251
|
-
if (rnOptions.hasKey("maxQueueSize")) {
|
|
252
|
-
options.setMaxQueueSize(rnOptions.getInt("maxQueueSize"));
|
|
253
|
-
}
|
|
254
|
-
if (rnOptions.hasKey("enableNdk")) {
|
|
255
|
-
options.setEnableNdk(rnOptions.getBoolean("enableNdk"));
|
|
256
|
-
}
|
|
257
|
-
if (rnOptions.hasKey("_experiments")) {
|
|
258
|
-
options.getExperimental().setSessionReplay(getReplayOptions(rnOptions));
|
|
259
|
-
options
|
|
260
|
-
.getReplayController()
|
|
261
|
-
.setBreadcrumbConverter(new RNSentryReplayBreadcrumbConverter());
|
|
262
|
-
}
|
|
263
|
-
options.setBeforeSend(
|
|
264
|
-
(event, hint) -> {
|
|
265
|
-
// React native internally throws a JavascriptException
|
|
266
|
-
// Since we catch it before that, we don't want to send this one
|
|
267
|
-
// because we would send it twice
|
|
268
|
-
try {
|
|
269
|
-
SentryException ex = event.getExceptions().get(0);
|
|
270
|
-
if (null != ex && ex.getType().contains("JavascriptException")) {
|
|
271
|
-
return null;
|
|
272
|
-
}
|
|
273
|
-
} catch (Throwable ignored) { // NOPMD - We don't want to crash in any case
|
|
274
|
-
// We do nothing
|
|
275
|
-
}
|
|
188
|
+
protected void getSentryAndroidOptions(
|
|
189
|
+
@NotNull SentryAndroidOptions options, @NotNull ReadableMap rnOptions, ILogger logger) {
|
|
190
|
+
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
|
|
191
|
+
if (sdkVersion == null) {
|
|
192
|
+
sdkVersion = new SdkVersion(ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
|
|
193
|
+
} else {
|
|
194
|
+
sdkVersion.setName(ANDROID_SDK_NAME);
|
|
195
|
+
}
|
|
276
196
|
|
|
277
|
-
|
|
278
|
-
|
|
197
|
+
options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
|
|
198
|
+
options.setNativeSdkName(NATIVE_SDK_NAME);
|
|
199
|
+
options.setSdkVersion(sdkVersion);
|
|
279
200
|
|
|
280
|
-
|
|
281
|
-
|
|
201
|
+
if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
|
|
202
|
+
options.setDebug(true);
|
|
203
|
+
}
|
|
204
|
+
if (rnOptions.hasKey("dsn") && rnOptions.getString("dsn") != null) {
|
|
205
|
+
String dsn = rnOptions.getString("dsn");
|
|
206
|
+
logger.log(SentryLevel.INFO, String.format("Starting with DSN: '%s'", dsn));
|
|
207
|
+
options.setDsn(dsn);
|
|
208
|
+
} else {
|
|
209
|
+
// SentryAndroid needs an empty string fallback for the dsn.
|
|
210
|
+
options.setDsn("");
|
|
211
|
+
}
|
|
212
|
+
if (rnOptions.hasKey("sampleRate")) {
|
|
213
|
+
options.setSampleRate(rnOptions.getDouble("sampleRate"));
|
|
214
|
+
}
|
|
215
|
+
if (rnOptions.hasKey("sendClientReports")) {
|
|
216
|
+
options.setSendClientReports(rnOptions.getBoolean("sendClientReports"));
|
|
217
|
+
}
|
|
218
|
+
if (rnOptions.hasKey("maxBreadcrumbs")) {
|
|
219
|
+
options.setMaxBreadcrumbs(rnOptions.getInt("maxBreadcrumbs"));
|
|
220
|
+
}
|
|
221
|
+
if (rnOptions.hasKey("maxCacheItems")) {
|
|
222
|
+
options.setMaxCacheItems(rnOptions.getInt("maxCacheItems"));
|
|
223
|
+
}
|
|
224
|
+
if (rnOptions.hasKey("environment") && rnOptions.getString("environment") != null) {
|
|
225
|
+
options.setEnvironment(rnOptions.getString("environment"));
|
|
226
|
+
}
|
|
227
|
+
if (rnOptions.hasKey("release") && rnOptions.getString("release") != null) {
|
|
228
|
+
options.setRelease(rnOptions.getString("release"));
|
|
229
|
+
}
|
|
230
|
+
if (rnOptions.hasKey("dist") && rnOptions.getString("dist") != null) {
|
|
231
|
+
options.setDist(rnOptions.getString("dist"));
|
|
232
|
+
}
|
|
233
|
+
if (rnOptions.hasKey("enableAutoSessionTracking")) {
|
|
234
|
+
options.setEnableAutoSessionTracking(rnOptions.getBoolean("enableAutoSessionTracking"));
|
|
235
|
+
}
|
|
236
|
+
if (rnOptions.hasKey("sessionTrackingIntervalMillis")) {
|
|
237
|
+
options.setSessionTrackingIntervalMillis(rnOptions.getInt("sessionTrackingIntervalMillis"));
|
|
238
|
+
}
|
|
239
|
+
if (rnOptions.hasKey("shutdownTimeout")) {
|
|
240
|
+
options.setShutdownTimeoutMillis(rnOptions.getInt("shutdownTimeout"));
|
|
241
|
+
}
|
|
242
|
+
if (rnOptions.hasKey("enableNdkScopeSync")) {
|
|
243
|
+
options.setEnableScopeSync(rnOptions.getBoolean("enableNdkScopeSync"));
|
|
244
|
+
}
|
|
245
|
+
if (rnOptions.hasKey("attachStacktrace")) {
|
|
246
|
+
options.setAttachStacktrace(rnOptions.getBoolean("attachStacktrace"));
|
|
247
|
+
}
|
|
248
|
+
if (rnOptions.hasKey("attachThreads")) {
|
|
249
|
+
// JS use top level stacktrace and android attaches Threads which hides them so
|
|
250
|
+
// by default we hide.
|
|
251
|
+
options.setAttachThreads(rnOptions.getBoolean("attachThreads"));
|
|
252
|
+
}
|
|
253
|
+
if (rnOptions.hasKey("attachScreenshot")) {
|
|
254
|
+
options.setAttachScreenshot(rnOptions.getBoolean("attachScreenshot"));
|
|
255
|
+
}
|
|
256
|
+
if (rnOptions.hasKey("attachViewHierarchy")) {
|
|
257
|
+
options.setAttachViewHierarchy(rnOptions.getBoolean("attachViewHierarchy"));
|
|
258
|
+
}
|
|
259
|
+
if (rnOptions.hasKey("sendDefaultPii")) {
|
|
260
|
+
options.setSendDefaultPii(rnOptions.getBoolean("sendDefaultPii"));
|
|
261
|
+
}
|
|
262
|
+
if (rnOptions.hasKey("maxQueueSize")) {
|
|
263
|
+
options.setMaxQueueSize(rnOptions.getInt("maxQueueSize"));
|
|
264
|
+
}
|
|
265
|
+
if (rnOptions.hasKey("enableNdk")) {
|
|
266
|
+
options.setEnableNdk(rnOptions.getBoolean("enableNdk"));
|
|
267
|
+
}
|
|
268
|
+
if (rnOptions.hasKey("spotlight")) {
|
|
269
|
+
if (rnOptions.getType("spotlight") == ReadableType.Boolean) {
|
|
270
|
+
options.setEnableSpotlight(rnOptions.getBoolean("spotlight"));
|
|
271
|
+
options.setSpotlightConnectionUrl(rnOptions.getString("defaultSidecarUrl"));
|
|
272
|
+
} else if (rnOptions.getType("spotlight") == ReadableType.String) {
|
|
273
|
+
options.setEnableSpotlight(true);
|
|
274
|
+
options.setSpotlightConnectionUrl(rnOptions.getString("spotlight"));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (rnOptions.hasKey("_experiments")) {
|
|
278
|
+
options.getExperimental().setSessionReplay(getReplayOptions(rnOptions));
|
|
279
|
+
options.getReplayController().setBreadcrumbConverter(new RNSentryReplayBreadcrumbConverter());
|
|
280
|
+
}
|
|
282
281
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
logger.log(
|
|
295
|
-
SentryLevel.INFO,
|
|
296
|
-
String.format("Native Integrations '%s'", options.getIntegrations()));
|
|
297
|
-
|
|
298
|
-
final CurrentActivityHolder currentActivityHolder = CurrentActivityHolder.getInstance();
|
|
299
|
-
final Activity currentActivity = getCurrentActivity();
|
|
300
|
-
if (currentActivity != null) {
|
|
301
|
-
currentActivityHolder.setActivity(currentActivity);
|
|
282
|
+
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
283
|
+
String dsn = getURLFromDSN(rnOptions.getString("dsn"));
|
|
284
|
+
String devServerUrl = rnOptions.getString("devServerUrl");
|
|
285
|
+
options.setBeforeBreadcrumb(
|
|
286
|
+
(breadcrumb, hint) -> {
|
|
287
|
+
Object urlObject = breadcrumb.getData("url");
|
|
288
|
+
String url = urlObject instanceof String ? (String) urlObject : "";
|
|
289
|
+
if ("http".equals(breadcrumb.getType())
|
|
290
|
+
&& ((dsn != null && url.startsWith(dsn))
|
|
291
|
+
|| (devServerUrl != null && url.startsWith(devServerUrl)))) {
|
|
292
|
+
return null;
|
|
302
293
|
}
|
|
294
|
+
return breadcrumb;
|
|
303
295
|
});
|
|
304
296
|
|
|
305
|
-
|
|
297
|
+
// React native internally throws a JavascriptException.
|
|
298
|
+
// we want to ignore it on the native side to avoid sending it twice.
|
|
299
|
+
options.addIgnoredExceptionForType(JavascriptException.class);
|
|
300
|
+
|
|
301
|
+
options.setBeforeSend(
|
|
302
|
+
(event, hint) -> {
|
|
303
|
+
setEventOriginTag(event);
|
|
304
|
+
addPackages(event, options.getSdkVersion());
|
|
305
|
+
|
|
306
|
+
return event;
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
if (rnOptions.hasKey("enableNativeCrashHandling")
|
|
310
|
+
&& !rnOptions.getBoolean("enableNativeCrashHandling")) {
|
|
311
|
+
final List<Integration> integrations = options.getIntegrations();
|
|
312
|
+
for (final Integration integration : integrations) {
|
|
313
|
+
if (integration instanceof UncaughtExceptionHandlerIntegration
|
|
314
|
+
|| integration instanceof AnrIntegration
|
|
315
|
+
|| integration instanceof NdkIntegration) {
|
|
316
|
+
integrations.remove(integration);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
logger.log(
|
|
321
|
+
SentryLevel.INFO, String.format("Native Integrations '%s'", options.getIntegrations()));
|
|
322
|
+
|
|
323
|
+
final CurrentActivityHolder currentActivityHolder = CurrentActivityHolder.getInstance();
|
|
324
|
+
final Activity currentActivity = getCurrentActivity();
|
|
325
|
+
if (currentActivity != null) {
|
|
326
|
+
currentActivityHolder.setActivity(currentActivity);
|
|
327
|
+
}
|
|
306
328
|
}
|
|
307
329
|
|
|
308
330
|
private SentryReplayOptions getReplayOptions(@NotNull ReadableMap rnOptions) {
|
|
@@ -745,6 +767,10 @@ public class RNSentryModuleImpl {
|
|
|
745
767
|
}
|
|
746
768
|
}
|
|
747
769
|
|
|
770
|
+
public void getNewScreenTimeToDisplay(Promise promise) {
|
|
771
|
+
RNSentryTimeToDisplay.getTimeToDisplay(promise, dateProvider);
|
|
772
|
+
}
|
|
773
|
+
|
|
748
774
|
private String getProfilingTracesDirPath() {
|
|
749
775
|
if (cacheDirPath == null) {
|
|
750
776
|
cacheDirPath =
|
|
@@ -879,18 +905,35 @@ public class RNSentryModuleImpl {
|
|
|
879
905
|
|
|
880
906
|
public void fetchNativeDeviceContexts(Promise promise) {
|
|
881
907
|
final @NotNull SentryOptions options = HubAdapter.getInstance().getOptions();
|
|
908
|
+
final @Nullable Context context = this.getReactApplicationContext().getApplicationContext();
|
|
909
|
+
final @Nullable IScope currentScope = InternalSentrySdk.getCurrentScope();
|
|
910
|
+
fetchNativeDeviceContexts(promise, options, context, currentScope);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
protected void fetchNativeDeviceContexts(
|
|
914
|
+
Promise promise,
|
|
915
|
+
final @NotNull SentryOptions options,
|
|
916
|
+
final @Nullable Context context,
|
|
917
|
+
final @Nullable IScope currentScope) {
|
|
882
918
|
if (!(options instanceof SentryAndroidOptions)) {
|
|
883
919
|
promise.resolve(null);
|
|
884
920
|
return;
|
|
885
921
|
}
|
|
886
|
-
|
|
887
|
-
final @Nullable Context context = this.getReactApplicationContext().getApplicationContext();
|
|
888
922
|
if (context == null) {
|
|
889
923
|
promise.resolve(null);
|
|
890
924
|
return;
|
|
891
925
|
}
|
|
926
|
+
if (currentScope != null) {
|
|
927
|
+
// Remove react-native breadcrumbs
|
|
928
|
+
Iterator<Breadcrumb> breadcrumbsIterator = currentScope.getBreadcrumbs().iterator();
|
|
929
|
+
while (breadcrumbsIterator.hasNext()) {
|
|
930
|
+
Breadcrumb breadcrumb = breadcrumbsIterator.next();
|
|
931
|
+
if ("react-native".equals(breadcrumb.getOrigin())) {
|
|
932
|
+
breadcrumbsIterator.remove();
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
892
936
|
|
|
893
|
-
final @Nullable IScope currentScope = InternalSentrySdk.getCurrentScope();
|
|
894
937
|
final @NotNull Map<String, Object> serialized =
|
|
895
938
|
InternalSentrySdk.serializeScope(context, (SentryAndroidOptions) options, currentScope);
|
|
896
939
|
final @Nullable Object deviceContext = RNSentryMapConverter.convertToWritable(serialized);
|
|
@@ -975,4 +1018,17 @@ public class RNSentryModuleImpl {
|
|
|
975
1018
|
private boolean isFrameMetricsAggregatorAvailable() {
|
|
976
1019
|
return androidXAvailable && frameMetricsAggregator != null;
|
|
977
1020
|
}
|
|
1021
|
+
|
|
1022
|
+
public static @Nullable String getURLFromDSN(@Nullable String dsn) {
|
|
1023
|
+
if (dsn == null) {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
URI uri = null;
|
|
1027
|
+
try {
|
|
1028
|
+
uri = new URI(dsn);
|
|
1029
|
+
} catch (URISyntaxException e) {
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|
|
1032
|
+
return uri.getScheme() + "://" + uri.getHost();
|
|
1033
|
+
}
|
|
978
1034
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package io.sentry.react;
|
|
2
|
+
|
|
3
|
+
import android.os.Handler;
|
|
4
|
+
import android.os.Looper;
|
|
5
|
+
import android.view.Choreographer;
|
|
6
|
+
import com.facebook.react.bridge.Promise;
|
|
7
|
+
import io.sentry.SentryDate;
|
|
8
|
+
import io.sentry.SentryDateProvider;
|
|
9
|
+
|
|
10
|
+
public final class RNSentryTimeToDisplay {
|
|
11
|
+
|
|
12
|
+
private RNSentryTimeToDisplay() {}
|
|
13
|
+
|
|
14
|
+
public static void getTimeToDisplay(Promise promise, SentryDateProvider dateProvider) {
|
|
15
|
+
Looper mainLooper = Looper.getMainLooper();
|
|
16
|
+
|
|
17
|
+
if (mainLooper == null) {
|
|
18
|
+
promise.reject(
|
|
19
|
+
"GetTimeToDisplay is not able to measure the time to display: Main looper not"
|
|
20
|
+
+ " available.");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Ensure the code runs on the main thread
|
|
25
|
+
new Handler(mainLooper)
|
|
26
|
+
.post(
|
|
27
|
+
() -> {
|
|
28
|
+
try {
|
|
29
|
+
Choreographer choreographer = Choreographer.getInstance();
|
|
30
|
+
|
|
31
|
+
// Invoke the callback after the frame is rendered
|
|
32
|
+
choreographer.postFrameCallback(
|
|
33
|
+
frameTimeNanos -> {
|
|
34
|
+
final SentryDate endDate = dateProvider.now();
|
|
35
|
+
promise.resolve(endDate.nanoTimestamp() / 1e9);
|
|
36
|
+
});
|
|
37
|
+
} catch (Exception exception) {
|
|
38
|
+
promise.reject("Failed to receive the instance of Choreographer", exception);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -172,4 +172,9 @@ public class RNSentryModule extends NativeRNSentrySpec {
|
|
|
172
172
|
public void crashedLastRun(Promise promise) {
|
|
173
173
|
this.impl.crashedLastRun(promise);
|
|
174
174
|
}
|
|
175
|
+
|
|
176
|
+
@Override
|
|
177
|
+
public void getNewScreenTimeToDisplay(Promise promise) {
|
|
178
|
+
this.impl.getNewScreenTimeToDisplay(promise);
|
|
179
|
+
}
|
|
175
180
|
}
|
|
@@ -172,4 +172,9 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
172
172
|
public void crashedLastRun(Promise promise) {
|
|
173
173
|
this.impl.crashedLastRun(promise);
|
|
174
174
|
}
|
|
175
|
+
|
|
176
|
+
@ReactMethod()
|
|
177
|
+
public void getNewScreenTimeToDisplay(Promise promise) {
|
|
178
|
+
this.impl.getNewScreenTimeToDisplay(promise);
|
|
179
|
+
}
|
|
175
180
|
}
|
|
@@ -4,6 +4,7 @@ import type { UnsafeObject } from './utils/rnlibrariesinterface';
|
|
|
4
4
|
export interface Spec extends TurboModule {
|
|
5
5
|
addListener: (eventType: string) => void;
|
|
6
6
|
removeListeners: (id: number) => void;
|
|
7
|
+
getNewScreenTimeToDisplay(): Promise<number | undefined | null>;
|
|
7
8
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
8
9
|
captureEnvelope(bytes: string, options: {
|
|
9
10
|
hardCrashed: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9C,eAAe,CACb,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACP,WAAW,EAAE,OAAO,CAAC;KACtB,GACA,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,EAAE,GAAG,SAAS,GA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AC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;;AAGF,wBAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA0JnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nimport type { UnsafeObject } from './utils/rnlibrariesinterface';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addListener: (eventType: string) => void;\n removeListeners: (id: number) => void;\n getNewScreenTimeToDisplay(): Promise<number | undefined | null>;\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n hardCrashed: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(platformProfilers: boolean): { started?: boolean; error?: string };\n stopProfiling(): {\n profile?: string;\n nativeProfile?: UnsafeObject;\n androidProfile?: UnsafeObject;\n error?: string;\n };\n fetchNativePackageName(): string | undefined | null;\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;\n getCurrentReplayId(): string | undefined | null;\n crashedLastRun(): Promise<boolean | undefined | null>;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n type: 'cold' | 'warm' | 'unknown';\n has_fetched: boolean;\n app_start_timestamp_ms?: number;\n spans: {\n description: string;\n start_timestamp_ms: number;\n end_timestamp_ms: number;\n }[];\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n segment?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
|
package/dist/js/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAS1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACzE,OAAO,CAAC,eAAe,CAAY;IAEnC;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IAYpD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,GAAE,SAAc,GAAG,WAAW,CAAC,KAAK,CAAC;IAIvF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAIrG;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;OAEG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAUxD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,4BAA4B,CAAC;IAiClF;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;OAEG;IACH,OAAO,CAAC,cAAc;IA4BtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -2,11 +2,14 @@ import { eventFromException, eventFromMessage } from '@sentry/browser';
|
|
|
2
2
|
import { BaseClient } from '@sentry/core';
|
|
3
3
|
import { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';
|
|
4
4
|
import { Alert } from 'react-native';
|
|
5
|
+
import { getDevServer } from './integrations/debugsymbolicatorutils';
|
|
5
6
|
import { defaultSdkInfo } from './integrations/sdkinfo';
|
|
7
|
+
import { getDefaultSidecarUrl } from './integrations/spotlight';
|
|
6
8
|
import { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';
|
|
7
9
|
import { createUserFeedbackEnvelope, items } from './utils/envelope';
|
|
8
10
|
import { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';
|
|
9
11
|
import { mergeOutcomes } from './utils/outcome';
|
|
12
|
+
import { ReactNativeLibraries } from './utils/rnlibraries';
|
|
10
13
|
import { NATIVE } from './wrapper';
|
|
11
14
|
/**
|
|
12
15
|
* The Sentry React Native SDK Client.
|
|
@@ -20,7 +23,8 @@ export class ReactNativeClient extends BaseClient {
|
|
|
20
23
|
* @param options Configuration options for this SDK.
|
|
21
24
|
*/
|
|
22
25
|
constructor(options) {
|
|
23
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
ignoreRequireCycleLogs((_a = ReactNativeLibraries.ReactNativeVersion) === null || _a === void 0 ? void 0 : _a.version);
|
|
24
28
|
options._metadata = options._metadata || {};
|
|
25
29
|
options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;
|
|
26
30
|
// We default this to true, as it is the safer scenario
|
|
@@ -112,7 +116,8 @@ export class ReactNativeClient extends BaseClient {
|
|
|
112
116
|
* Starts native client with dsn and options
|
|
113
117
|
*/
|
|
114
118
|
_initNativeSdk() {
|
|
115
|
-
|
|
119
|
+
var _a;
|
|
120
|
+
NATIVE.initNativeSdk(Object.assign(Object.assign({}, this._options), { defaultSidecarUrl: getDefaultSidecarUrl(), devServerUrl: ((_a = getDevServer()) === null || _a === void 0 ? void 0 : _a.url) || '', mobileReplayOptions: this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&
|
|
116
121
|
'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]
|
|
117
122
|
? this._integrations[MOBILE_REPLAY_INTEGRATION_NAME].options
|
|
118
123
|
: undefined }))
|