@oscilar/react-native-oscilar-module 3.3.0 → 3.4.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.
package/OscilarModule.podspec
CHANGED
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
14
|
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
-
s.source = { :git => "https://github.com/Oscilar/react-native-oscilar-module.git", :tag => "#{s.version}" }
|
|
15
|
+
s.source = { :git => "https://github.com/Oscilar/react-native-oscilar-module.git", :tag => "v#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
package/android/build.gradle
CHANGED
|
@@ -95,10 +95,11 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
95
95
|
dependencies {
|
|
96
96
|
implementation "com.facebook.react:react-android"
|
|
97
97
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
98
|
-
implementation "
|
|
99
|
-
implementation "com.
|
|
100
|
-
implementation "com.
|
|
101
|
-
implementation "com.squareup.retrofit2:
|
|
102
|
-
implementation "
|
|
98
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2"
|
|
99
|
+
implementation "com.oscilar:osclib:3.5.0"
|
|
100
|
+
implementation "com.google.code.gson:gson:2.13.2"
|
|
101
|
+
implementation "com.squareup.retrofit2:retrofit:3.0.0"
|
|
102
|
+
implementation "com.squareup.retrofit2:converter-gson:3.0.0"
|
|
103
|
+
implementation "androidx.work:work-runtime-ktx:2.11.0"
|
|
103
104
|
}
|
|
104
105
|
|
|
@@ -9,14 +9,27 @@ import android.util.Log
|
|
|
9
9
|
import com.osc.and.OscApi
|
|
10
10
|
import com.osc.and.OscApiInterface
|
|
11
11
|
import com.osc.and.OscEnv
|
|
12
|
+
import kotlinx.coroutines.CancellationException
|
|
13
|
+
import kotlinx.coroutines.CoroutineScope
|
|
14
|
+
import kotlinx.coroutines.Dispatchers
|
|
15
|
+
import kotlinx.coroutines.SupervisorJob
|
|
16
|
+
import kotlinx.coroutines.launch
|
|
17
|
+
import kotlinx.coroutines.cancel
|
|
12
18
|
|
|
13
19
|
class OscilarModuleModule(reactContext: ReactApplicationContext) :
|
|
14
20
|
ReactContextBaseJavaModule(reactContext) {
|
|
15
21
|
|
|
22
|
+
private val moduleScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
|
23
|
+
|
|
16
24
|
override fun getName(): String {
|
|
17
25
|
return NAME
|
|
18
26
|
}
|
|
19
27
|
|
|
28
|
+
override fun invalidate() {
|
|
29
|
+
moduleScope.cancel()
|
|
30
|
+
super.invalidate()
|
|
31
|
+
}
|
|
32
|
+
|
|
20
33
|
private lateinit var oscApiInt: OscApiInterface
|
|
21
34
|
|
|
22
35
|
@ReactMethod
|
|
@@ -58,15 +71,18 @@ class OscilarModuleModule(reactContext: ReactApplicationContext) :
|
|
|
58
71
|
}
|
|
59
72
|
}
|
|
60
73
|
|
|
61
|
-
// New method to get transaction ID
|
|
62
74
|
@ReactMethod
|
|
63
75
|
fun generateTransactionID(promise: Promise) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
moduleScope.launch {
|
|
77
|
+
try {
|
|
78
|
+
val transactionId = oscApiInt.getTransactionIdAsync(reactApplicationContext)
|
|
79
|
+
Log.d("OscilarModule", "Transaction ID: $transactionId")
|
|
80
|
+
promise.resolve(transactionId)
|
|
81
|
+
} catch (e: CancellationException) {
|
|
82
|
+
promise.reject("CANCELLED", "Operation was cancelled", e)
|
|
83
|
+
} catch (e: Exception) {
|
|
84
|
+
promise.reject("ERROR_GETTING_TRANSACTION_ID", e)
|
|
85
|
+
}
|
|
70
86
|
}
|
|
71
87
|
}
|
|
72
88
|
|
|
@@ -75,17 +91,22 @@ class OscilarModuleModule(reactContext: ReactApplicationContext) :
|
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
@ReactMethod
|
|
78
|
-
fun getIntegrationHealthInfo(promise: Promise) {
|
|
79
|
-
|
|
80
|
-
|
|
94
|
+
fun getIntegrationHealthInfo(promise: Promise) {
|
|
95
|
+
moduleScope.launch {
|
|
96
|
+
try {
|
|
97
|
+
val healthInfo = oscApiInt.getIntegrationHealthInfoAsync(reactApplicationContext)
|
|
81
98
|
val writableMap = Arguments.createMap()
|
|
82
99
|
for ((key, value) in healthInfo) {
|
|
83
|
-
|
|
100
|
+
writableMap.putString(key, value)
|
|
84
101
|
}
|
|
85
102
|
Log.d("OscilarModule", "Integration Health Info: $healthInfo")
|
|
86
103
|
promise.resolve(writableMap)
|
|
87
|
-
|
|
104
|
+
} catch (e: CancellationException) {
|
|
105
|
+
promise.reject("CANCELLED", "Operation was cancelled", e)
|
|
106
|
+
} catch (e: Exception) {
|
|
88
107
|
promise.reject("ERROR_GETTING_HEALTH_INFO", e)
|
|
108
|
+
}
|
|
89
109
|
}
|
|
90
|
-
}
|
|
110
|
+
}
|
|
111
|
+
|
|
91
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oscilar/react-native-oscilar-module",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Oscilar module for React Native",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"react": "19.0.0",
|
|
90
90
|
"react-native": "^0.79.1",
|
|
91
91
|
"react-native-builder-bob": "^0.37.0",
|
|
92
|
-
"release-it": "^19.
|
|
92
|
+
"release-it": "^19.2.4",
|
|
93
93
|
"turbo": "^1.10.7",
|
|
94
94
|
"typescript": "^5.2.2",
|
|
95
95
|
"wait-on": "^8.0.4"
|
|
@@ -104,7 +104,11 @@
|
|
|
104
104
|
"js-yaml": "^4.1.1",
|
|
105
105
|
"tmp": "^0.2.4",
|
|
106
106
|
"brace-expansion": "^2.0.2",
|
|
107
|
-
"on-headers": "^1.1.0"
|
|
107
|
+
"on-headers": "^1.1.0",
|
|
108
|
+
"qs": "^6.14.1",
|
|
109
|
+
"tar": "^7.5.4",
|
|
110
|
+
"lodash": "^4.17.23",
|
|
111
|
+
"diff": "^4.0.4"
|
|
108
112
|
},
|
|
109
113
|
"peerDependencies": {
|
|
110
114
|
"react": "*",
|