react-native-gizwits-sdk-v5 1.3.19 → 1.3.21

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.
@@ -65,10 +65,10 @@ dependencies {
65
65
 
66
66
  implementation "androidx.startup:startup-runtime:$startup_version"
67
67
 
68
- implementation("io.github.gizwits:sdk:1.0.18")
69
- implementation("io.github.gizwits:sdk-bluetooth:1.0.18")
70
- implementation("io.github.gizwits:sdk-lan:1.0.18")
71
- implementation("io.github.gizwits:sdk-mqtt:1.0.18")
68
+ implementation("io.github.gizwits:sdk:1.0.23")
69
+ implementation("io.github.gizwits:sdk-bluetooth:1.0.23")
70
+ implementation("io.github.gizwits:sdk-lan:1.0.23")
71
+ implementation("io.github.gizwits:sdk-mqtt:1.0.23")
72
72
 
73
73
  // implementation files('libs/sdk-release.aar', 'libs/sdk-bluetooth-release.aar', 'libs/sdk-lan-release.aar', 'libs/sdk-mqtt-release.aar')
74
74
 
@@ -98,7 +98,7 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
98
98
  // 新增的设备挂监听
99
99
  // 被移除的设备携程会自动销毁
100
100
  scope.launch {
101
- dev.bleCapacity.subscribeStatus().drop(1).debounce(500).collectLatest{
101
+ dev.bleCapacity.subscribeStatus().debounce(500).collectLatest{
102
102
  val data = JSONObject()
103
103
  data.put("state", it.toInt())
104
104
  data.put("type", "BLE")
@@ -106,15 +106,15 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
106
106
  sendEvent(EventName.DeviceStateListener.name, GizRNCallbackManager.jsonObject2WriteableMap(data))
107
107
  }
108
108
  }
109
+ // scope.launch {
110
+ // dev.bleCapacity.subscribeModuleProfile().debounce(500).collectLatest{
111
+ // if (it != null) {
112
+ // emitDeviceListChange()
113
+ // }
114
+ // }
115
+ // }
109
116
  scope.launch {
110
- dev.bleCapacity.subscribeModuleProfile().drop(1).debounce(500).collectLatest{
111
- if (it != null) {
112
- emitDeviceListChange()
113
- }
114
- }
115
- }
116
- scope.launch {
117
- dev.bleCapacity.subscribeDp().drop(1).collect{
117
+ dev.bleCapacity.subscribeDp().collect{
118
118
  val data = JSONObject()
119
119
  data.put("data", JSONObject(it.toString()))
120
120
  data.put("type", "BLE")
@@ -125,7 +125,7 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
125
125
 
126
126
 
127
127
  scope.launch {
128
- dev.lanCapacity.subscribeStatus().drop(1).debounce(500).collectLatest{
128
+ dev.lanCapacity.subscribeStatus().debounce(500).collectLatest{
129
129
  val data = JSONObject()
130
130
  data.put("state", it.toInt())
131
131
  data.put("type", "LAN")
@@ -133,15 +133,15 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
133
133
  sendEvent(EventName.DeviceStateListener.name, GizRNCallbackManager.jsonObject2WriteableMap(data))
134
134
  }
135
135
  }
136
+ // scope.launch {
137
+ // dev.lanCapacity.subscribeModuleProfile().debounce(500).collectLatest{
138
+ // if (it != null) {
139
+ // emitDeviceListChange()
140
+ // }
141
+ // }
142
+ // }
136
143
  scope.launch {
137
- dev.lanCapacity.subscribeModuleProfile().drop(1).debounce(500).collectLatest{
138
- if (it != null) {
139
- emitDeviceListChange()
140
- }
141
- }
142
- }
143
- scope.launch {
144
- dev.lanCapacity.subscribeDp().drop(1).collect{
144
+ dev.lanCapacity.subscribeDp().collect{
145
145
  val data = JSONObject()
146
146
  data.put("data", JSONObject(it.toString()))
147
147
  data.put("type", "LAN")
@@ -152,7 +152,7 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
152
152
 
153
153
 
154
154
  scope.launch {
155
- dev.mqttCapacity.subscribeStatus().drop(1).debounce(500).collectLatest{
155
+ dev.mqttCapacity.subscribeStatus().debounce(500).collectLatest{
156
156
  val data = JSONObject()
157
157
  data.put("state", it.toInt())
158
158
  data.put("type", "MQTT")
@@ -160,15 +160,15 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
160
160
  sendEvent(EventName.DeviceStateListener.name, GizRNCallbackManager.jsonObject2WriteableMap(data))
161
161
  }
162
162
  }
163
+ // scope.launch {
164
+ // dev.mqttCapacity.subscribeModuleProfile().debounce(500).collectLatest{
165
+ // if (it != null) {
166
+ // emitDeviceListChange()
167
+ // }
168
+ // }
169
+ // }
163
170
  scope.launch {
164
- dev.mqttCapacity.subscribeModuleProfile().drop(1).debounce(500).collectLatest{
165
- if (it != null) {
166
- emitDeviceListChange()
167
- }
168
- }
169
- }
170
- scope.launch {
171
- dev.mqttCapacity.subscribeDp().drop(1).collect{
171
+ dev.mqttCapacity.subscribeDp().collect{
172
172
  val data = JSONObject()
173
173
  data.put("data", JSONObject(it.toString()))
174
174
  data.put("type", "MQTT")
@@ -191,7 +191,6 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
191
191
  // 缓存变更
192
192
  val deviceListJson = JSONArray()
193
193
  deviceList.forEach{ item ->
194
- val state = item.bleCapacity.subscribeStatus().value
195
194
  deviceListJson.put(item.toJsonObject())
196
195
  }
197
196
  sendEvent(EventName.DeviceListListener.name, GizRNCallbackManager.jsonArray2WriteableArray(deviceListJson))
@@ -257,6 +256,7 @@ class RNGizSDKManagerModule(reactContext: ReactApplicationContext) : ReactContex
257
256
  writableMap.putInt("error", 0)
258
257
  writableMap.putString("message", "")
259
258
  result.invoke(null, writableMap)
259
+ emitDeviceListChange()
260
260
  }
261
261
  }
262
262
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gizwits-sdk-v5",
3
- "version": "1.3.19",
3
+ "version": "1.3.21",
4
4
  "description": "Gizwits",
5
5
  "homepage": "https://github.com/demchenkoalex/react-native-gizwits-sdk-v5#readme",
6
6
  "main": "lib/index.js",