@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.
@@ -13,7 +13,7 @@
13
13
  def DEFAULT_COMPILE_SDK_VERSION = 31
14
14
  def DEFAULT_MIN_SDK_VERSION = 21
15
15
  def DEFAULT_TARGET_SDK_VERSION = 31
16
- def SDK_VERSION = "1.25.1"
16
+ def SDK_VERSION = "1.26.0"
17
17
 
18
18
  def PACKAGE_ROOT_DIR = rootProject.name == 'LogRocket SDK' ? "$rootDir/../packages/@logrocket/react-native" : "$rootDir/..";
19
19
 
@@ -25,6 +25,7 @@ import com.logrocket.core.CustomEventBuilder;
25
25
  import com.logrocket.core.IdentifyHelper;
26
26
  import com.logrocket.core.LogRocketCore;
27
27
  import com.logrocket.core.SDK;
28
+ import com.logrocket.core.SDK.OptionsConfiguration;
28
29
  import com.logrocket.core.SDK.SanitizerType;
29
30
  import com.logrocket.core.TelemetryReporter;
30
31
  import com.logrocket.core.network.IRequestBuilder;
@@ -91,86 +92,7 @@ public class LogRocketNativeModule extends ReactContextBaseJavaModule {
91
92
  promise.resolve(
92
93
  SDK.init(
93
94
  this.reactContext,
94
- options -> {
95
- options.setAppID(appID);
96
-
97
- if (config == null) {
98
- return;
99
- }
100
-
101
- if (config.hasKey("serverURL")) {
102
- options.setServerURL(config.getString("serverURL"));
103
- }
104
-
105
- if (config.hasKey("enableIPCapture")) {
106
- options.setEnableIPCapture(config.getBoolean("enableIPCapture"));
107
- }
108
-
109
- if (config.hasKey("enableJetpackCompose")) {
110
- options.setEnableJetpackCompose(config.getBoolean("enableJetpackCompose"));
111
- }
112
-
113
- if (config.hasKey("uploadIntervalMs")) {
114
- options.setUploadIntervalMs(config.getInt("uploadIntervalMs"));
115
- }
116
-
117
- if (config.hasKey("viewScanIntervalSeconds")) {
118
- options.setViewScanIntervalSeconds(config.getInt("viewScanIntervalSeconds"));
119
- }
120
-
121
- if (config.hasKey("logLevel") && !config.isNull("logLevel")) {
122
- //noinspection ConstantConditions
123
- options.setLogLevel(SDK.LogLevel.fromString(config.getString("logLevel")));
124
- }
125
-
126
- if (config.hasKey("connectionType") && !config.isNull("connectionType")) {
127
- //noinspection ConstantConditions
128
- options.setConnectionType(
129
- SDK.ConnectionType.fromString(config.getString("connectionType")));
130
- }
131
-
132
- if (config.hasKey("allowTags")) {
133
- ReadableArray allowTags = config.getArray("allowTags");
134
- if (allowTags != null) {
135
- ArrayList<Object> tags = allowTags.toArrayList();
136
- for (Object tag : tags) {
137
- options.addAllowTag(tag);
138
- }
139
- }
140
- }
141
-
142
- if (config.hasKey("redactionTags")) {
143
- ReadableArray redactionTags = config.getArray("redactionTags");
144
- if (redactionTags != null) {
145
- ArrayList<Object> tags = redactionTags.toArrayList();
146
- for (Object tag : tags) {
147
- options.addRedactionTag(tag);
148
- }
149
- }
150
- }
151
-
152
- if (config.hasKey("enablePersistence")) {
153
- options.setEnablePersistence(config.getBoolean("enablePersistence"));
154
- }
155
-
156
- if (config.hasKey("shouldDetectExceptions")) {
157
- options.setShouldDetectExceptions(config.getBoolean("shouldDetectExceptions"));
158
- }
159
-
160
- if (config.hasKey("textSanitizer") && !config.isNull("textSanitizer")) {
161
- //noinspection ConstantConditions
162
- options.setTextSanitizer(
163
- SanitizerType.fromString(config.getString("textSanitizer")));
164
- }
165
-
166
- ReadableMap androidProxy = config.getMap("androidProxy");
167
- if (androidProxy != null) {
168
- options.setProxyHost(androidProxy.getString("host"));
169
- options.setProxyPort(androidProxy.getInt("port"));
170
- options.setProxyAuthHeaderName(androidProxy.getString("authHeaderName"));
171
- options.setProxyAuthHeaderValue(androidProxy.getString("authHeaderValue"));
172
- }
173
- }));
95
+ createOptionsConfiguration(appID, config)));
174
96
  } catch (Throwable th) {
175
97
  this.logger.error("Error during init", th);
176
98
  TelemetryReporter.sendErrorTelemetry(th);
@@ -542,4 +464,91 @@ public class LogRocketNativeModule extends ReactContextBaseJavaModule {
542
464
  }
543
465
  }
