From 8ccbad14291755f21ef05d9ac2d073936b459299 Mon Sep 17 00:00:00 2001 From: Robson Oliveira dos Santos Date: Sun, 17 Dec 2023 18:29:24 -0300 Subject: [PATCH] feat: update iOS DFU to version 4.14.0 --- CapacitorCommunityNordicDfu.podspec | 2 +- ios/Plugin/NordicDfu.swift | 2 +- ios/Plugin/NordicDfuPlugin.swift | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CapacitorCommunityNordicDfu.podspec b/CapacitorCommunityNordicDfu.podspec index 9f40763..c6c5646 100644 --- a/CapacitorCommunityNordicDfu.podspec +++ b/CapacitorCommunityNordicDfu.podspec @@ -14,5 +14,5 @@ Pod::Spec.new do |s| s.ios.deployment_target = '13.0' s.dependency 'Capacitor' s.swift_version = '5.1' - s.dependency 'iOSDFULibrary', '~> 4.13.0' + s.dependency 'iOSDFULibrary', '~> 4.14.0' end diff --git a/ios/Plugin/NordicDfu.swift b/ios/Plugin/NordicDfu.swift index 9575947..ac3250d 100644 --- a/ios/Plugin/NordicDfu.swift +++ b/ios/Plugin/NordicDfu.swift @@ -1,5 +1,5 @@ import Capacitor import CoreBluetooth -import iOSDFULibrary +import NordicDFU @objc public class NordicDfu: NSObject {} diff --git a/ios/Plugin/NordicDfuPlugin.swift b/ios/Plugin/NordicDfuPlugin.swift index 00f193e..7637d66 100644 --- a/ios/Plugin/NordicDfuPlugin.swift +++ b/ios/Plugin/NordicDfuPlugin.swift @@ -1,7 +1,7 @@ import Capacitor import CoreBluetooth import Foundation -import iOSDFULibrary +import NordicDFU import UserNotifications @objc(NordicDfuPlugin) @@ -18,7 +18,7 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel var notification: JSObject = [ "id": Int(request.identifier) ?? -1, "title": request.content.title, - "body": request.content.body + "body": request.content.body, ] if let userInfo = JSTypes.coerceDictionaryToJSObject(request.content.userInfo) { @@ -72,7 +72,7 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel return [ .badge, .sound, - .alert + .alert, ] } @@ -137,7 +137,7 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel "speed": currentSpeedBytesPerSecond / 1000, "avgSpeed": avgSpeedBytesPerSecond / 1000, "currentPart": part, - "partsTotal": totalParts + "partsTotal": totalParts, ] sendStateUpdate("DFU_PROGRESS", data) } @@ -145,7 +145,7 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel private func sendStateUpdate(_ state: String, _ data: JSObject = [:]) { let ret: JSObject = [ "state": state, - "data": data + "data": data, ] notifyListeners(dfuChangeEvent, data: ret) } @@ -238,7 +238,8 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel // } if let packetsReceiptNotificationsValueStr = dfuOption["packetsReceiptNotificationsValue"] as? String, - let packetsReceiptNotificationsValue = UInt16(packetsReceiptNotificationsValueStr) { + let packetsReceiptNotificationsValue = UInt16(packetsReceiptNotificationsValueStr) + { starter.packetReceiptNotificationParameter = packetsReceiptNotificationsValue }