mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-27 19:17:13 +00:00
fix: clear completed speeds and icon frame
This commit is contained in:
+1
-1
Submodule Extensions/Firefox updated: 9133efd21b...89d5dfe843
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.5 MiB |
@@ -481,6 +481,7 @@ final class DownloadController: ObservableObject {
|
|||||||
progress: { [weak self] progress in
|
progress: { [weak self] progress in
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
self?.update(item.id) {
|
self?.update(item.id) {
|
||||||
|
guard $0.status == .downloading else { return }
|
||||||
$0.progress = progress.fraction
|
$0.progress = progress.fraction
|
||||||
$0.bytesText = progress.bytesText
|
$0.bytesText = progress.bytesText
|
||||||
$0.speedText = progress.speedText
|
$0.speedText = progress.speedText
|
||||||
@@ -823,6 +824,15 @@ final class DownloadController: ObservableObject {
|
|||||||
shouldRewriteStoredDownloads = true
|
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 {
|
if adjusted.status == .downloading {
|
||||||
adjusted.status = .queued
|
adjusted.status = .queued
|
||||||
adjusted.message = "Recovered after restart. Resuming from partial file."
|
adjusted.message = "Recovered after restart. Resuming from partial file."
|
||||||
|
|||||||
@@ -443,8 +443,8 @@ private struct DownloadSummaryHeader: View {
|
|||||||
GridRow {
|
GridRow {
|
||||||
summary("Progress", (item.status == .completed ? 1.0 : item.progress).formatted(.percent.precision(.fractionLength(0))))
|
summary("Progress", (item.status == .completed ? 1.0 : item.progress).formatted(.percent.precision(.fractionLength(0))))
|
||||||
summary("Size", ByteFormatter.string(item.sizeBytes))
|
summary("Size", ByteFormatter.string(item.sizeBytes))
|
||||||
summary("Speed", item.speedText)
|
summary("Speed", item.displaySpeedText)
|
||||||
summary("ETA", item.etaText)
|
summary("ETA", item.displayETAText)
|
||||||
}
|
}
|
||||||
GridRow {
|
GridRow {
|
||||||
summary("Live connections", "\(item.connectionCount)")
|
summary("Live connections", "\(item.connectionCount)")
|
||||||
|
|||||||
@@ -77,18 +77,18 @@ struct DownloadTable: View {
|
|||||||
}
|
}
|
||||||
.width(min: 80, ideal: 105)
|
.width(min: 80, ideal: 105)
|
||||||
|
|
||||||
TableColumn("Speed", value: \.speedText) { item in
|
TableColumn("Speed", value: \.displaySpeedText) { item in
|
||||||
doubleClickableCell(for: item) {
|
doubleClickableCell(for: item) {
|
||||||
Text(item.speedText)
|
Text(item.displaySpeedText)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.truncationMode(.tail)
|
.truncationMode(.tail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.width(min: 70, ideal: 90)
|
.width(min: 70, ideal: 90)
|
||||||
|
|
||||||
TableColumn("ETA", value: \.etaText) { item in
|
TableColumn("ETA", value: \.displayETAText) { item in
|
||||||
doubleClickableCell(for: item) {
|
doubleClickableCell(for: item) {
|
||||||
Text(item.etaText)
|
Text(item.displayETAText)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.truncationMode(.tail)
|
.truncationMode(.tail)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,6 +189,14 @@ struct DownloadItem: Identifiable, Codable, Equatable, Sendable {
|
|||||||
var rpcPort: Int?
|
var rpcPort: Int?
|
||||||
var rpcSecret: String?
|
var rpcSecret: String?
|
||||||
|
|
||||||
|
var displaySpeedText: String {
|
||||||
|
status == .downloading ? speedText : "-"
|
||||||
|
}
|
||||||
|
|
||||||
|
var displayETAText: String {
|
||||||
|
status == .downloading ? etaText : "-"
|
||||||
|
}
|
||||||
|
|
||||||
var destinationPath: String {
|
var destinationPath: String {
|
||||||
destinationDirectory.appendingPathComponent(fileName).path
|
destinationDirectory.appendingPathComponent(fileName).path
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user