Skip to content

Commit

Permalink
feat: update iOS DFU to version 4.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonos committed Dec 17, 2023
1 parent 3f1bfd3 commit 8ccbad1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CapacitorCommunityNordicDfu.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ios/Plugin/NordicDfu.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Capacitor
import CoreBluetooth
import iOSDFULibrary
import NordicDFU

@objc public class NordicDfu: NSObject {}
13 changes: 7 additions & 6 deletions ios/Plugin/NordicDfuPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Capacitor
import CoreBluetooth
import Foundation
import iOSDFULibrary
import NordicDFU
import UserNotifications

@objc(NordicDfuPlugin)
Expand All @@ -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) {
Expand Down Expand Up @@ -72,7 +72,7 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel
return [
.badge,
.sound,
.alert
.alert,
]
}

Expand Down Expand Up @@ -137,15 +137,15 @@ public class NordicDfuPlugin: CAPPlugin, CBCentralManagerDelegate, DFUServiceDel
"speed": currentSpeedBytesPerSecond / 1000,
"avgSpeed": avgSpeedBytesPerSecond / 1000,
"currentPart": part,
"partsTotal": totalParts
"partsTotal": totalParts,
]
sendStateUpdate("DFU_PROGRESS", data)
}

private func sendStateUpdate(_ state: String, _ data: JSObject = [:]) {
let ret: JSObject = [
"state": state,
"data": data
"data": data,
]
notifyListeners(dfuChangeEvent, data: ret)
}
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 8ccbad1

Please sign in to comment.