react-native-gizwits-sdk-v5 1.3.58 → 1.3.60

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.
@@ -63,10 +63,10 @@ dependencies {
63
63
 
64
64
  implementation "androidx.startup:startup-runtime:$startup_version"
65
65
 
66
- implementation("io.github.gizwits:sdk:1.0.46")
67
- implementation("io.github.gizwits:sdk-bluetooth:1.0.46")
68
- implementation("io.github.gizwits:sdk-lan:1.0.46")
69
- implementation("io.github.gizwits:sdk-mqtt:1.0.46")
66
+ implementation("io.github.gizwits:sdk:1.0.48")
67
+ implementation("io.github.gizwits:sdk-bluetooth:1.0.48")
68
+ implementation("io.github.gizwits:sdk-lan:1.0.48")
69
+ implementation("io.github.gizwits:sdk-mqtt:1.0.48")
70
70
 
71
71
  // implementation files('libs/sdk-release.aar', 'libs/sdk-bluetooth-release.aar', 'libs/sdk-lan-release.aar', 'libs/sdk-mqtt-release.aar')
72
72
 
@@ -35,6 +35,7 @@ object GizRNCallbackManager {
35
35
  result.exceptionOrNull()?.let {
36
36
  try {
37
37
  data.error = (it as GizException).errorCode
38
+ data.message = (it as GizException).localizedMessage
38
39
  } catch (e: Exception) {
39
40
 
40
41
  }
@@ -336,13 +336,16 @@ class RNGizDeviceManagerModule(reactContext: ReactApplicationContext) : ReactCon
336
336
  }
337
337
 
338
338
  fun handleStartUpgradeProgress(event: OTAProgressData, device: GizDevice) {
339
- val jsonObject = JSONObject()
340
- jsonObject.put("data", GizRNCallbackManager.convertToMap(event))
341
- jsonObject.put("device", device.toJsonObject())
342
- sendEvent(
343
- EventName.GizOTAProgressEvent.name,
344
- GizRNCallbackManager.jsonObject2WriteableMap(jsonObject)
345
- )
339
+ val jsonObject = JSONObject()
340
+ val dataObject = JSONObject()
341
+ dataObject.put("percentage", event.percentage)
342
+ dataObject.put("event", event.event.value)
343
+ jsonObject.put("data", dataObject)
344
+ jsonObject.put("device", device.toJsonObject())
345
+ sendEvent(
346
+ EventName.GizOTAProgressEvent.name,
347
+ GizRNCallbackManager.jsonObject2WriteableMap(jsonObject)
348
+ )
346
349
  }
347
350
  @ReactMethod
348
351
  fun startUpgrade(options: ReadableMap, result: Callback) {
@@ -350,9 +353,11 @@ class RNGizDeviceManagerModule(reactContext: ReactApplicationContext) : ReactCon
350
353
  if (config !=null && device !=null) {
351
354
  CoroutineScope(Dispatchers.Main).launch {
352
355
  val res = when(config.type) {
353
- CapacityTypes.BLE -> device.bleCapacity.startUpgrade(config.firmwareType, processHandler = {
356
+ CapacityTypes.BLE -> {
357
+ device.bleCapacity.startUpgrade(config.firmwareType, processHandler = {
354
358
  handleStartUpgradeProgress(it, device)
355
- })
359
+ })
360
+ }
356
361
  CapacityTypes.LAN -> device.lanCapacity.startUpgrade(config.firmwareType, processHandler = {
357
362
  handleStartUpgradeProgress(it, device)
358
363
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gizwits-sdk-v5",
3
- "version": "1.3.58",
3
+ "version": "1.3.60",
4
4
  "description": "Gizwits",
5
5
  "homepage": "https://github.com/demchenkoalex/react-native-gizwits-sdk-v5#readme",
6
6
  "main": "lib/index.js",