diff --git a/Extensions/Firefox b/Extensions/Firefox index 9133efd..89d5dfe 160000 --- a/Extensions/Firefox +++ b/Extensions/Firefox @@ -1 +1 @@ -Subproject commit 9133efd21b714a758bd51d1e5c1bec0f9cb10a6c +Subproject commit 89d5dfe8433407b124a0083d936d76d8cf8946ff diff --git a/Resources/AppIcon.icns b/Resources/AppIcon.icns index c2b7f13..c9b1d14 100644 Binary files a/Resources/AppIcon.icns and b/Resources/AppIcon.icns differ diff --git a/Resources/AppIcon.png b/Resources/AppIcon.png index 54220a8..083495e 100644 Binary files a/Resources/AppIcon.png and b/Resources/AppIcon.png differ diff --git a/Sources/Firelink/DownloadController.swift b/Sources/Firelink/DownloadController.swift index dd30ac6..9bb43d0 100644 --- a/Sources/Firelink/DownloadController.swift +++ b/Sources/Firelink/DownloadController.swift @@ -481,6 +481,7 @@ final class DownloadController: ObservableObject { progress: { [weak self] progress in Task { @MainActor in self?.update(item.id) { + guard $0.status == .downloading else { return } $0.progress = progress.fraction $0.bytesText = progress.bytesText $0.speedText = progress.speedText @@ -823,6 +824,15 @@ final class DownloadController: ObservableObject { shouldRewriteStoredDownloads = true } + if adjusted.status == .completed && + (adjusted.speedText != "-" || adjusted.etaText != "-" || adjusted.connectionCount != 0 || adjusted.autoResumeOnLaunch != false) { + adjusted.speedText = "-" + adjusted.etaText = "-" + adjusted.connectionCount = 0 + adjusted.autoResumeOnLaunch = false + shouldRewriteStoredDownloads = true + } + if adjusted.status == .downloading { adjusted.status = .queued adjusted.message = "Recovered after restart. Resuming from partial file." diff --git a/Sources/Firelink/DownloadPropertiesView.swift b/Sources/Firelink/DownloadPropertiesView.swift index 71d14f6..a95fd59 100644 --- a/Sources/Firelink/DownloadPropertiesView.swift +++ b/Sources/Firelink/DownloadPropertiesView.swift @@ -443,8 +443,8 @@ private struct DownloadSummaryHeader: View { GridRow { summary("Progress", (item.status == .completed ? 1.0 : item.progress).formatted(.percent.precision(.fractionLength(0)))) summary("Size", ByteFormatter.string(item.sizeBytes)) - summary("Speed", item.speedText) - summary("ETA", item.etaText) + summary("Speed", item.displaySpeedText) + summary("ETA", item.displayETAText) } GridRow { summary("Live connections", "\(item.connectionCount)") diff --git a/Sources/Firelink/DownloadTable.swift b/Sources/Firelink/DownloadTable.swift index 952e029..1e6209f 100644 --- a/Sources/Firelink/DownloadTable.swift +++ b/Sources/Firelink/DownloadTable.swift @@ -77,18 +77,18 @@ struct DownloadTable: View { } .width(min: 80, ideal: 105) - TableColumn("Speed", value: \.speedText) { item in + TableColumn("Speed", value: \.displaySpeedText) { item in doubleClickableCell(for: item) { - Text(item.speedText) + Text(item.displaySpeedText) .lineLimit(1) .truncationMode(.tail) } } .width(min: 70, ideal: 90) - TableColumn("ETA", value: \.etaText) { item in + TableColumn("ETA", value: \.displayETAText) { item in doubleClickableCell(for: item) { - Text(item.etaText) + Text(item.displayETAText) .lineLimit(1) .truncationMode(.tail) } diff --git a/Sources/Firelink/Models.swift b/Sources/Firelink/Models.swift index af2579d..1dcd302 100644 --- a/Sources/Firelink/Models.swift +++ b/Sources/Firelink/Models.swift @@ -189,6 +189,14 @@ struct DownloadItem: Identifiable, Codable, Equatable, Sendable { var rpcPort: Int? var rpcSecret: String? + var displaySpeedText: String { + status == .downloading ? speedText : "-" + } + + var displayETAText: String { + status == .downloading ? etaText : "-" + } + var destinationPath: String { destinationDirectory.appendingPathComponent(fileName).path }