fix: media downloads connections, progress parsing, file size, and selection highlight

- Removed hardcoded 1 connection limit for media downloads
- Added support for aria2c progress parsing in media downloads
- Fixed missing file size after download completion by reading from disk
- Fixed row selection highlight in DownloadTable by using onTapGesture instead of simultaneousGesture
This commit is contained in:
nimbold
2026-06-07 22:28:23 +03:30
parent c139ac50f2
commit 1a2c59d243
10 changed files with 417 additions and 123 deletions
+18 -4
View File
@@ -72,10 +72,10 @@ struct DownloadTable: View {
TableColumn("Status", value: \.status.rawValue) { item in
doubleClickableCell(for: item) {
Text(item.status.rawValue)
statusCell(for: item)
}
}
.width(min: 80, ideal: 105)
.width(min: 115, ideal: 170)
TableColumn("Speed", value: \.displaySpeedText) { item in
doubleClickableCell(for: item) {
@@ -164,9 +164,9 @@ struct DownloadTable: View {
content()
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
.simultaneousGesture(TapGesture(count: 2).onEnded {
.onTapGesture(count: 2) {
performPrimaryAction(for: item)
})
}
}
private func performPrimaryAction(for item: DownloadItem) {
@@ -177,6 +177,20 @@ struct DownloadTable: View {
}
}
@ViewBuilder
private func statusCell(for item: DownloadItem) -> some View {
let message = item.message.trimmingCharacters(in: .whitespacesAndNewlines)
if item.status == .downloading, !message.isEmpty {
Text(message)
.lineLimit(1)
.truncationMode(.tail)
} else {
Text(item.status.rawValue)
.lineLimit(1)
.truncationMode(.tail)
}
}
@ViewBuilder
private func rowContextMenu(for itemIDs: Set<DownloadItem.ID>) -> some View {
let targetItems = controller.downloads.filter { itemIDs.contains($0.id) }