@logrocket/react-native 1.25.1 → 1.26.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.
@@ -19,7 +19,7 @@ static NSMutableDictionary<NSString *, LROResponseBuilder *> *capturedRequests;
19
19
  return self;
20
20
  }
21
21
 
22
- -(void)handleError:(NSNotification*)notification {
22
+ - (void)handleError:(NSNotification*)notification {
23
23
  NSString *errorMessage = notification.userInfo[@"errorMessage"];
24
24
  NSNumber *shouldDisableAndFreeMemory = notification.userInfo[@"shouldDisableAndFreeMemory"];
25
25
  NSNumber *shouldWarnAboutReduxSize = notification.userInfo[@"shouldWarnAboutReduxSize"];
@@ -35,6 +35,93 @@ static NSMutableDictionary<NSString *, LROResponseBuilder *> *capturedRequests;
35
35
  return @[@"LogRocketSDKOnError"];
36
36
  }
37
37
 
38
+ + (nullable LROConfiguration *)
39
+ createConfig:(NSString *)appID
40
+ config:(NSDictionary *)config
41
+ {
42
+ NSString *serverURL = config[@"serverURL"];
43
+ NSMutableSet<NSString *> *allowTags = [NSMutableSet setWithArray:config[@"allowTags"]];
44
+ [allowTags addObject:@"lr-show"];
45
+ NSMutableSet<NSString *> *redactionTags = [NSMutableSet setWithArray:config[@"redactionTags"]];
46
+ [redactionTags addObject:@"lr-hide"];
47
+
48
+ LROConfiguration *configuration = [[LROConfiguration alloc] initWithAppID:appID];
49
+
50
+ configuration.serverURL = serverURL;
51
+ configuration.allowTags = allowTags;
52
+ configuration.redactionTags = redactionTags;
53
+ configuration.viewScanningEnabled = YES;
54
+ configuration.networkCaptureEnabled = NO;
55
+ configuration.logCaptureEnabled = YES;
56
+ configuration.requestSanitizer = nil;
57
+ configuration.responseSanitizer = nil;
58
+ configuration.registerTouchHandlers = YES;
59
+
60
+ // Entries in the dictionary can be NSNull. Especially, on React-Native, this can happen.
61
+ id enablePersistence = config[@"enablePersistence"];
62
+ if (enablePersistence != nil && ![enablePersistence isEqual:[NSNull null]]) {
63
+ configuration.persistenceEnabled = [enablePersistence boolValue];
64
+ } else {
65
+ configuration.persistenceEnabled = YES;
66
+ }
67
+
68
+ if ([config[@"textSanitizer"] isEqualToString:@"excluded"]) {
69
+ configuration.textSanitizer = LROSanitizerTypeExcluded;
70
+ } else {
71
+ configuration.textSanitizer = LROSanitizerTypeNone;
72
+ }
73
+
74
+ id enableIPCapture = config[@"enableIPCapture"];
75
+ if (enableIPCapture != nil && ![enableIPCapture isEqual:[NSNull null]]) {
76
+ configuration.ipCaptureEnabled = [enableIPCapture boolValue];
77
+ } else {
78
+ configuration.ipCaptureEnabled = YES;
79
+ }
80
+
81
+ id experimentalBidiCapture = config[@"experimentalBidiCapture"];
82
+ if (experimentalBidiCapture != nil && ![experimentalBidiCapture isEqual:[NSNull null]]) {
83
+ configuration.experimentalBidiCapture = [experimentalBidiCapture boolValue];
84
+ } else {
85
+ configuration.experimentalBidiCapture = NO;
86
+ }
87
+
88
+ id proxyConfiguration = config[@"iosProxyConfiguration"];
89
+ if (
90
+ proxyConfiguration != nil &&
91
+ ![proxyConfiguration isEqual:[NSNull null]] &&
92
+ [proxyConfiguration isKindOfClass: [NSDictionary class]]
93
+ ) {
94
+ LROProxyConfigurationBuilder *builder = [[LROProxyConfigurationBuilder alloc] init];
95
+
96
+ if (proxyConfiguration[@"proxyUsername"]) {
97
+ [builder proxyUsername:proxyConfiguration[@"proxyUsername"]];
98
+ }
99
+
100
+ if (proxyConfiguration[@"proxyPassword"]) {
101
+ [builder proxyPassword:proxyConfiguration[@"proxyPassword"]];
102
+ }
103
+
104
+ if (proxyConfiguration[@"httpEnable"]) {
105
+ [builder httpEnable:proxyConfiguration[@"httpEnable"]];
106
+ }
107
+
108
+ if (proxyConfiguration[@"httpProxy"]) {
109
+ [builder httpProxy:proxyConfiguration[@"httpProxy"]];
110
+ }
111
+
112
+ if (proxyConfiguration[@"httpPort"]) {
113
+ [builder httpPort: [proxyConfiguration[@"httpPort"] unsignedIntValue]];
114
+ }
115
+
116
+ configuration.proxyConfiguration = builder;
117
+ }
118
+
119
+ if ([config[@"uploadIntervalMs"] isKindOfClass:[NSNumber class]]) {
120
+ configuration.uploadIntervalMs = [config[@"uploadIntervalMs"] unsignedIntValue];
121
+ }
122
+ return configuration;
123
+ }
124
+
38
125
 
39
126
  RCT_EXPORT_METHOD(addLog:(NSString *)level args:(NSArray *)args)
40
127
  {
@@ -163,86 +250,7 @@ RCT_EXPORT_METHOD(initWithConfig:(NSString *)appID
163
250
  rejecter:(RCTPromiseRejectBlock)reject)
164
251
  {
165
252
  @try {
166
- NSString *serverURL = config[@"serverURL"];
167
- NSMutableSet<NSString *> *allowTags = [NSMutableSet setWithArray:config[@"allowTags"]];
168
- [allowTags addObject:@"lr-show"];
169
- NSMutableSet<NSString *> *redactionTags = [NSMutableSet setWithArray:config[@"redactionTags"]];
170
- [redactionTags addObject:@"lr-hide"];
171
-
172
- LROConfiguration *configuration = [[LROConfiguration alloc] initWithAppID:appID];
173
-
174
- configuration.serverURL = serverURL;
175
- configuration.allowTags = allowTags;
176
- configuration.redactionTags = redactionTags;
177
- configuration.viewScanningEnabled = YES;
178
- configuration.networkCaptureEnabled = NO;
179
- configuration.logCaptureEnabled = YES;
180
- configuration.requestSanitizer = nil;
181
- configuration.responseSanitizer = nil;
182
- configuration.registerTouchHandlers = YES;
183
-
184
- // Entries in the dictionary can be NSNull. Especially, on React-Native, this can happen.
185
- id enablePersistence = config[@"enablePersistence"];
186
- if (enablePersistence != nil && ![enablePersistence isEqual:[NSNull null]]) {
187
- configuration.persistenceEnabled = [enablePersistence boolValue];
188
- } else {
189
- configuration.persistenceEnabled = YES;
190
- }
191
-
192
- if ([config[@"textSanitizer"] isEqualToString:@"excluded"]) {
193
- configuration.textSanitizer = LROSanitizerTypeExcluded;
194
- } else {
195
- configuration.textSanitizer = LROSanitizerTypeNone;
196
- }
197
-
198
- id enableIPCapture = config[@"enableIPCapture"];
199
- if (enableIPCapture != nil && ![enableIPCapture isEqual:[NSNull null]]) {
200
- configuration.ipCaptureEnabled = [enableIPCapture boolValue];
201
- } else {
202
- configuration.ipCaptureEnabled = YES;
203
- }
204
-
205
- id experimentalBidiCapture = config[@"experimentalBidiCapture"];
206
- if (experimentalBidiCapture != nil && ![experimentalBidiCapture isEqual:[NSNull null]]) {
207
- configuration.experimentalBidiCapture = [experimentalBidiCapture boolValue];
208
- } else {
209
- configuration.experimentalBidiCapture = NO;
210
- }
211
-
212
- id proxyConfiguration = config[@"iosProxyConfiguration"];
213
- if (
214
- proxyConfiguration != nil &&
215
- ![proxyConfiguration isEqual:[NSNull null]] &&
216
- [proxyConfiguration isKindOfClass: [NSDictionary class]]
217
- ) {
218
- LROProxyConfigurationBuilder *builder = [[LROProxyConfigurationBuilder alloc] init];
219
-
220
- if (proxyConfiguration[@"proxyUsername"]) {
221
- [builder proxyUsername:proxyConfiguration[@"proxyUsername"]];
222
- }
223
-
224
- if (proxyConfiguration[@"proxyPassword"]) {
225
- [builder proxyPassword:proxyConfiguration[@"proxyPassword"]];
226
- }
227
-
228
- if (proxyConfiguration[@"httpEnable"]) {
229
- [builder httpEnable:proxyConfiguration[@"httpEnable"]];
230
- }
231
-
232
- if (proxyConfiguration[@"httpProxy"]) {
233
- [builder httpProxy:proxyConfiguration[@"httpProxy"]];
234
- }
235
-
236
- if (proxyConfiguration[@"httpPort"]) {
237
- [builder httpPort: [proxyConfiguration[@"httpPort"] unsignedIntValue]];
238
- }
239
-
240
- configuration.proxyConfiguration = builder;
241
- }
242
-
243
- if ([config[@"uploadIntervalMs"] isKindOfClass:[NSNumber class]]) {
244
- configuration.uploadIntervalMs = [config[@"uploadIntervalMs"] unsignedIntValue];
245
- }
253
+ LROConfiguration *configuration = [LogRocketNativeModule createConfig:appID config:config];
246
254
 
247
255
  BOOL result = [LROSDK initializeInternalWithConfiguration:configuration];
248
256
  resolve(@(result));
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,c,m,swift}"
17
17
  s.requires_arc = true
18
18
 
19
- s.dependency "LogRocket", "1.25.1"
19
+ s.dependency "LogRocket", "1.26.0"
20
20
  s.dependency "React"
21
21
  end
22
22
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@logrocket/react-native",
3
3
  "title": "Logrocket Native Module",
4
- "version": "1.25.1",
4
+ "version": "1.26.0",
5
5
  "description": "LogRocket SDK for react-native",
6
6
  "typings": "types.d.ts",
7
7
  "files": [
package/types.d.ts CHANGED
@@ -55,6 +55,7 @@ interface IOptions {
55
55
  * Does not impact captureException or aggregation of console errors
56
56
  */
57
57
  shouldDetectExceptions?: boolean,
58
+ forceCleanStart?: boolean,
58
59
  }
59
60
 
60
61
  type IosProxyConfiguration = {
@@ -121,6 +122,8 @@ interface ILogRocket {
121
122
  tagPage(relativePage: string): void;
122
123
  /** Register a web view with the SDK in order to link its recording to the current mobile one (Android-specific) */
123
124
  registerWebView(view: any): void;
125
+ startNewSession(appID: string, config?: IOptions): Promise<boolean> ;
126
+ startNewSessionSameConfig(): Promise<boolean>;
124
127
  }
125
128
 
126
129
  export function LRAllowProps(allowTag: string = 'lr-show');