iOS 1.0 RC 2: Update Download and Update All Downloads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abb157d140
commit
ee6ca41fd3
4 files changed
+57
-18
No files matched your search
@@ -820,6 +820,12 @@ struct DownloadsScreen: View {
|
||||
SheetAction("Shuffle", icon: "shuffle") { g.playback.playTracks(d.tracks, shuffle: true) },
|
||||
]
|
||||
if d.failed > 0 { items.append(SheetAction("Retry Failed Songs", icon: "arrow.clockwise") { g.downloads.retryFailed() }) }
|
||||
items.append(SheetAction("Update Download", icon: "arrow.triangle.2.circlepath") {
|
||||
Task {
|
||||
let ok = await g.downloads.update(d.group.id)
|
||||
ui.overlays.hud(ok ? "Download Updated" : "Couldn't reach the server", ok ? "arrow.triangle.2.circlepath" : "exclamationmark.triangle")
|
||||
}
|
||||
})
|
||||
items.append(SheetAction("Remove Download", icon: "trash", destructive: true) {
|
||||
ui.overlays.confirm("Remove Download?", "“\(d.group.title)” will no longer be available offline.", "Remove") { g.downloads.removeGroup(d.group.id) }
|
||||
})
|
||||
@@ -851,6 +857,15 @@ struct DownloadsScreen: View {
|
||||
private func moreItems(_ all: [DownloadedGroup], _ pinned: String) -> [SheetAction] {
|
||||
var a: [SheetAction] = []
|
||||
if all.contains(where: { $0.failed > 0 }) { a.append(SheetAction("Retry Failed", icon: "arrow.clockwise") { g.downloads.retryFailed() }) }
|
||||
if !g.downloads.groups.isEmpty {
|
||||
a.append(SheetAction("Update All Downloads", icon: "arrow.triangle.2.circlepath") {
|
||||
Task {
|
||||
var failed = 0
|
||||
for id in Array(g.downloads.groups.keys) { if await !g.downloads.update(id) { failed += 1 } }
|
||||
ui.overlays.hud(failed == 0 ? "Downloads Updated" : "\(failed) couldn't be updated", failed == 0 ? "arrow.triangle.2.circlepath" : "exclamationmark.triangle")
|
||||
}
|
||||
})
|
||||
}
|
||||
a.append(SheetAction("Remove All Downloads", icon: "trash", destructive: true) {
|
||||
ui.overlays.confirm("Remove All Downloads?", "Frees \(pinned) GB. Songs stay in your library.", "Remove All") {
|
||||
for id in g.downloads.groups.keys { g.downloads.removeGroup(id) }
|
||||
|
||||
Reference in new issue
Block a user