react-native-gizwits-sdk-v5 1.0.7 → 1.0.8
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/ios/RNGizSDKManagerModule.swift +13 -5
- package/lib/index.js +3 -3
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -17,15 +17,23 @@ class RNGizSDKManagerModule: RCTEventEmitter, GizSdkEventHandlerDelegate {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
func onDeviceListUpdate(devices: Array<GizwitsiOSSDK.GizDevice>) {
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
var devicesDict: Array<Any> = []
|
|
22
|
+
devices.forEach { d in
|
|
23
|
+
let dev = GizRNCallbackManager.convertToDictionary(object: d)
|
|
24
|
+
if (dev != nil) {
|
|
25
|
+
devicesDict.append(dev!)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
sendEvent(withName: "DeviceListListener", body: devicesDict)
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
func onDeviceData(device: GizwitsiOSSDK.GizBaseProfile, result: GizwitsiOSSDK.GizJSON, type: GizwitsiOSSDK.GizCapability) {
|
|
24
32
|
let data = [
|
|
25
|
-
"device": GizRNCallbackManager.convertToDictionary(object: device),
|
|
33
|
+
"device": GizRNCallbackManager.convertToDictionary(object: device) ?? [:],
|
|
26
34
|
"data": result,
|
|
27
35
|
"type": type.rawValue
|
|
28
|
-
]
|
|
36
|
+
] as [String : Any]
|
|
29
37
|
sendEvent(withName: "DeviceDataListener", body: data)
|
|
30
38
|
}
|
|
31
39
|
|
|
@@ -34,7 +42,7 @@ class RNGizSDKManagerModule: RCTEventEmitter, GizSdkEventHandlerDelegate {
|
|
|
34
42
|
"device": GizRNCallbackManager.convertToDictionary(object: device),
|
|
35
43
|
"state": state.rawValue,
|
|
36
44
|
"type": type.rawValue
|
|
37
|
-
]
|
|
45
|
+
] as [String : Any]
|
|
38
46
|
sendEvent(withName: "DeviceStateListener", body: data)
|
|
39
47
|
}
|
|
40
48
|
override init() {
|
|
@@ -60,7 +68,7 @@ class RNGizSDKManagerModule: RCTEventEmitter, GizSdkEventHandlerDelegate {
|
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
@objc
|
|
63
|
-
public func getDevices(result: @escaping RCTResponseSenderBlock) {
|
|
71
|
+
public func getDevices(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
|
|
64
72
|
Task {
|
|
65
73
|
let data = await GizSDKManager.sharedInstance.getDevices()
|
|
66
74
|
GizRNCallbackManager.callbackWithResult(callback: result, result: GizResult<Array<GizDevice>?, GizAPIException?>(data: data, success: true))
|
package/lib/index.js
CHANGED
|
@@ -29,9 +29,9 @@ class RNGizSDKManagerModule extends Base {
|
|
|
29
29
|
callbacks.splice(index, 1);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
eventEmitter.addListener('
|
|
33
|
-
eventEmitter.addListener('
|
|
34
|
-
eventEmitter.addListener('
|
|
32
|
+
eventEmitter.addListener('DeviceDataListener', this.deviceDataCallback);
|
|
33
|
+
eventEmitter.addListener('DeviceListListener', this.deviceListCallback);
|
|
34
|
+
eventEmitter.addListener('DeviceStateListener', this.deviceStateCallback);
|
|
35
35
|
}
|
|
36
36
|
async initSDK(config) {
|
|
37
37
|
return this.callbackWapper((callback) => {
|
package/lib/types.d.ts
CHANGED