feat:sdk 增加判断是否有新固件可用
This commit is contained in:
@@ -200,6 +200,7 @@ struct WrapperTestView: View {
|
||||
if let info = firmwareInfo {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
LabeledContent("Latest", value: info.version)
|
||||
LabeledContent("Has Update", value: sdk.hasNewerFirmware(deviceVersion: sdk.version, serverVersion: info.version) ? "Yes" : "No")
|
||||
if let size = info.fileSize {
|
||||
let bytes = Int(size) ?? 0
|
||||
LabeledContent("Size", value: ByteCountFormatter.string(fromByteCount: Int64(bytes), countStyle: .file))
|
||||
@@ -429,7 +430,8 @@ struct WrapperTestView: View {
|
||||
let info = try await sdk.fetchLatestFirmware(identifier: brand, status: firmwareStatus)
|
||||
firmwareInfo = info
|
||||
if let info {
|
||||
log("firmware latest: \(info.version)", level: .success)
|
||||
let hasUpdate = sdk.hasNewerFirmware(deviceVersion: sdk.version, serverVersion: info.version)
|
||||
log("firmware latest: \(info.version), hasUpdate=\(hasUpdate)", level: .success)
|
||||
} else {
|
||||
log("no firmware available", level: .info)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user