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:
rootandClaude Opus 5.5 committed 2026-11-06 08:55:26 -08:00
1 parent abb157d140
commit ee6ca41fd3
4 files changed
+57 -18

No files matched your search

+19 -10
View File
@@ -71,8 +71,8 @@ struct MediaMenu {
g.playback.addToQueue(pl.tracks, mixes: pl.mixes); overlays.hud("Added to Queue", "text.line.last.and.arrowtriangle.forward")
},
]
a.append(downloadAction(pl.title, DownloadGroup(kind: .stemPlaylist, key: pl.id, title: pl.title, subtitle: "Stem Playlist", thumb: pl.thumb),
{ pl.tracks }, confirm: false))
a += downloadActions(pl.title, DownloadGroup(kind: .stemPlaylist, key: pl.id, title: pl.title, subtitle: "Stem Playlist", thumb: pl.thumb),
{ pl.tracks }, confirm: false)
if pl.items.isEmpty { a = [] }
let lists = g.stemPlaylists
if !pl.items.isEmpty {
@@ -134,7 +134,7 @@ struct MediaMenu {
private func collection(_ title: String, _ group: DownloadGroup?, _ load: @escaping () async throws -> [Track],
playlistKey: String?, extra: [SheetAction], confirmDownload: Bool = false, stemmed: Bool = false) -> [SheetAction] {
var a = queueActions(load)
if let group { a.append(downloadAction(title, group, load, confirm: confirmDownload)) }
if let group { a += downloadActions(title, group, load, confirm: confirmDownload) }
a.append(SheetAction("Add to Playlist…", icon: "text.badge.plus") { withTracks(load) { addToPlaylist($0, skip: playlistKey, title: title) } })
if !stemmed { a.append(stemNow(load)) }
return a + extra
@@ -152,14 +152,23 @@ struct MediaMenu {
]
}
/// Download, or Remove Download once [group] is downloaded. A downloaded group keeps itself in step with the server.
func downloadAction(_ title: String, _ group: DownloadGroup, _ load: @escaping () async throws -> [Track], confirm: Bool) -> SheetAction {
/// Download, or Update Download and Remove Download once [group] is downloaded. A downloaded group also
/// keeps itself in step with the server on its own; Update does it now and retries songs that failed.
func downloadActions(_ title: String, _ group: DownloadGroup, _ load: @escaping () async throws -> [Track], confirm: Bool) -> [SheetAction] {
if g.downloads.groups[group.id] != nil {
return SheetAction("Remove Download", icon: "trash", destructive: true) {
overlays.confirm("Remove Download?", "“\(title)” will no longer be available offline.", "Remove") { g.downloads.removeGroup(group.id) }
}
return [
SheetAction("Update Download", icon: "arrow.triangle.2.circlepath") {
withTracks(load) { tracks in
g.downloads.download(group, tracks)
overlays.hud("Download Updated", "arrow.triangle.2.circlepath")
}
},
SheetAction("Remove Download", icon: "trash", destructive: true) {
overlays.confirm("Remove Download?", "“\(title)” will no longer be available offline.", "Remove") { g.downloads.removeGroup(group.id) }
},
]
}
return SheetAction("Download", icon: "arrow.down.circle") {
return [SheetAction("Download", icon: "arrow.down.circle") {
withTracks(load) { tracks in
let go = { g.downloads.download(group, tracks); overlays.hud("Downloading", "arrow.down.circle") }
if confirm && tracks.count > 20 {
@@ -168,7 +177,7 @@ struct MediaMenu {
go()
}
}
}
}]
}
/// Has stemd on the server separate the songs that lack stems ahead of the rest of the library.