react-native-genius-sdk 1.0.5 → 1.0.7

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.
@@ -98,6 +98,6 @@ dependencies {
98
98
  //noinspection GradleDynamicVersion
99
99
  implementation "com.facebook.react:react-native:+"
100
100
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
101
- implementation("com.github.socal-ltd:GeniusSDK:1.0.14")
101
+ implementation("com.github.socal-ltd:GeniusSDK:1.0.15")
102
102
  }
103
103
 
@@ -64,7 +64,7 @@ fun logEvent(eventName: String, eventValue: ReadableMap, promise: Promise) {
64
64
  // Run logging asynchronously on IO thread
65
65
  scope.launch {
66
66
  try {
67
- geniusSdk.logEvent(eventName = eventName, eventValue = dataMap)
67
+ geniusSdk.logEvent(eventName = GeniusSDK.EventName.Custom(eventName), eventValue = dataMap)
68
68
 
69
69
  // Resolve the JS promise on Main thread
70
70
  withContext(Dispatchers.Main) {
@@ -50,10 +50,24 @@ class GeniusSdk: RCTEventEmitter {
50
50
 
51
51
  @objc(logEvent:withEventValue:withResolver:withRejecter:)
52
52
  func logEvent(
53
- eventName: String, eventValue: [String: Any], resolve: @escaping RCTPromiseResolveBlock,
53
+ eventName: String,
54
+ eventValue: [String: Any],
55
+ resolve: @escaping RCTPromiseResolveBlock,
54
56
  reject: @escaping RCTPromiseRejectBlock
55
57
  ) {
56
- geniusSdk.logEvent(eventName: eventName, eventValue: eventValue)
58
+ // Run async code in a Swift concurrency Task
59
+ Task {
60
+ do {
61
+ // Await the async SDK method
62
+ await self.geniusSdk.logEvent(eventName: .custom(eventName), eventValue: eventValue)
63
+
64
+ // Resolve the JS promise after completion
65
+ resolve(true)
66
+ } catch {
67
+ // Reject the JS promise if an error occurs
68
+ reject("logEvent_ERROR", error.localizedDescription, error)
69
+ }
70
+ }
57
71
  }
58
72
 
59
73
  @objc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-genius-sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "A react native package for GeniusSDK",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
21
21
 
22
22
  s.source_files = "ios/**/*.{h,m,mm,swift}"
23
23
 
24
- s.dependency 'GeniusSDKFramework', '1.0.7'
24
+ s.dependency 'GeniusSDKFramework', '1.0.8'
25
25
 
26
26
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
27
27
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.