Skip to content

Commit ddaa8a1

Browse files
authored
ref: Remove enableSessionReplayInUnreliableEnvironment use (#6046)
* ref: Remove enableSessionReplayInUnreliableEnvironment use * refactor: Remove isSessionReplayEnabled parameter * Run `yarn fix`
1 parent 4525cbe commit ddaa8a1

8 files changed

Lines changed: 25 additions & 245 deletions

File tree

packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m

Lines changed: 19 additions & 200 deletions
Large diffs are not rendered by default.

packages/core/ios/RNSentryExperimentalOptions.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ NS_ASSUME_NONNULL_BEGIN
2828
*/
2929
+ (void)setEnableLogs:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions;
3030

31-
/**
32-
* Sets the enableSessionReplayInUnreliableEnvironment experimental option on SentryOptions
33-
* @param sentryOptions The SentryOptions instance to configure
34-
* @param enabled Whether enableSessionReplayInUnreliableEnvironment from sentry Cocoa should be
35-
* enabled
36-
*/
37-
+ (void)setEnableSessionReplayInUnreliableEnvironment:(BOOL)enabled
38-
sentryOptions:(SentryOptions *)sentryOptions;
39-
4031
/**
4132
* Configures iOS UI profiling options on SentryOptions
4233
* @param profilingOptions Dictionary containing profiling configuration

packages/core/ios/RNSentryExperimentalOptions.m

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ + (void)setEnableLogs:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions
2828
sentryOptions.enableLogs = enabled;
2929
}
3030

31-
+ (void)setEnableSessionReplayInUnreliableEnvironment:(BOOL)enabled
32-
sentryOptions:(SentryOptions *)sentryOptions
33-
{
34-
if (sentryOptions == nil) {
35-
return;
36-
}
37-
sentryOptions.experimental.enableSessionReplayInUnreliableEnvironment = enabled;
38-
}
39-
4031
+ (void)configureProfilingWithOptions:(NSDictionary *)profilingOptions
4132
sentryOptions:(SentryOptions *)sentryOptions
4233
{

packages/core/ios/RNSentryReplay.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
/**
55
* Updates the session replay options
6-
* @return true when session replay is enabled
76
*/
8-
+ (BOOL)updateOptions:(NSMutableDictionary *)options;
7+
+ (void)updateOptions:(NSMutableDictionary *)options;
98

109
+ (void)postInit;
1110

packages/core/ios/RNSentryReplay.mm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
@implementation RNSentryReplay {
1313
}
1414

15-
+ (BOOL)updateOptions:(NSMutableDictionary *)options
15+
+ (void)updateOptions:(NSMutableDictionary *)options
1616
{
1717
NSNumber *sessionSampleRate = options[@"replaysSessionSampleRate"];
1818
NSNumber *errorSampleRate = options[@"replaysOnErrorSampleRate"];
1919

2020
if (sessionSampleRate == nil && errorSampleRate == nil) {
2121
NSLog(@"Session replay disabled via configuration");
22-
return NO;
22+
return;
2323
}
2424

2525
NSLog(@"Setting up session replay");
@@ -45,8 +45,6 @@ + (BOOL)updateOptions:(NSMutableDictionary *)options
4545
@ { @"name" : REACT_NATIVE_SDK_NAME, @"version" : REACT_NATIVE_SDK_PACKAGE_VERSION }
4646
}
4747
forKey:@"sessionReplay"];
48-
return (errorSampleRate != nil && [errorSampleRate doubleValue] > 0)
49-
|| (sessionSampleRate != nil && [sessionSampleRate doubleValue] > 0);
5048
}
5149

5250
+ (NSArray *_Nonnull)getReplayRNRedactClasses:(NSDictionary *_Nullable)replayOptions

packages/core/ios/RNSentryStart.m

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
4444
NSMutableDictionary *mutableOptions = [options mutableCopy];
4545

4646
#if SENTRY_TARGET_REPLAY_SUPPORTED
47-
BOOL isSessionReplayEnabled = [RNSentryReplay updateOptions:mutableOptions];
48-
#else
49-
BOOL isSessionReplayEnabled = NO;
47+
[RNSentryReplay updateOptions:mutableOptions];
5048
#endif
5149

5250
SentryOptions *sentryOptions = [PrivateSentrySDKOnly optionsWithDictionary:mutableOptions
@@ -170,11 +168,6 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
170168
}
171169
}
172170

173-
if (isSessionReplayEnabled) {
174-
[RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
175-
sentryOptions:sentryOptions];
176-
}
177-
178171
return sentryOptions;
179172
}
180173

packages/core/ios/SentrySDKWrapper.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
+ (void)startWithOptions:(SentryOptions *)options;
1717

1818
+ (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
19-
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
2019
error:(NSError **)errorPointer;
2120

22-
+ (void)setupWithDictionary:(NSDictionary *)options
23-
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
24-
error:(NSError **)errorPointer;
21+
+ (void)setupWithDictionary:(NSDictionary *)options error:(NSError **)errorPointer;
2522

2623
+ (BOOL)debug;
2724

packages/core/ios/SentrySDKWrapper.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ + (void)configureScope:(void (^)(SentryScope *scope))callback
3131
}
3232

3333
+ (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
34-
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
3534
error:(NSError *__autoreleasing *)errorPointer
3635
{
3736
NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]];
@@ -115,10 +114,6 @@ + (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
115114
}
116115
}
117116

118-
if (isSessionReplayEnabled) {
119-
[RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
120-
sentryOptions:sentryOptions];
121-
}
122117
return sentryOptions;
123118
}
124119

@@ -132,12 +127,9 @@ + (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
132127
}
133128

134129
+ (void)setupWithDictionary:(NSDictionary *_Nonnull)options
135-
isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
136130
error:(NSError *_Nonnull *_Nonnull)errorPointer
137131
{
138-
SentryOptions *sentryOptions = [self createOptionsWithDictionary:options
139-
isSessionReplayEnabled:isSessionReplayEnabled
140-
error:errorPointer];
132+
SentryOptions *sentryOptions = [self createOptionsWithDictionary:options error:errorPointer];
141133
if (!options) {
142134
return;
143135
}

0 commit comments

Comments
 (0)