@coralogix/react-native-plugin 0.2.8 → 0.2.9
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/CHANGELOG.md +6 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/cxsdk/CxSdkModule.kt +39 -5
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/android/build.gradle
CHANGED
|
@@ -75,7 +75,7 @@ dependencies {
|
|
|
75
75
|
implementation "com.facebook.react:react-android"
|
|
76
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
77
|
|
|
78
|
-
implementation "com.coralogix:android-sdk:2.
|
|
78
|
+
implementation "com.coralogix:android-sdk:2.7.2"
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
react {
|
|
@@ -16,6 +16,8 @@ import com.coralogix.android.sdk.model.Framework
|
|
|
16
16
|
import com.coralogix.android.sdk.model.HybridMetric
|
|
17
17
|
import com.coralogix.android.sdk.model.Instrumentation
|
|
18
18
|
import com.coralogix.android.sdk.model.MobileVitalType
|
|
19
|
+
import com.coralogix.android.sdk.model.TraceParentInHeaderConfig
|
|
20
|
+
import com.coralogix.android.sdk.model.TraceParentInHeaderConfigOptions
|
|
19
21
|
import com.coralogix.android.sdk.model.UserContext
|
|
20
22
|
import com.coralogix.android.sdk.model.ViewContext
|
|
21
23
|
import com.coralogix.android.sdk.session_replay.SessionReplay
|
|
@@ -34,7 +36,6 @@ import com.facebook.react.bridge.WritableMap
|
|
|
34
36
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
35
37
|
import org.json.JSONArray
|
|
36
38
|
import org.json.JSONObject
|
|
37
|
-
import java.lang.Long.getLong
|
|
38
39
|
import com.facebook.react.uimanager.UIManagerModule
|
|
39
40
|
|
|
40
41
|
class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
@@ -308,9 +309,22 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
308
309
|
?: throw IllegalArgumentException("Missing required parameter: coralogixDomain")
|
|
309
310
|
|
|
310
311
|
val traceParentInHeaderMap = getMap("traceParentInHeader")
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
|
|
313
|
+
val allowedTracingUrls = traceParentInHeaderMap
|
|
314
|
+
?.getMap("options")
|
|
315
|
+
?.getArray("allowedTracingUrls")
|
|
316
|
+
?.toStringList()
|
|
317
|
+
?: emptyList()
|
|
318
|
+
|
|
319
|
+
val traceParentInHeaderConfig = traceParentInHeaderMap?.let {
|
|
320
|
+
TraceParentInHeaderConfig(
|
|
321
|
+
enabled = if (it.hasKey("enabled")) it.getBoolean("enabled") else false,
|
|
322
|
+
options = TraceParentInHeaderConfigOptions(
|
|
323
|
+
allowedTracingUrls = allowedTracingUrls
|
|
324
|
+
)
|
|
325
|
+
)
|
|
326
|
+
} ?: TraceParentInHeaderConfig()
|
|
327
|
+
|
|
314
328
|
val collectIpData = if (hasKey("collectIPData")) getBoolean("collectIPData") else true
|
|
315
329
|
|
|
316
330
|
return CoralogixOptions(
|
|
@@ -327,7 +341,7 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
327
341
|
ignoreUrls = getArray("ignoreUrls")?.handleStringOrRegexList() ?: listOf(),
|
|
328
342
|
ignoreErrors = getArray("ignoreErrors")?.handleStringOrRegexList() ?: listOf(),
|
|
329
343
|
sessionSampleRate = 100,
|
|
330
|
-
traceParentInHeader =
|
|
344
|
+
traceParentInHeader = traceParentInHeaderConfig,
|
|
331
345
|
debug = if (hasKey("debug")) getBoolean("debug") else false,
|
|
332
346
|
proxyUrl = getString("proxyUrl"),
|
|
333
347
|
beforeSendCallback = ::beforeSendCallback,
|
|
@@ -573,6 +587,26 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
573
587
|
return result
|
|
574
588
|
}
|
|
575
589
|
|
|
590
|
+
private fun ReadableArray?.toStringList(): List<String> {
|
|
591
|
+
if (this == null) return emptyList()
|
|
592
|
+
|
|
593
|
+
return try {
|
|
594
|
+
val result = mutableListOf<String>()
|
|
595
|
+
|
|
596
|
+
for (i in 0 until size()) {
|
|
597
|
+
if (getType(i) == ReadableType.String) {
|
|
598
|
+
result.add(getString(i))
|
|
599
|
+
} else {
|
|
600
|
+
Log.w("CxSdkModule", "Value at $i in ReadableArray is of type ${getType(i)}, expecting String, skipping value")
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
result
|
|
605
|
+
} catch (_: Exception) {
|
|
606
|
+
emptyList()
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
576
610
|
private fun ReadableMap.toJsonObject(): JSONObject {
|
|
577
611
|
val obj = JSONObject()
|
|
578
612
|
val iterator = keySetIterator()
|
package/index.cjs.js
CHANGED
package/index.esm.js
CHANGED