@log-drop/react-native 2.0.0 → 2.0.2

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.
@@ -4,12 +4,13 @@ import com.facebook.react.bridge.ReadableMap
4
4
 
5
5
  import io.logdrop.sdk.LogFlow
6
6
 
7
- fun readableMapToLogFlow(logFlowMap: ReadableMap?): LogFlow {
8
- val name = logFlowMap?.takeIf { it.hasKey("name") && !it.isNull("name") }?.getString("name") ?: ""
9
- val id = logFlowMap?.takeIf { it.hasKey("id") && !it.isNull("id") }?.getString("id") ?: ""
7
+ fun readableMapToLogFlow(logFlowMap: ReadableMap?): LogFlow? {
8
+ if (logFlowMap == null) return null
9
+ val name = logFlowMap.takeIf { it.hasKey("name") && !it.isNull("name") }?.getString("name") ?: return null
10
+ val id = logFlowMap.takeIf { it.hasKey("id") && !it.isNull("id") }?.getString("id") ?: return null
10
11
 
11
12
  val customAttributes: Map<String, String>? = logFlowMap
12
- ?.takeIf { it.hasKey("customAttributes") && !it.isNull("customAttributes") }
13
+ .takeIf { it.hasKey("customAttributes") && !it.isNull("customAttributes") }
13
14
  ?.getMap("customAttributes")
14
15
  ?.toStringMap()
15
16
 
@@ -19,29 +19,30 @@ class LogDropReactNative: NSObject, CLLocationManagerDelegate {
19
19
 
20
20
  @objc
21
21
  func initLogDrop(_ config: NSDictionary) {
22
- let builder = LogDropConfig.Builder()
23
-
24
- if let apiKey = config["apiKey"] as? String {
25
- builder.setApiKey(apiKey)
26
- }
27
-
28
- if let baseUrl = config["baseUrl"] as? String {
29
- builder.setBaseUrl(baseUrl)
30
- }
31
-
32
- if let defaultSDKDisabled = config["defaultSDKDisabled"] as? Bool {
33
- builder.setDefaultSDKDisabledValue(defaultSDKDisabled)
34
- }
35
-
36
- if let isLoggingEnabled = config["isLoggingEnabled"] as? Bool {
37
- builder.setLoggingEnabled(isLoggingEnabled)
22
+ DispatchQueue.main.async {
23
+ let builder = LogDropConfig.Builder()
24
+
25
+ if let apiKey = config["apiKey"] as? String {
26
+ builder.setApiKey(apiKey)
27
+ }
28
+
29
+ if let baseUrl = config["baseUrl"] as? String {
30
+ builder.setBaseUrl(baseUrl)
31
+ }
32
+
33
+ if let defaultSDKDisabled = config["defaultSDKDisabled"] as? Bool {
34
+ builder.setDefaultSDKDisabledValue(defaultSDKDisabled)
35
+ }
36
+
37
+ if let isLoggingEnabled = config["isLoggingEnabled"] as? Bool {
38
+ builder.setLoggingEnabled(isLoggingEnabled)
39
+ }
40
+
41
+ builder.setFrameworkType(.reactNative)
42
+
43
+ let logDropConfig = builder.build()
44
+ LogDrop.initialize(with: logDropConfig)
38
45
  }
39
-
40
-
41
- builder.setFrameworkType(.reactNative)
42
-
43
- let logDropConfig = builder.build()
44
- LogDrop.initialize(with: logDropConfig)
45
46
  }
46
47
 
47
48
  @objc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@log-drop/react-native",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "LogDrop React Native SDK",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",