iOS: Duo layout fixes, swipe-up option, fuller backup restore
- DuoRail sits at the bottom of the strip, clear of the back buttons - Setting to turn off swipe up for Playing Next - Tighter Now Playing on iPhone Duo (folded and docked), regular phones unchanged - Bigger stacked stem faders in the Duo deck - Backup v2 restores song mixes, custom presets and stem playlist covers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e8bc920454
commit
fabca5d1aa
9 files changed
+166
-54
No files matched your search
@@ -592,9 +592,22 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
|
||||
func saveSongMix() { setSongMix(MixPresets.normalized(mix)) }
|
||||
func forgetSongMix() { setSongMix(nil) }
|
||||
|
||||
/// From a backup: its saved mixes replace this phone's for the same songs.
|
||||
func importSongMixes(_ m: [String: [String: StemSetting]]) {
|
||||
guard !m.isEmpty else { return }
|
||||
songMixes.merge(m) { _, new in new }
|
||||
saveSongMixes()
|
||||
// The playing song picks up its restored mix right away.
|
||||
if let s = songMix { applyMix(s) }
|
||||
}
|
||||
|
||||
private func setSongMix(_ m: [String: StemSetting]?) {
|
||||
guard let key = current?.track.ratingKey else { return }
|
||||
songMixes[key] = m
|
||||
saveSongMixes()
|
||||
}
|
||||
|
||||
private func saveSongMixes() {
|
||||
let all = songMixes, file = songMixFile
|
||||
DispatchQueue.global(qos: .utility).async {
|
||||
if let data = try? JSONEncoder().encode(all) { try? data.write(to: file, options: .atomic) }
|
||||
|
||||
@@ -163,22 +163,14 @@ 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.
|
||||
/// Import from a backup: the backup's copy of each list wins, lists only on this phone stay.
|
||||
@discardableResult
|
||||
func merge(_ incoming: [StemPlaylist]) -> Int {
|
||||
var n = 0
|
||||
func restore(_ incoming: [StemPlaylist]) -> Int {
|
||||
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 let i = lists.firstIndex(where: { $0.id == pl.id }) { lists[i] = pl } else { lists.append(pl) }
|
||||
}
|
||||
if n > 0 { save() }
|
||||
return n
|
||||
if !incoming.isEmpty { save() }
|
||||
return incoming.count
|
||||
}
|
||||
|
||||
private func edit(_ id: String, _ change: (inout StemPlaylist) -> Void) {
|
||||
|
||||
Reference in new issue
Block a user