@sentry/react-native 7.4.0 → 7.6.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 +2 -1
- package/RNSentry.podspec +2 -2
- package/android/build.gradle +1 -1
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +70 -13
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/android/src/main/java/io/sentry/react/replay/RNSentryReplayFragmentLifecycleTracer.java +137 -0
- package/dist/js/NativeRNSentry.d.ts +0 -1
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/RNSentryReplayMaskNativeComponent.js +1 -1
- package/dist/js/RNSentryReplayMaskNativeComponent.js.map +1 -1
- package/dist/js/RNSentryReplayUnmaskNativeComponent.js +1 -1
- package/dist/js/RNSentryReplayUnmaskNativeComponent.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +2 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +2 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/graphql.d.ts +11 -0
- package/dist/js/integrations/graphql.d.ts.map +1 -0
- package/dist/js/integrations/graphql.js +9 -0
- package/dist/js/integrations/graphql.js.map +1 -0
- package/dist/js/integrations/supabase.d.ts +12 -0
- package/dist/js/integrations/supabase.d.ts.map +1 -0
- package/dist/js/integrations/supabase.js +10 -0
- package/dist/js/integrations/supabase.js.map +1 -0
- package/dist/js/options.d.ts +12 -1
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +22 -0
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +1 -0
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/replay/networkUtils.d.ts +0 -1
- package/dist/js/replay/networkUtils.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +12 -2
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tracing/timetodisplaynative.types.d.ts +0 -1
- package/dist/js/tracing/timetodisplaynative.types.d.ts.map +1 -1
- package/dist/js/vendor/react-native/index.d.ts +0 -1
- package/dist/js/vendor/react-native/index.d.ts.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +2 -3
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry+fetchNativeStack.m +0 -10
- package/ios/RNSentry.h +1 -3
- package/ios/RNSentry.mm +81 -161
- package/ios/RNSentryDependencyContainer.m +1 -1
- package/ios/RNSentryOnDrawReporter.m +1 -2
- package/ios/RNSentryVersion.m +1 -1
- package/ios/SentrySDKWrapper.h +16 -0
- package/ios/SentrySDKWrapper.m +135 -0
- package/package.json +19 -17
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
- package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
- package/src/js/NativeRNSentry.ts +0 -1
- package/src/js/RNSentryReplayMaskNativeComponent.ts +1 -1
- package/src/js/RNSentryReplayUnmaskNativeComponent.ts +1 -1
- package/ts3.8/dist/js/NativeRNSentry.d.ts +0 -1
- package/ts3.8/dist/js/integrations/exports.d.ts +2 -0
- package/ts3.8/dist/js/integrations/graphql.d.ts +11 -0
- package/ts3.8/dist/js/integrations/supabase.d.ts +12 -0
- package/ts3.8/dist/js/options.d.ts +12 -1
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +22 -0
- package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -1
- package/ts3.8/dist/js/tracing/timetodisplaynative.types.d.ts +0 -1
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +0 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
|
@@ -2,16 +2,6 @@
|
|
|
2
2
|
#import "RNSentryBreadcrumb.h"
|
|
3
3
|
#import "RNSentryId.h"
|
|
4
4
|
#import <Sentry/PrivateSentrySDKOnly.h>
|
|
5
|
-
#import <Sentry/SentryAppStartMeasurement.h>
|
|
6
|
-
#import <Sentry/SentryBreadcrumb.h>
|
|
7
|
-
#import <Sentry/SentryDebugImageProvider+HybridSDKs.h>
|
|
8
|
-
#import <Sentry/SentryDebugMeta.h>
|
|
9
|
-
#import <Sentry/SentryDependencyContainer.h>
|
|
10
|
-
#import <Sentry/SentryEvent.h>
|
|
11
|
-
#import <Sentry/SentryException.h>
|
|
12
|
-
#import <Sentry/SentryFormatter.h>
|
|
13
|
-
#import <Sentry/SentryOptions.h>
|
|
14
|
-
#import <Sentry/SentryUser.h>
|
|
15
5
|
@import Sentry;
|
|
16
6
|
|
|
17
7
|
// This method was moved to a new category so we can use `@import Sentry` to use Sentry's Swift
|
package/ios/RNSentry.h
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
#import <dlfcn.h>
|
|
9
9
|
|
|
10
10
|
#import <Sentry/Sentry.h>
|
|
11
|
-
#import <Sentry/SentryDebugImageProvider.h>
|
|
12
11
|
|
|
13
12
|
typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);
|
|
14
13
|
|
|
@@ -21,8 +20,7 @@ typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);
|
|
|
21
20
|
|
|
22
21
|
@interface RNSentry : RCTEventEmitter <RCTBridgeModule>
|
|
23
22
|
|
|
24
|
-
- (
|
|
25
|
-
error:(NSError *_Nullable *_Nonnull)errorPointer;
|
|
23
|
+
- (NSMutableDictionary *)prepareOptions:(NSDictionary *)options;
|
|
26
24
|
|
|
27
25
|
- (void)setEventOriginTag:(SentryEvent *)event;
|
|
28
26
|
|
package/ios/RNSentry.mm
CHANGED
|
@@ -21,14 +21,11 @@
|
|
|
21
21
|
#import <Sentry/PrivateSentrySDKOnly.h>
|
|
22
22
|
#import <Sentry/SentryAppStartMeasurement.h>
|
|
23
23
|
#import <Sentry/SentryBreadcrumb.h>
|
|
24
|
-
#import <Sentry/SentryDebugImageProvider+HybridSDKs.h>
|
|
25
24
|
#import <Sentry/SentryDebugMeta.h>
|
|
26
|
-
#import <Sentry/SentryDependencyContainer.h>
|
|
27
25
|
#import <Sentry/SentryEvent.h>
|
|
28
26
|
#import <Sentry/SentryException.h>
|
|
29
27
|
#import <Sentry/SentryFormatter.h>
|
|
30
|
-
#import <Sentry/
|
|
31
|
-
#import <Sentry/SentryOptionsInternal.h>
|
|
28
|
+
#import <Sentry/SentryGeo.h>
|
|
32
29
|
#import <Sentry/SentryScreenFrames.h>
|
|
33
30
|
#import <Sentry/SentryUser.h>
|
|
34
31
|
|
|
@@ -86,24 +83,68 @@ static bool hasFetchedAppStart;
|
|
|
86
83
|
return self;
|
|
87
84
|
}
|
|
88
85
|
|
|
86
|
+
- (NSMutableDictionary *)prepareOptions:(NSDictionary *)options
|
|
87
|
+
{
|
|
88
|
+
SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event) {
|
|
89
|
+
// We don't want to send an event after startup that came from a Unhandled JS Exception of
|
|
90
|
+
// React Native because we sent it already before the app crashed.
|
|
91
|
+
if (nil != event.exceptions.firstObject.type &&
|
|
92
|
+
[event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
|
|
93
|
+
!= NSNotFound) {
|
|
94
|
+
return nil;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Regex and Str are set when one of them has value so we only need to check one of them.
|
|
98
|
+
if (self->_ignoreErrorPatternsStr || self->_ignoreErrorPatternsRegex) {
|
|
99
|
+
for (SentryException *exception in event.exceptions) {
|
|
100
|
+
if ([self shouldIgnoreError:exception.value]) {
|
|
101
|
+
return nil;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if ([self shouldIgnoreError:event.message.message]) {
|
|
105
|
+
return nil;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[self setEventOriginTag:event];
|
|
110
|
+
return event;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
NSMutableDictionary *mutableOptions = [options mutableCopy];
|
|
114
|
+
[mutableOptions setValue:beforeSend forKey:@"beforeSend"];
|
|
115
|
+
|
|
116
|
+
// remove performance traces sample rate and traces sampler since we don't want to synchronize
|
|
117
|
+
// these configurations to the Native SDKs. The user could tho initialize the SDK manually and
|
|
118
|
+
// set themselves.
|
|
119
|
+
[mutableOptions removeObjectForKey:@"tracesSampleRate"];
|
|
120
|
+
[mutableOptions removeObjectForKey:@"tracesSampler"];
|
|
121
|
+
[mutableOptions removeObjectForKey:@"enableTracing"];
|
|
122
|
+
|
|
123
|
+
[self trySetIgnoreErrors:mutableOptions];
|
|
124
|
+
|
|
125
|
+
return mutableOptions;
|
|
126
|
+
}
|
|
127
|
+
|
|
89
128
|
RCT_EXPORT_MODULE()
|
|
90
129
|
RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
|
|
91
130
|
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
92
131
|
{
|
|
132
|
+
NSMutableDictionary *mutableOptions = [self prepareOptions:options];
|
|
133
|
+
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
134
|
+
BOOL isSessionReplayEnabled = [RNSentryReplay updateOptions:mutableOptions];
|
|
135
|
+
#else
|
|
136
|
+
// Defaulting to false for unsupported targets
|
|
137
|
+
BOOL isSessionReplayEnabled = NO;
|
|
138
|
+
#endif
|
|
93
139
|
NSError *error = nil;
|
|
94
|
-
|
|
140
|
+
[SentrySDKWrapper setupWithDictionary:mutableOptions
|
|
141
|
+
isSessionReplayEnabled:isSessionReplayEnabled
|
|
142
|
+
error:&error];
|
|
95
143
|
if (error != nil) {
|
|
96
144
|
reject(@"SentryReactNative", error.localizedDescription, error);
|
|
97
145
|
return;
|
|
98
146
|
}
|
|
99
147
|
|
|
100
|
-
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
|
|
101
|
-
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
|
|
102
|
-
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
|
|
103
|
-
version:REACT_NATIVE_SDK_PACKAGE_VERSION];
|
|
104
|
-
|
|
105
|
-
[SentrySDKWrapper startWithOptions:sentryOptions];
|
|
106
|
-
|
|
107
148
|
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
108
149
|
BOOL appIsActive =
|
|
109
150
|
[[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
|
|
@@ -114,8 +155,8 @@ RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
|
|
|
114
155
|
// If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive
|
|
115
156
|
// notification, send it.
|
|
116
157
|
if (appIsActive && !sentHybridSdkDidBecomeActive
|
|
117
|
-
&& (
|
|
118
|
-
|
|
158
|
+
&& ([SentrySDKWrapper enableAutoSessionTracking] ||
|
|
159
|
+
[SentrySDKWrapper enableWatchdogTerminationTracking])) {
|
|
119
160
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"SentryHybridSdkDidBecomeActive"
|
|
120
161
|
object:nil];
|
|
121
162
|
|
|
@@ -129,7 +170,7 @@ RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
|
|
|
129
170
|
resolve(@YES);
|
|
130
171
|
}
|
|
131
172
|
|
|
132
|
-
- (void)trySetIgnoreErrors:(
|
|
173
|
+
- (void)trySetIgnoreErrors:(NSDictionary *)options
|
|
133
174
|
{
|
|
134
175
|
NSArray *ignoreErrorsStr = nil;
|
|
135
176
|
NSArray *ignoreErrorsRegex = nil;
|
|
@@ -195,146 +236,6 @@ RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
|
|
|
195
236
|
return NO;
|
|
196
237
|
}
|
|
197
238
|
|
|
198
|
-
- (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
199
|
-
error:(NSError *_Nonnull *_Nonnull)errorPointer
|
|
200
|
-
{
|
|
201
|
-
SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event) {
|
|
202
|
-
// We don't want to send an event after startup that came from a Unhandled JS Exception of
|
|
203
|
-
// React Native because we sent it already before the app crashed.
|
|
204
|
-
if (nil != event.exceptions.firstObject.type &&
|
|
205
|
-
[event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
|
|
206
|
-
!= NSNotFound) {
|
|
207
|
-
return nil;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Regex and Str are set when one of them has value so we only need to check one of them.
|
|
211
|
-
if (self->_ignoreErrorPatternsStr || self->_ignoreErrorPatternsRegex) {
|
|
212
|
-
for (SentryException *exception in event.exceptions) {
|
|
213
|
-
if ([self shouldIgnoreError:exception.value]) {
|
|
214
|
-
return nil;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if ([self shouldIgnoreError:event.message.message]) {
|
|
218
|
-
return nil;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
[self setEventOriginTag:event];
|
|
223
|
-
return event;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
NSMutableDictionary *mutableOptions = [options mutableCopy];
|
|
227
|
-
[mutableOptions setValue:beforeSend forKey:@"beforeSend"];
|
|
228
|
-
|
|
229
|
-
// remove performance traces sample rate and traces sampler since we don't want to synchronize
|
|
230
|
-
// these configurations to the Native SDKs. The user could tho initialize the SDK manually and
|
|
231
|
-
// set themselves.
|
|
232
|
-
[mutableOptions removeObjectForKey:@"tracesSampleRate"];
|
|
233
|
-
[mutableOptions removeObjectForKey:@"tracesSampler"];
|
|
234
|
-
[mutableOptions removeObjectForKey:@"enableTracing"];
|
|
235
|
-
|
|
236
|
-
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
237
|
-
BOOL isSessionReplayEnabled = [RNSentryReplay updateOptions:mutableOptions];
|
|
238
|
-
#else
|
|
239
|
-
// Defaulting to false for unsupported targets
|
|
240
|
-
BOOL isSessionReplayEnabled = NO;
|
|
241
|
-
#endif
|
|
242
|
-
|
|
243
|
-
SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:mutableOptions
|
|
244
|
-
didFailWithError:errorPointer];
|
|
245
|
-
if (*errorPointer != nil) {
|
|
246
|
-
return nil;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
250
|
-
NSString *dsn = [self getURLFromDSN:[mutableOptions valueForKey:@"dsn"]];
|
|
251
|
-
NSString *devServerUrl = [mutableOptions valueForKey:@"devServerUrl"];
|
|
252
|
-
sentryOptions.beforeBreadcrumb
|
|
253
|
-
= ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
|
|
254
|
-
{
|
|
255
|
-
NSString *url = breadcrumb.data[@"url"] ?: @"";
|
|
256
|
-
|
|
257
|
-
if ([@"http" isEqualToString:breadcrumb.type]
|
|
258
|
-
&& ((dsn != nil && [url hasPrefix:dsn])
|
|
259
|
-
|| (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
|
|
260
|
-
return nil;
|
|
261
|
-
}
|
|
262
|
-
return breadcrumb;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
if ([mutableOptions valueForKey:@"enableNativeCrashHandling"] != nil) {
|
|
266
|
-
BOOL enableNativeCrashHandling = [mutableOptions[@"enableNativeCrashHandling"] boolValue];
|
|
267
|
-
|
|
268
|
-
if (!enableNativeCrashHandling) {
|
|
269
|
-
NSMutableArray *integrations = sentryOptions.integrations.mutableCopy;
|
|
270
|
-
[integrations removeObject:@"SentryCrashIntegration"];
|
|
271
|
-
sentryOptions.integrations = integrations;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Set spotlight option
|
|
276
|
-
if ([mutableOptions valueForKey:@"spotlight"] != nil) {
|
|
277
|
-
id spotlightValue = [mutableOptions valueForKey:@"spotlight"];
|
|
278
|
-
if ([spotlightValue isKindOfClass:[NSString class]]) {
|
|
279
|
-
NSLog(@"Using Spotlight on address: %@", spotlightValue);
|
|
280
|
-
sentryOptions.enableSpotlight = true;
|
|
281
|
-
sentryOptions.spotlightUrl = spotlightValue;
|
|
282
|
-
} else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
|
|
283
|
-
sentryOptions.enableSpotlight = [spotlightValue boolValue];
|
|
284
|
-
id defaultSpotlightUrl = [mutableOptions valueForKey:@"defaultSidecarUrl"];
|
|
285
|
-
if (defaultSpotlightUrl != nil) {
|
|
286
|
-
sentryOptions.spotlightUrl = defaultSpotlightUrl;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if ([mutableOptions valueForKey:@"enableLogs"] != nil) {
|
|
292
|
-
id enableLogsValue = [mutableOptions valueForKey:@"enableLogs"];
|
|
293
|
-
if ([enableLogsValue isKindOfClass:[NSNumber class]]) {
|
|
294
|
-
[RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue]
|
|
295
|
-
sentryOptions:sentryOptions];
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
[self trySetIgnoreErrors:mutableOptions];
|
|
299
|
-
|
|
300
|
-
// Enable the App start and Frames tracking measurements
|
|
301
|
-
if ([mutableOptions valueForKey:@"enableAutoPerformanceTracing"] != nil) {
|
|
302
|
-
BOOL enableAutoPerformanceTracing =
|
|
303
|
-
[mutableOptions[@"enableAutoPerformanceTracing"] boolValue];
|
|
304
|
-
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
305
|
-
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
306
|
-
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
307
|
-
#endif
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Failed requests can only be enabled in one SDK to avoid duplicates
|
|
311
|
-
sentryOptions.enableCaptureFailedRequests = NO;
|
|
312
|
-
|
|
313
|
-
NSDictionary *experiments = options[@"_experiments"];
|
|
314
|
-
if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
|
|
315
|
-
BOOL enableUnhandledCPPExceptions =
|
|
316
|
-
[experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
|
|
317
|
-
[RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
|
|
318
|
-
sentryOptions:sentryOptions];
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (isSessionReplayEnabled) {
|
|
322
|
-
[RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
|
|
323
|
-
sentryOptions:sentryOptions];
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return sentryOptions;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
- (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
|
|
330
|
-
{
|
|
331
|
-
NSURL *url = [NSURL URLWithString:dsn];
|
|
332
|
-
if (!url) {
|
|
333
|
-
return nil;
|
|
334
|
-
}
|
|
335
|
-
return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
|
|
336
|
-
}
|
|
337
|
-
|
|
338
239
|
- (void)setEventOriginTag:(SentryEvent *)event
|
|
339
240
|
{
|
|
340
241
|
if (event.sdk != nil) {
|
|
@@ -463,7 +364,7 @@ RCT_EXPORT_METHOD(fetchNativeLogAttributes : (RCTPromiseResolveBlock)resolve rej
|
|
|
463
364
|
contexts[@"os"] = os;
|
|
464
365
|
}
|
|
465
366
|
|
|
466
|
-
NSString *releaseName =
|
|
367
|
+
NSString *releaseName = [SentrySDKWrapper releaseName];
|
|
467
368
|
if (releaseName) {
|
|
468
369
|
contexts[@"release"] = releaseName;
|
|
469
370
|
}
|
|
@@ -495,7 +396,7 @@ RCT_EXPORT_METHOD(fetchNativeLogAttributes : (RCTPromiseResolveBlock)resolve rej
|
|
|
495
396
|
RCT_EXPORT_METHOD(fetchNativeDeviceContexts : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
496
397
|
RCTPromiseRejectBlock)reject)
|
|
497
398
|
{
|
|
498
|
-
if (
|
|
399
|
+
if ([SentrySDKWrapper debug]) {
|
|
499
400
|
NSLog(@"Bridge call to: deviceContexts");
|
|
500
401
|
}
|
|
501
402
|
__block NSMutableDictionary<NSString *, id> *serializedScope;
|
|
@@ -510,7 +411,7 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts : (RCTPromiseResolveBlock)resolve re
|
|
|
510
411
|
forKey:@"user"];
|
|
511
412
|
}
|
|
512
413
|
|
|
513
|
-
if (
|
|
414
|
+
if ([SentrySDKWrapper debug]) {
|
|
514
415
|
NSData *data = [NSJSONSerialization dataWithJSONObject:serializedScope
|
|
515
416
|
options:0
|
|
516
417
|
error:nil];
|
|
@@ -725,9 +626,28 @@ RCT_EXPORT_METHOD(setUser : (NSDictionary *)userKeys otherUserKeys : (NSDictiona
|
|
|
725
626
|
if ([username isKindOfClass:NSString.class]) {
|
|
726
627
|
[userInstance setUsername:username];
|
|
727
628
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
629
|
+
|
|
630
|
+
id geo = [userKeys valueForKey:@"geo"];
|
|
631
|
+
if ([geo isKindOfClass:NSDictionary.class]) {
|
|
632
|
+
NSDictionary *geoDict = (NSDictionary *)geo;
|
|
633
|
+
SentryGeo *sentryGeo = [SentryGeo alloc];
|
|
634
|
+
|
|
635
|
+
id city = [geoDict valueForKey:@"city"];
|
|
636
|
+
if ([city isKindOfClass:NSString.class]) {
|
|
637
|
+
[sentryGeo setCity:city];
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
id countryCode = [geoDict valueForKey:@"country_code"];
|
|
641
|
+
if ([countryCode isKindOfClass:NSString.class]) {
|
|
642
|
+
[sentryGeo setCountryCode:countryCode];
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
id region = [geoDict valueForKey:@"region"];
|
|
646
|
+
if ([region isKindOfClass:NSString.class]) {
|
|
647
|
+
[sentryGeo setRegion:region];
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
[userInstance setGeo:sentryGeo];
|
|
731
651
|
}
|
|
732
652
|
|
|
733
653
|
if ([userDataKeys isKindOfClass:NSDictionary.class]) {
|
package/ios/RNSentryVersion.m
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
|
|
4
4
|
NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
|
|
5
5
|
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
|
|
6
|
-
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.
|
|
6
|
+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.6.0";
|
package/ios/SentrySDKWrapper.h
CHANGED
|
@@ -15,4 +15,20 @@
|
|
|
15
15
|
|
|
16
16
|
+ (void)startWithOptions:(SentryOptions *)options;
|
|
17
17
|
|
|
18
|
+
+ (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
|
|
19
|
+
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
|
|
20
|
+
error:(NSError **)errorPointer;
|
|
21
|
+
|
|
22
|
+
+ (void)setupWithDictionary:(NSDictionary *)options
|
|
23
|
+
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
|
|
24
|
+
error:(NSError **)errorPointer;
|
|
25
|
+
|
|
26
|
+
+ (BOOL)debug;
|
|
27
|
+
|
|
28
|
+
+ (NSString *)releaseName;
|
|
29
|
+
|
|
30
|
+
+ (BOOL)enableAutoSessionTracking;
|
|
31
|
+
|
|
32
|
+
+ (BOOL)enableWatchdogTerminationTracking;
|
|
33
|
+
|
|
18
34
|
@end
|
package/ios/SentrySDKWrapper.m
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#import "SentrySDKWrapper.h"
|
|
2
|
+
#import "RNSentryExperimentalOptions.h"
|
|
3
|
+
#import "RNSentryVersion.h"
|
|
2
4
|
@import Sentry;
|
|
3
5
|
|
|
4
6
|
@implementation SentrySDKWrapper
|
|
@@ -28,4 +30,137 @@
|
|
|
28
30
|
[SentrySDK configureScope:callback];
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
+ (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
|
|
34
|
+
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
|
|
35
|
+
error:(NSError *__autoreleasing *)errorPointer
|
|
36
|
+
{
|
|
37
|
+
NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]];
|
|
38
|
+
SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:options
|
|
39
|
+
didFailWithError:errorPointer];
|
|
40
|
+
if (*errorPointer != nil) {
|
|
41
|
+
return nil;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
45
|
+
NSString *devServerUrl = [options valueForKey:@"devServerUrl"];
|
|
46
|
+
sentryOptions.beforeBreadcrumb
|
|
47
|
+
= ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
|
|
48
|
+
{
|
|
49
|
+
NSString *url = breadcrumb.data[@"url"] ?: @"";
|
|
50
|
+
|
|
51
|
+
if ([@"http" isEqualToString:breadcrumb.type]
|
|
52
|
+
&& ((dsn != nil && [url hasPrefix:dsn])
|
|
53
|
+
|| (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
|
|
54
|
+
return nil;
|
|
55
|
+
}
|
|
56
|
+
return breadcrumb;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if ([options valueForKey:@"enableNativeCrashHandling"] != nil) {
|
|
60
|
+
BOOL enableNativeCrashHandling = [options[@"enableNativeCrashHandling"] boolValue];
|
|
61
|
+
|
|
62
|
+
if (!enableNativeCrashHandling) {
|
|
63
|
+
sentryOptions.enableCrashHandler = NO;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Set spotlight option
|
|
68
|
+
if ([options valueForKey:@"spotlight"] != nil) {
|
|
69
|
+
id spotlightValue = [options valueForKey:@"spotlight"];
|
|
70
|
+
if ([spotlightValue isKindOfClass:[NSString class]]) {
|
|
71
|
+
NSLog(@"Using Spotlight on address: %@", spotlightValue);
|
|
72
|
+
sentryOptions.enableSpotlight = true;
|
|
73
|
+
sentryOptions.spotlightUrl = spotlightValue;
|
|
74
|
+
} else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
|
|
75
|
+
sentryOptions.enableSpotlight = [spotlightValue boolValue];
|
|
76
|
+
id defaultSpotlightUrl = [options valueForKey:@"defaultSidecarUrl"];
|
|
77
|
+
if (defaultSpotlightUrl != nil) {
|
|
78
|
+
sentryOptions.spotlightUrl = defaultSpotlightUrl;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if ([options valueForKey:@"enableLogs"] != nil) {
|
|
84
|
+
id enableLogsValue = [options valueForKey:@"enableLogs"];
|
|
85
|
+
if ([enableLogsValue isKindOfClass:[NSNumber class]]) {
|
|
86
|
+
[RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue]
|
|
87
|
+
sentryOptions:sentryOptions];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Enable the App start and Frames tracking measurements
|
|
92
|
+
if ([options valueForKey:@"enableAutoPerformanceTracing"] != nil) {
|
|
93
|
+
BOOL enableAutoPerformanceTracing = [options[@"enableAutoPerformanceTracing"] boolValue];
|
|
94
|
+
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
95
|
+
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
96
|
+
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
97
|
+
#endif
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Failed requests can only be enabled in one SDK to avoid duplicates
|
|
101
|
+
sentryOptions.enableCaptureFailedRequests = NO;
|
|
102
|
+
|
|
103
|
+
NSDictionary *experiments = options[@"_experiments"];
|
|
104
|
+
if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
|
|
105
|
+
BOOL enableUnhandledCPPExceptions =
|
|
106
|
+
[experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
|
|
107
|
+
[RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
|
|
108
|
+
sentryOptions:sentryOptions];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (isSessionReplayEnabled) {
|
|
112
|
+
[RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
|
|
113
|
+
sentryOptions:sentryOptions];
|
|
114
|
+
}
|
|
115
|
+
return sentryOptions;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
+ (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
|
|
119
|
+
{
|
|
120
|
+
NSURL *url = [NSURL URLWithString:dsn];
|
|
121
|
+
if (!url) {
|
|
122
|
+
return nil;
|
|
123
|
+
}
|
|
124
|
+
return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
+ (void)setupWithDictionary:(NSDictionary *_Nonnull)options
|
|
128
|
+
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
|
|
129
|
+
error:(NSError *_Nonnull *_Nonnull)errorPointer
|
|
130
|
+
{
|
|
131
|
+
SentryOptions *sentryOptions = [self createOptionsWithDictionary:options
|
|
132
|
+
isSessionReplayEnabled:isSessionReplayEnabled
|
|
133
|
+
error:errorPointer];
|
|
134
|
+
if (!options) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
|
|
139
|
+
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
|
|
140
|
+
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
|
|
141
|
+
version:REACT_NATIVE_SDK_PACKAGE_VERSION];
|
|
142
|
+
|
|
143
|
+
[SentrySDKWrapper startWithOptions:sentryOptions];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
+ (BOOL)debug
|
|
147
|
+
{
|
|
148
|
+
return PrivateSentrySDKOnly.options.debug;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
+ (NSString *)releaseName
|
|
152
|
+
{
|
|
153
|
+
return PrivateSentrySDKOnly.options.releaseName;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
+ (BOOL)enableAutoSessionTracking
|
|
157
|
+
{
|
|
158
|
+
return PrivateSentrySDKOnly.options.enableAutoSessionTracking;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
+ (BOOL)enableWatchdogTerminationTracking
|
|
162
|
+
{
|
|
163
|
+
return PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking;
|
|
164
|
+
}
|
|
165
|
+
|
|
31
166
|
@end
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "7.
|
|
5
|
+
"version": "7.6.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
|
@@ -68,26 +68,27 @@
|
|
|
68
68
|
"react-native": ">=0.65.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@sentry/babel-plugin-component-annotate": "4.
|
|
72
|
-
"@sentry/browser": "10.
|
|
73
|
-
"@sentry/cli": "2.
|
|
74
|
-
"@sentry/core": "10.
|
|
75
|
-
"@sentry/react": "10.
|
|
76
|
-
"@sentry/types": "10.
|
|
71
|
+
"@sentry/babel-plugin-component-annotate": "4.6.0",
|
|
72
|
+
"@sentry/browser": "10.24.0",
|
|
73
|
+
"@sentry/cli": "2.58.0",
|
|
74
|
+
"@sentry/core": "10.24.0",
|
|
75
|
+
"@sentry/react": "10.24.0",
|
|
76
|
+
"@sentry/types": "10.24.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@babel/core": "^7.
|
|
79
|
+
"@babel/core": "^7.26.7",
|
|
80
80
|
"@expo/metro-config": "~0.20.0",
|
|
81
81
|
"@mswjs/interceptors": "^0.25.15",
|
|
82
|
-
"@react-native/babel-preset": "0.
|
|
83
|
-
"@sentry-internal/eslint-config-sdk": "10.
|
|
84
|
-
"@sentry-internal/eslint-plugin-sdk": "10.
|
|
85
|
-
"@sentry-internal/typescript": "10.
|
|
82
|
+
"@react-native/babel-preset": "0.80.0",
|
|
83
|
+
"@sentry-internal/eslint-config-sdk": "10.24.0",
|
|
84
|
+
"@sentry-internal/eslint-plugin-sdk": "10.24.0",
|
|
85
|
+
"@sentry-internal/typescript": "10.24.0",
|
|
86
86
|
"@sentry/wizard": "6.6.0",
|
|
87
|
-
"@testing-library/react-native": "^
|
|
87
|
+
"@testing-library/react-native": "^13.2.2",
|
|
88
88
|
"@types/jest": "^29.5.13",
|
|
89
89
|
"@types/node": "^20.9.3",
|
|
90
|
-
"@types/react": "^
|
|
90
|
+
"@types/react": "^19.1.0",
|
|
91
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
91
92
|
"@types/uglify-js": "^3.17.2",
|
|
92
93
|
"@types/uuid": "^9.0.4",
|
|
93
94
|
"@types/xmlhttprequest": "^1.8.2",
|
|
@@ -102,14 +103,15 @@
|
|
|
102
103
|
"eslint-plugin-react-native": "^3.8.1",
|
|
103
104
|
"expo": "^53.0.0",
|
|
104
105
|
"expo-module-scripts": "3.1.0",
|
|
105
|
-
"jest": "^29.6.
|
|
106
|
+
"jest": "^29.6.3",
|
|
106
107
|
"jest-environment-jsdom": "^29.6.2",
|
|
107
108
|
"jest-extended": "^4.0.2",
|
|
108
109
|
"madge": "^6.1.0",
|
|
109
110
|
"metro": "0.83.1",
|
|
110
111
|
"prettier": "^2.0.5",
|
|
111
|
-
"react": "
|
|
112
|
-
"react-native": "0.
|
|
112
|
+
"react": "19.1.0",
|
|
113
|
+
"react-native": "0.80.1",
|
|
114
|
+
"react-test-renderer": "19.1.0",
|
|
113
115
|
"rimraf": "^4.1.1",
|
|
114
116
|
"ts-jest": "^29.3.1",
|
|
115
117
|
"typescript": "4.9.5",
|
|
@@ -9,7 +9,7 @@ export interface SentryAndroidGradlePluginOptions {
|
|
|
9
9
|
includeNativeSources?: boolean;
|
|
10
10
|
includeSourceContext?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const sentryAndroidGradlePluginVersion = "5.12.
|
|
12
|
+
export declare const sentryAndroidGradlePluginVersion = "5.12.2";
|
|
13
13
|
/**
|
|
14
14
|
* Adds the Sentry Android Gradle Plugin to the project.
|
|
15
15
|
* https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withSentryAndroidGradlePlugin = exports.sentryAndroidGradlePluginVersion = void 0;
|
|
4
4
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
|
-
exports.sentryAndroidGradlePluginVersion = '5.12.
|
|
6
|
+
exports.sentryAndroidGradlePluginVersion = '5.12.2';
|
|
7
7
|
/**
|
|
8
8
|
* Adds the Sentry Android Gradle Plugin to the project.
|
|
9
9
|
* https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
2
|
// The default export exists in the file but eslint doesn't see it
|
|
3
3
|
// eslint-disable-next-line import/default
|
|
4
|
-
import codegenNativeComponent from 'react-native
|
|
4
|
+
import { codegenNativeComponent } from 'react-native';
|
|
5
5
|
|
|
6
6
|
// If changed to type NativeProps = ViewProps, react native codegen will fail finding the NativeProps type
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
2
|
// The default export exists in the file but eslint doesn't see it
|
|
3
3
|
// eslint-disable-next-line import/default
|
|
4
|
-
import codegenNativeComponent from 'react-native
|
|
4
|
+
import { codegenNativeComponent } from 'react-native';
|
|
5
5
|
|
|
6
6
|
// If changed to type NativeProps = ViewProps, react native codegen will fail finding the NativeProps type
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|