@sentry/react-native 6.7.0-alpha.0 → 6.8.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/RNSentry.podspec +2 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +280 -2
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/integrations/debugsymbolicator.js +9 -1
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js +9 -1
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/devicecontext.js +9 -1
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/modulesloader.js +9 -1
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +9 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/release.js +9 -1
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/screenshot.js +9 -1
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.js +9 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +9 -1
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/replay/mobilereplay.js +9 -1
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +19 -22
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/metroMiddleware.js +11 -3
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts +7 -11
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +25 -14
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformer.d.ts +1 -2
- package/dist/js/tools/sentryBabelTransformer.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformer.js +1 -23
- package/dist/js/tools/sentryBabelTransformer.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts +18 -0
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js +71 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +11 -4
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/utils.d.ts +1 -2
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +9 -1
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js +9 -1
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +0 -2
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.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.js +20 -1
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.h +5 -3
- package/ios/RNSentry.mm +210 -19
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +8 -8
- package/plugin/build/withSentry.d.ts +2 -0
- package/plugin/build/withSentry.js +10 -0
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +15 -0
- package/plugin/build/withSentryAndroidGradlePlugin.js +91 -0
- package/scripts/collect-modules.sh +5 -5
- package/scripts/sentry-xcode.sh +0 -19
- package/sentry.gradle +1 -52
- package/ts3.8/dist/js/utils/worldwide.d.ts +0 -2
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryCompositeOptionsConfiguration.java +0 -25
- package/android/src/main/java/io/sentry/react/RNSentryJsonConverter.java +0 -76
- package/android/src/main/java/io/sentry/react/RNSentryJsonUtils.java +0 -41
- package/android/src/main/java/io/sentry/react/RNSentrySDK.java +0 -68
- package/android/src/main/java/io/sentry/react/RNSentryStart.java +0 -365
- package/dist/js/tools/sentryOptionsSerializer.d.ts +0 -6
- package/dist/js/tools/sentryOptionsSerializer.d.ts.map +0 -1
- package/dist/js/tools/sentryOptionsSerializer.js +0 -91
- package/dist/js/tools/sentryOptionsSerializer.js.map +0 -1
- package/ios/RNSentrySDK.h +0 -31
- package/ios/RNSentrySDK.m +0 -71
- package/ios/RNSentryStart.h +0 -26
- package/ios/RNSentryStart.m +0 -222
package/ios/RNSentrySDK.h
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#import <Sentry/Sentry.h>
|
|
2
|
-
|
|
3
|
-
@interface RNSentrySDK : NSObject
|
|
4
|
-
SENTRY_NO_INIT
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @experimental
|
|
8
|
-
* Inits and configures Sentry for React Native applications using `sentry.options.json`
|
|
9
|
-
* configuration file.
|
|
10
|
-
*
|
|
11
|
-
* @discussion Call this method on the main thread. When calling it from a background thread, the
|
|
12
|
-
* SDK starts on the main thread async.
|
|
13
|
-
*/
|
|
14
|
-
+ (void)start;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @experimental
|
|
18
|
-
* Inits and configures Sentry for React Native applicationsusing `sentry.options.json`
|
|
19
|
-
* configuration file and `configureOptions` callback.
|
|
20
|
-
*
|
|
21
|
-
* The `configureOptions` callback can overwrite the config file options
|
|
22
|
-
* and add non-serializable items to the options object.
|
|
23
|
-
*
|
|
24
|
-
* @discussion Call this method on the main thread. When calling it from a background thread, the
|
|
25
|
-
* SDK starts on the main thread async.
|
|
26
|
-
*/
|
|
27
|
-
+ (void)startWithConfigureOptions:
|
|
28
|
-
(void (^_Nullable)(SentryOptions *_Nonnull options))configureOptions
|
|
29
|
-
NS_SWIFT_NAME(start(configureOptions:));
|
|
30
|
-
|
|
31
|
-
@end
|
package/ios/RNSentrySDK.m
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#import "RNSentrySDK.h"
|
|
2
|
-
#import "RNSentryStart.h"
|
|
3
|
-
|
|
4
|
-
static NSString *SENTRY_OPTIONS_RESOURCE_NAME = @"sentry.options";
|
|
5
|
-
static NSString *SENTRY_OPTIONS_RESOURCE_TYPE = @"json";
|
|
6
|
-
|
|
7
|
-
@implementation RNSentrySDK
|
|
8
|
-
|
|
9
|
-
+ (void)start
|
|
10
|
-
{
|
|
11
|
-
[self startWithConfigureOptions:nil];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
+ (void)startWithConfigureOptions:(void (^)(SentryOptions *options))configureOptions
|
|
15
|
-
{
|
|
16
|
-
NSString *path = [[NSBundle mainBundle] pathForResource:SENTRY_OPTIONS_RESOURCE_NAME
|
|
17
|
-
ofType:SENTRY_OPTIONS_RESOURCE_TYPE];
|
|
18
|
-
|
|
19
|
-
[self start:path configureOptions:configureOptions];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
+ (void)start:(NSString *)path configureOptions:(void (^)(SentryOptions *options))configureOptions
|
|
23
|
-
{
|
|
24
|
-
NSError *readError = nil;
|
|
25
|
-
NSError *parseError = nil;
|
|
26
|
-
NSError *optionsError = nil;
|
|
27
|
-
|
|
28
|
-
NSData *_Nullable content = nil;
|
|
29
|
-
if (path != nil) {
|
|
30
|
-
content = [NSData dataWithContentsOfFile:path options:0 error:&readError];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
NSDictionary *dict = nil;
|
|
34
|
-
if (content != nil) {
|
|
35
|
-
dict = [NSJSONSerialization JSONObjectWithData:content options:0 error:&parseError];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (readError != nil) {
|
|
39
|
-
NSLog(@"[RNSentry] Failed to load options from %@, with error: %@", path,
|
|
40
|
-
readError.localizedDescription);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (parseError != nil) {
|
|
44
|
-
NSLog(@"[RNSentry] Failed to parse JSON from %@, with error: %@", path,
|
|
45
|
-
parseError.localizedDescription);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
SentryOptions *options = nil;
|
|
49
|
-
if (dict != nil) {
|
|
50
|
-
options = [RNSentryStart createOptionsWithDictionary:dict error:&optionsError];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (optionsError != nil) {
|
|
54
|
-
NSLog(@"[RNSentry] Failed to parse options from %@, with error: %@", path,
|
|
55
|
-
optionsError.localizedDescription);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (options == nil) {
|
|
59
|
-
// Fallback in case that options file could not be parsed.
|
|
60
|
-
options = [[SentryOptions alloc] init];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
[RNSentryStart updateWithReactDefaults:options];
|
|
64
|
-
if (configureOptions != nil) {
|
|
65
|
-
configureOptions(options);
|
|
66
|
-
}
|
|
67
|
-
[RNSentryStart updateWithReactFinals:options];
|
|
68
|
-
[RNSentryStart startWithOptions:options];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@end
|
package/ios/RNSentryStart.h
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#import <Sentry/SentryDefines.h>
|
|
2
|
-
#import <Sentry/SentryOptions.h>
|
|
3
|
-
|
|
4
|
-
@interface RNSentryStart : NSObject
|
|
5
|
-
SENTRY_NO_INIT
|
|
6
|
-
|
|
7
|
-
+ (void)startWithOptions:(NSDictionary *_Nonnull)javascriptOptions
|
|
8
|
-
error:(NSError *_Nullable *_Nullable)errorPointer;
|
|
9
|
-
|
|
10
|
-
+ (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
11
|
-
error:(NSError *_Nonnull *_Nonnull)errorPointer;
|
|
12
|
-
|
|
13
|
-
+ (void)updateWithReactDefaults:(SentryOptions *)options;
|
|
14
|
-
+ (void)updateWithReactFinals:(SentryOptions *)options;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @experimental
|
|
18
|
-
* Inits and configures Sentry for React Native applications. Make sure to
|
|
19
|
-
* set a valid DSN.
|
|
20
|
-
*
|
|
21
|
-
* @discussion Call this method on the main thread. When calling it from a background thread, the
|
|
22
|
-
* SDK starts on the main thread async.
|
|
23
|
-
*/
|
|
24
|
-
+ (void)startWithOptions:(SentryOptions *)options NS_SWIFT_NAME(start(options:));
|
|
25
|
-
|
|
26
|
-
@end
|
package/ios/RNSentryStart.m
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
#import "RNSentryStart.h"
|
|
2
|
-
#import "RNSentryReplay.h"
|
|
3
|
-
#import "RNSentryVersion.h"
|
|
4
|
-
|
|
5
|
-
#import <Sentry/PrivateSentrySDKOnly.h>
|
|
6
|
-
#import <Sentry/Sentry.h>
|
|
7
|
-
#import <Sentry/SentryOptions+HybridSDKs.h>
|
|
8
|
-
|
|
9
|
-
@implementation RNSentryStart
|
|
10
|
-
|
|
11
|
-
+ (void)startWithOptions:(NSDictionary *_Nonnull)javascriptOptions
|
|
12
|
-
error:(NSError *_Nullable *_Nullable)errorPointer
|
|
13
|
-
{
|
|
14
|
-
SentryOptions *options = [self createOptionsWithDictionary:javascriptOptions
|
|
15
|
-
error:errorPointer];
|
|
16
|
-
[self updateWithReactDefaults:options];
|
|
17
|
-
[self updateWithReactFinals:options];
|
|
18
|
-
[self startWithOptions:options];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
+ (void)startWithOptions:(SentryOptions *)options NS_SWIFT_NAME(start(options:))
|
|
22
|
-
{
|
|
23
|
-
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
|
|
24
|
-
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
|
|
25
|
-
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
|
|
26
|
-
version:REACT_NATIVE_SDK_PACKAGE_VERSION];
|
|
27
|
-
|
|
28
|
-
[SentrySDK startWithOptions:options];
|
|
29
|
-
|
|
30
|
-
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
31
|
-
[RNSentryReplay postInit];
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
[self postDidBecomeActiveNotification];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
+ (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
38
|
-
error:(NSError *_Nonnull *_Nonnull)errorPointer
|
|
39
|
-
{
|
|
40
|
-
NSMutableDictionary *mutableOptions = [options mutableCopy];
|
|
41
|
-
|
|
42
|
-
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
43
|
-
[RNSentryReplay updateOptions:mutableOptions];
|
|
44
|
-
#endif
|
|
45
|
-
|
|
46
|
-
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions
|
|
47
|
-
didFailWithError:errorPointer];
|
|
48
|
-
if (*errorPointer != nil) {
|
|
49
|
-
return nil;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
53
|
-
NSString *dsn = [self getURLFromDSN:[mutableOptions valueForKey:@"dsn"]];
|
|
54
|
-
// TODO: For Auto Init from JS dev server is resolved automatically, for init from options file
|
|
55
|
-
// dev server has to be specified manually
|
|
56
|
-
NSString *devServerUrl = [mutableOptions valueForKey:@"devServerUrl"];
|
|
57
|
-
sentryOptions.beforeBreadcrumb
|
|
58
|
-
= ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
|
|
59
|
-
{
|
|
60
|
-
NSString *url = breadcrumb.data[@"url"] ?: @"";
|
|
61
|
-
|
|
62
|
-
if ([@"http" isEqualToString:breadcrumb.type]
|
|
63
|
-
&& ((dsn != nil && [url hasPrefix:dsn])
|
|
64
|
-
|| (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
|
|
65
|
-
return nil;
|
|
66
|
-
}
|
|
67
|
-
return breadcrumb;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// JS options.enableNativeCrashHandling equals to native options.enableCrashHandler
|
|
71
|
-
if ([mutableOptions valueForKey:@"enableNativeCrashHandling"] != nil) {
|
|
72
|
-
BOOL enableNativeCrashHandling = [mutableOptions[@"enableNativeCrashHandling"] boolValue];
|
|
73
|
-
|
|
74
|
-
if (!enableNativeCrashHandling) {
|
|
75
|
-
NSMutableArray *integrations = sentryOptions.integrations.mutableCopy;
|
|
76
|
-
[integrations removeObject:@"SentryCrashIntegration"];
|
|
77
|
-
sentryOptions.integrations = integrations;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Set spotlight option
|
|
82
|
-
if ([mutableOptions valueForKey:@"spotlight"] != nil) {
|
|
83
|
-
id spotlightValue = [mutableOptions valueForKey:@"spotlight"];
|
|
84
|
-
if ([spotlightValue isKindOfClass:[NSString class]]) {
|
|
85
|
-
NSLog(@"Using Spotlight on address: %@", spotlightValue);
|
|
86
|
-
sentryOptions.enableSpotlight = true;
|
|
87
|
-
sentryOptions.spotlightUrl = spotlightValue;
|
|
88
|
-
} else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
|
|
89
|
-
sentryOptions.enableSpotlight = [spotlightValue boolValue];
|
|
90
|
-
// TODO: For Auto init from JS set automatically for init from options file have to be
|
|
91
|
-
// set manually
|
|
92
|
-
id defaultSpotlightUrl = [mutableOptions valueForKey:@"defaultSidecarUrl"];
|
|
93
|
-
if (defaultSpotlightUrl != nil) {
|
|
94
|
-
sentryOptions.spotlightUrl = defaultSpotlightUrl;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return sentryOptions;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* This function updates the options with RNSentry defaults. These default can be
|
|
104
|
-
* overwritten by users during manual native initialization.
|
|
105
|
-
*/
|
|
106
|
-
+ (void)updateWithReactDefaults:(SentryOptions *)options
|
|
107
|
-
{
|
|
108
|
-
// Failed requests are captured only in JS to avoid duplicates
|
|
109
|
-
options.enableCaptureFailedRequests = NO;
|
|
110
|
-
|
|
111
|
-
// Tracing is only enabled in JS to avoid duplicate navigation spans
|
|
112
|
-
options.tracesSampleRate = nil;
|
|
113
|
-
options.tracesSampler = nil;
|
|
114
|
-
options.enableTracing = NO;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* This function updates options with changes RNSentry users should not change
|
|
119
|
-
* and so this is applied after the configureOptions callback during manual native initialization.
|
|
120
|
-
*/
|
|
121
|
-
+ (void)updateWithReactFinals:(SentryOptions *)options
|
|
122
|
-
{
|
|
123
|
-
SentryBeforeSendEventCallback userBeforeSend = options.beforeSend;
|
|
124
|
-
options.beforeSend = ^SentryEvent *(SentryEvent *event)
|
|
125
|
-
{
|
|
126
|
-
// Unhandled JS Exception are processed by the SDK on JS layer
|
|
127
|
-
// To avoid duplicates we drop them in the native SDKs
|
|
128
|
-
if (nil != event.exceptions.firstObject.type &&
|
|
129
|
-
[event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
|
|
130
|
-
!= NSNotFound) {
|
|
131
|
-
return nil;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
[self setEventOriginTag:event];
|
|
135
|
-
if (userBeforeSend == nil) {
|
|
136
|
-
return event;
|
|
137
|
-
} else {
|
|
138
|
-
return userBeforeSend(event);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// App Start Hybrid mode doesn't wait for didFinishLaunchNotification and the
|
|
143
|
-
// didBecomeVisibleNotification as they will be missed when auto initializing from JS
|
|
144
|
-
// App Start measurements are created right after the tracking starts
|
|
145
|
-
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = options.enableAutoPerformanceTracing;
|
|
146
|
-
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
147
|
-
// Frames Tracking Hybrid Mode ensures tracking
|
|
148
|
-
// is enabled without tracing enabled in the native SDK
|
|
149
|
-
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode
|
|
150
|
-
= options.enableAutoPerformanceTracing;
|
|
151
|
-
#endif
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
+ (void)setEventOriginTag:(SentryEvent *)event
|
|
155
|
-
{
|
|
156
|
-
if (event.sdk != nil) {
|
|
157
|
-
NSString *sdkName = event.sdk[@"name"];
|
|
158
|
-
|
|
159
|
-
// If the event is from react native, it gets set
|
|
160
|
-
// there and we do not handle it here.
|
|
161
|
-
if ([sdkName isEqual:NATIVE_SDK_NAME]) {
|
|
162
|
-
[self setEventEnvironmentTag:event origin:@"ios" environment:@"native"];
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
+ (void)setEventEnvironmentTag:(SentryEvent *)event
|
|
168
|
-
origin:(NSString *)origin
|
|
169
|
-
environment:(NSString *)environment
|
|
170
|
-
{
|
|
171
|
-
NSMutableDictionary *newTags = [NSMutableDictionary new];
|
|
172
|
-
|
|
173
|
-
if (nil != event.tags && [event.tags count] > 0) {
|
|
174
|
-
[newTags addEntriesFromDictionary:event.tags];
|
|
175
|
-
}
|
|
176
|
-
if (nil != origin) {
|
|
177
|
-
[newTags setValue:origin forKey:@"event.origin"];
|
|
178
|
-
}
|
|
179
|
-
if (nil != environment) {
|
|
180
|
-
[newTags setValue:environment forKey:@"event.environment"];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
event.tags = newTags;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
+ (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
|
|
187
|
-
{
|
|
188
|
-
NSURL *url = [NSURL URLWithString:dsn];
|
|
189
|
-
if (!url) {
|
|
190
|
-
return nil;
|
|
191
|
-
}
|
|
192
|
-
return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
static bool sentHybridSdkDidBecomeActive = NO;
|
|
196
|
-
|
|
197
|
-
+ (void)postDidBecomeActiveNotification
|
|
198
|
-
{
|
|
199
|
-
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
200
|
-
BOOL appIsActive =
|
|
201
|
-
[[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
|
|
202
|
-
#else
|
|
203
|
-
BOOL appIsActive = [[NSApplication sharedApplication] isActive];
|
|
204
|
-
#endif
|
|
205
|
-
|
|
206
|
-
// If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive
|
|
207
|
-
// notification, send it.
|
|
208
|
-
if (appIsActive && !sentHybridSdkDidBecomeActive
|
|
209
|
-
&& (PrivateSentrySDKOnly.options.enableAutoSessionTracking
|
|
210
|
-
|| PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking)) {
|
|
211
|
-
// Updates Native App State Manager
|
|
212
|
-
// https://github.com/getsentry/sentry-cocoa/blob/888a145b144b8077e03151a886520f332e47e297/Sources/Sentry/SentryAppStateManager.m#L136
|
|
213
|
-
// Triggers Session Tracker
|
|
214
|
-
// https://github.com/getsentry/sentry-cocoa/blob/888a145b144b8077e03151a886520f332e47e297/Sources/Sentry/SentrySessionTracker.m#L144
|
|
215
|
-
[[NSNotificationCenter defaultCenter] postNotificationName:@"SentryHybridSdkDidBecomeActive"
|
|
216
|
-
object:nil];
|
|
217
|
-
|
|
218
|
-
sentHybridSdkDidBecomeActive = true;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
@end
|