mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-29 06:25:32 -04:00
Only verify shasum if not empty
This commit is contained in:
parent
c49b5a64ee
commit
24d0591822
1 changed files with 15 additions and 5 deletions
|
@ -97,17 +97,27 @@ class TaskManager: ObservableObject {
|
||||||
retries: Int,
|
retries: Int,
|
||||||
delay retryDelay: Int
|
delay retryDelay: Int
|
||||||
) -> [MistTask] {
|
) -> [MistTask] {
|
||||||
[
|
var tasks: [MistTask] = [
|
||||||
MistTask(type: .download, description: firmwareURL.lastPathComponent, downloadSize: firmware.size) {
|
MistTask(type: .download, description: firmwareURL.lastPathComponent, downloadSize: firmware.size) {
|
||||||
try await DownloadManager.shared.download(firmwareURL, to: temporaryFirmwareURL, retries: retries, delay: retryDelay)
|
try await DownloadManager.shared.download(firmwareURL, to: temporaryFirmwareURL, retries: retries, delay: retryDelay)
|
||||||
},
|
}
|
||||||
MistTask(type: .verify, description: firmwareURL.lastPathComponent) {
|
]
|
||||||
try await Validator.validate(firmware, at: temporaryFirmwareURL)
|
|
||||||
},
|
if !firmware.shasum.isEmpty {
|
||||||
|
tasks += [
|
||||||
|
MistTask(type: .verify, description: firmwareURL.lastPathComponent) {
|
||||||
|
try await Validator.validate(firmware, at: temporaryFirmwareURL)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks += [
|
||||||
MistTask(type: .save, description: "Firmware to destination") {
|
MistTask(type: .save, description: "Firmware to destination") {
|
||||||
try await FileMover.move(temporaryFirmwareURL, to: destinationURL)
|
try await FileMover.move(temporaryFirmwareURL, to: destinationURL)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
return tasks
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:enable function_parameter_count
|
// swiftlint:enable function_parameter_count
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue