iOS: export/import stem playlists and sound settings

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Sonnet 5.5 authored and root committed 2026-10-20 13:33:54 -07:00
1 parent 9646b4c010
commit 4e2816673d
3 files changed
+144

No files matched your search

+18
View File
@@ -70,6 +70,24 @@ final class StemPlaylists {
return MixPresets.current(allStems, mix)?.label ?? "Custom Mix"
}
/// Brings in playlists from an export: new ids are added, ids already here are replaced when the
/// import was updated more recently. Returns how many lists were added or replaced.
@discardableResult
func merge(_ incoming: [StemPlaylist]) -> Int {
var n = 0
for pl in incoming {
if let i = lists.firstIndex(where: { $0.id == pl.id }) {
guard pl.updated > lists[i].updated else { continue }
lists[i] = pl
} else {
lists.append(pl)
}
n += 1
}
if n > 0 { save() }
return n
}
private func edit(_ id: String, _ change: (inout StemPlaylist) -> Void) {
guard let i = lists.firstIndex(where: { $0.id == id }) else { return }
change(&lists[i])