react-native-gizwits-sdk-v5 1.5.0-beta.2 → 1.5.0-beta.4

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.
@@ -80,6 +80,14 @@ struct ProvideWiFiCredentialsParams: Decodable {
80
80
  var password: String
81
81
  var timeout: Int
82
82
  }
83
+ struct ProvideWiFiCredentialsWithAirLinkParams: Decodable {
84
+ var type: GizwitsiOSSDK.GizCapability
85
+ var id: String
86
+ var ssid: String
87
+ var password: String
88
+ var timeout: Int
89
+ var productKey: String
90
+ }
83
91
  struct StopProvideWiFiCredentialsParams: Decodable {
84
92
  var type: GizwitsiOSSDK.GizCapability
85
93
  var id: String
@@ -436,9 +444,7 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
436
444
  case .GizMQTTCapability:
437
445
  data = await device.mqttCapability.provideWiFiCredentials(ssid: params.ssid, password: params.password, timeout: params.timeout, processHandler: progressHandler)
438
446
  break
439
- case .GizAirLinkCapability:
440
- data = await device.baseCapability.provideWiFiCredentials(ssid: params.ssid, password: params.password, timeout: params.timeout, processHandler: progressHandler, isAirLink: true)
441
- break
447
+ }
442
448
  GizRNCallbackManager.callbackWithResult(callback: result, result:data)
443
449
  }
444
450
  } else {
@@ -448,6 +454,24 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
448
454
 
449
455
  }
450
456
  }
457
+
458
+ @objc
459
+ public func provideWiFiCredentialsWithAirLink(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
460
+ if let params = RNGizParamsChecker.check(options: options, result: result, paramsType: ProvideWiFiCredentialsWithAirLinkParams.self) {
461
+ @Sendable func progressHandler(event: GizWiFiActivatorEvent) {
462
+ // 推送数据到 GizOTAProgressEvent
463
+ let data = [
464
+ "data": event.rawValue
465
+ ] as [String : Any]
466
+ sendEvent(withName: "GizProvideWiFiCredentialsEvent", body: data)
467
+ }
468
+ Task {
469
+ var data: GizResult<GizBaseProfile?, GizActivatorException?>
470
+ data = await ESPTouchSmartConfig.sharedInstance.provideWiFiCredentialsWithAirLink(ssid: params.ssid, password: params.password, timeout: params.timeout, productKey: params.productKey, processHandler: progressHandler)
471
+ GizRNCallbackManager.callbackWithResult(callback: result, result:data)
472
+ }
473
+ }
474
+ }
451
475
 
452
476
  @objc
453
477
  public func stopProvideWiFiCredentials(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gizwits-sdk-v5",
3
- "version": "1.5.0-beta.2",
3
+ "version": "1.5.0-beta.4",
4
4
  "description": "Gizwits",
5
5
  "homepage": "https://github.com/demchenkoalex/react-native-gizwits-sdk-v5#readme",
6
6
  "main": "lib/index.js",
@@ -19,6 +19,6 @@ Pod::Spec.new do |s|
19
19
 
20
20
  s.dependency 'React'
21
21
  s.dependency 'CryptoSwift', '~> 1.8.0'
22
- s.dependency 'GizwitsiOSSDK', '~> 1.7.5'
22
+ s.dependency 'GizwitsiOSSDK', '~> 1.7.7'
23
23
 
24
24
  end