544
466
  }
467
+
468
+ private final OptionsConfiguration createOptionsConfiguration(String appID, ReadableMap config) {
469
+ return options -> {
470
+ options.setAppID(appID);
471
+
472
+ if (config == null) {
473
+ return;
474
+ }
475
+
476
+ if (config.hasKey("serverURL")) {
477
+ options.setServerURL(config.getString("serverURL"));
478
+ }
479
+
480
+ if (config.hasKey("enableIPCapture")) {
481
+ options.setEnableIPCapture(config.getBoolean("enableIPCapture"));
482
+ }
483
+
484
+ if (config.hasKey("enableJetpackCompose")) {
485
+ options.setEnableJetpackCompose(config.getBoolean("enableJetpackCompose"));
486
+ }
487
+
488
+ if (config.hasKey("forceCleanStart")) {
489
+ options.setForceCleanStart(config.getBoolean("forceCleanStart"));
490
+ }
491
+
492
+ if (config.hasKey("uploadIntervalMs")) {
493
+ options.setUploadIntervalMs(config.getInt("uploadIntervalMs"));
494
+ }
495
+
496
+ if (config.hasKey("viewScanIntervalSeconds")) {
497
+ options.setViewScanIntervalSeconds(config.getInt("viewScanIntervalSeconds"));
498
+ }
499
+
500
+ if (config.hasKey("logLevel") && !config.isNull("logLevel")) {
501
+ //noinspection ConstantConditions
502
+ options.setLogLevel(SDK.LogLevel.fromString(config.getString("logLevel")));
503
+ }
504
+
505
+ if (config.hasKey("connectionType") && !config.isNull("connectionType")) {
506
+ //noinspection ConstantConditions
507
+ options.setConnectionType(
508
+ SDK.ConnectionType.fromString(config.getString("connectionType")));
509
+ }
510
+
511
+ if (config.hasKey("allowTags")) {
512
+ ReadableArray allowTags = config.getArray("allowTags");
513
+ if (allowTags != null) {
514
+ ArrayList<Object> tags = allowTags.toArrayList();
515
+ for (Object tag : tags) {
516
+ options.addAllowTag(tag);
517
+ }
518
+ }
519
+ }
520
+
521
+ if (config.hasKey("redactionTags")) {
522
+ ReadableArray redactionTags = config.getArray("redactionTags");
523
+ if (redactionTags != null) {
524
+ ArrayList<Object> tags = redactionTags.toArrayList();
525
+ for (Object tag : tags) {
526
+ options.addRedactionTag(tag);
527
+ }
528
+ }
529
+ }
530
+
531
+ if (config.hasKey("enablePersistence")) {
532
+ options.setEnablePersistence(config.getBoolean("enablePersistence"));
533
+ }
534
+
535
+ if (config.hasKey("shouldDetectExceptions")) {
536
+ options.setShouldDetectExceptions(config.getBoolean("shouldDetectExceptions"));
537
+ }
538
+
539
+ if (config.hasKey("textSanitizer") && !config.isNull("textSanitizer")) {
540
+ //noinspection ConstantConditions
541
+ options.setTextSanitizer(
542
+ SanitizerType.fromString(config.getString("textSanitizer")));
543
+ }
544
+
545
+ ReadableMap androidProxy = config.getMap("androidProxy");
546
+ if (androidProxy != null) {
547
+ options.setProxyHost(androidProxy.getString("host"));
548
+ options.setProxyPort(androidProxy.getInt("port"));
549
+ options.setProxyAuthHeaderName(androidProxy.getString("authHeaderName"));
550
+ options.setProxyAuthHeaderValue(androidProxy.getString("authHeaderValue"));
551
+ }
552
+ };
553
+ }
545
554
  }