-
-
Notifications
You must be signed in to change notification settings - Fork 359
Expand file tree
/
Copy pathRNSentryExperimentalOptions.m
More file actions
81 lines (71 loc) · 2.84 KB
/
RNSentryExperimentalOptions.m
File metadata and controls
81 lines (71 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#import "RNSentryExperimentalOptions.h"
#import <Sentry/SentryProfilingConditionals.h>
@import Sentry;
@implementation RNSentryExperimentalOptions
+ (void)setEnableUnhandledCPPExceptionsV2:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions
{
if (sentryOptions == nil) {
return;
}
sentryOptions.experimental.enableUnhandledCPPExceptionsV2 = enabled;
}
+ (BOOL)getEnableUnhandledCPPExceptionsV2:(SentryOptions *)sentryOptions
{
if (sentryOptions == nil) {
return NO;
}
return sentryOptions.experimental.enableUnhandledCPPExceptionsV2;
}
+ (void)setEnableLogs:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions
{
if (sentryOptions == nil) {
return;
}
sentryOptions.enableLogs = enabled;
}
+ (void)setEnableSessionReplayInUnreliableEnvironment:(BOOL)enabled
sentryOptions:(SentryOptions *)sentryOptions
{
if (sentryOptions == nil) {
return;
}
// sentryOptions.experimental.enableSessionReplayInUnreliableEnvironment = enabled;
}
+ (void)configureProfilingWithOptions:(NSDictionary *)profilingOptions
sentryOptions:(SentryOptions *)sentryOptions
{
#if SENTRY_TARGET_PROFILING_SUPPORTED
if (sentryOptions == nil || profilingOptions == nil) {
return;
}
sentryOptions.configureProfiling = ^(SentryProfileOptions *_Nonnull profiling) {
// Set session sample rate
id profileSessionSampleRate = profilingOptions[@"profileSessionSampleRate"];
if (profileSessionSampleRate != nil &&
[profileSessionSampleRate isKindOfClass:[NSNumber class]]) {
profiling.sessionSampleRate = [profileSessionSampleRate floatValue];
NSLog(@"Sentry: UI Profiling sessionSampleRate set to: %.2f",
profiling.sessionSampleRate);
}
// Set lifecycle mode
NSString *lifecycle = profilingOptions[@"lifecycle"];
if ([lifecycle isKindOfClass:[NSString class]]) {
if ([lifecycle caseInsensitiveCompare:@"manual"] == NSOrderedSame) {
profiling.lifecycle = SentryProfileLifecycleManual;
NSLog(@"Sentry: UI Profiling Lifecycle set to MANUAL");
} else if ([lifecycle caseInsensitiveCompare:@"trace"] == NSOrderedSame) {
profiling.lifecycle = SentryProfileLifecycleTrace;
NSLog(@"Sentry: UI Profiling Lifecycle set to TRACE");
}
}
// Set profile app starts
id startOnAppStart = profilingOptions[@"startOnAppStart"];
if (startOnAppStart != nil && [startOnAppStart isKindOfClass:[NSNumber class]]) {
profiling.profileAppStarts = [startOnAppStart boolValue];
NSLog(@"Sentry: UI Profiling profileAppStarts set to %@",
profiling.profileAppStarts ? @"YES" : @"NO");
}
};
#endif
}
@end