iOS Duo: system tab bar instead of the rail, lyrics in the deck, stems fit, DEV banner
Split panes live inside each tab so the system's vertical bar is never covered. Docked Now Playing no longer opens its own queue; the deck's queue scrolls under the stems. Meters run full colour over a dimmed fill. Folded mixer rows shrink to fit every stem, preset chips fall back to a menu instead of being cut off. Dev builds show DEV BUILD <n>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa7cfe6c67
commit
bc30b43eb1
5 files changed
+236
-169
No files matched your search
@@ -178,7 +178,7 @@ struct NowPlayingScreen: View {
|
||||
.tint(c.label)
|
||||
.animation(.easeInOut(duration: 0.3), value: tint)
|
||||
.presentationBackground(.clear)
|
||||
.onAppear { if g.playback.karaoke { panel = .Lyrics } }
|
||||
.onAppear { if !docked && g.playback.karaoke { panel = .Lyrics } }
|
||||
.task(id: "\(track?.thumb ?? "")|\(g.settings.albumColorNowPlaying)|\(base.dark)") {
|
||||
guard g.settings.albumColorNowPlaying, let thumb = track?.thumb else { tint = nil; return }
|
||||
tint = await albumColor(thumb, dark: base.dark)
|
||||
@@ -243,7 +243,7 @@ struct NowPlayingScreen: View {
|
||||
.padding(.top, tight ? 4 : 14)
|
||||
HStack {
|
||||
let hidden = NowPlayingButton.hidden(g.settings.hiddenNowPlaying)
|
||||
if !hidden.contains(.Mixer) { PanelToggle(symbol: "slider.vertical.3", on: docked ? ui.deck : panel == .Mixer) { show(.Mixer) } }
|
||||
if !hidden.contains(.Mixer) { PanelToggle(symbol: "slider.vertical.3", on: docked ? ui.deck && !ui.deckLyrics : panel == .Mixer) { show(.Mixer) } }
|
||||
if !hidden.contains(.Speed) { SpeedMenu() }
|
||||
if !hidden.contains(.Route) { Button { ui.showInSettings(.Eq) } label: { routeLabel(c) }.buttonStyle(PressFade()).frame(maxWidth: .infinity) } else { Spacer() }
|
||||
if !hidden.contains(.AirPlay) { AirPlayButton(tint: UIColor(c.label2), active: UIColor(c.accent)).frame(width: 40, height: 40) }
|
||||
@@ -268,6 +268,15 @@ struct NowPlayingScreen: View {
|
||||
/// Karaoke: vocals down and lyrics up. If it's on but another panel is showing, brings the lyrics back first.
|
||||
private func karaoke() {
|
||||
let pm = g.playback
|
||||
// Docked, the lyrics get the deck's whole side of the hinge.
|
||||
if docked {
|
||||
withAnimation(.snappy(duration: 0.25)) {
|
||||
if pm.karaoke && !(ui.deck && ui.deckLyrics) { ui.showDeck(lyrics: true); return }
|
||||
pm.setKaraoke(!pm.karaoke)
|
||||
ui.showDeck(lyrics: pm.karaoke)
|
||||
}
|
||||
return
|
||||
}
|
||||
withAnimation(.spring(duration: 0.38, bounce: 0.12)) {
|
||||
if pm.karaoke && panel != .Lyrics { panel = .Lyrics; return }
|
||||
pm.setKaraoke(!pm.karaoke)
|
||||
@@ -277,7 +286,8 @@ struct NowPlayingScreen: View {
|
||||
|
||||
private func show(_ to: NpPanel) {
|
||||
// Docked, the stems and the queue have the other side of the hinge to themselves.
|
||||
if docked && (to == .Mixer || to == .Queue) { withAnimation(.snappy) { ui.showDeck() }; return }
|
||||
// The queue lives only in the deck there, never a second copy beside it.
|
||||
if docked { if to == .Mixer { withAnimation(.snappy) { ui.showDeck() } }; return }
|
||||
withAnimation(.spring(duration: 0.38, bounce: 0.12)) { panel = panel == to ? .Art : to }
|
||||
}
|
||||
|
||||
@@ -303,7 +313,7 @@ struct NowPlayingScreen: View {
|
||||
if !docked && vertical && (dy > 120 || v.predictedEndTranslation.height > 300) { dismiss(); return }
|
||||
withAnimation(.spring(duration: 0.3, bounce: 0.1)) { drop = 0 }
|
||||
// Never from the stems: a slightly upward fader drag or scroll there kept opening the queue.
|
||||
if vertical && dy < -50 && panel != .Mixer && g.settings.swipeUpQueue {
|
||||
if !docked && vertical && dy < -50 && panel != .Mixer && g.settings.swipeUpQueue {
|
||||
withAnimation(.spring(duration: 0.38, bounce: 0.12)) { panel = .Queue }
|
||||
}
|
||||
}
|
||||
@@ -700,8 +710,9 @@ private struct MixerPanel: View {
|
||||
GeometryReader { geo in
|
||||
// Spread spare height across the stem rows instead of leaving it all at the bottom.
|
||||
let count = CGFloat(max(names.count, 1))
|
||||
let rowH = roomy ? min(80, max(Self.roomyRow, (geo.size.height - Self.roomyChrome) / count))
|
||||
: min(62, max(46, (geo.size.height - 64) / count))
|
||||
// Rows shrink to fit every stem before anything has to scroll (the folded outer display is short).
|
||||
let rowH = roomy ? min(80, max(Self.roomyMin, (geo.size.height - Self.roomyChrome) / count))
|
||||
: min(62, max(Self.compactMin, (geo.size.height - Self.compactChrome) / count))
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
if pm.source == .Original {
|
||||
@@ -711,54 +722,12 @@ private struct MixerPanel: View {
|
||||
.background(p.fill, in: RoundedRectangle(cornerRadius: 12, style: .continuous))
|
||||
.padding(.vertical, 8)
|
||||
} else {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 8) {
|
||||
let current = MixPresets.normalized(pm.mix)
|
||||
let saved = pm.songMix.map(MixPresets.normalized)
|
||||
let isSaved = saved == current
|
||||
PresetChip(text: isSaved ? "Saved" : "Save", icon: isSaved ? "bookmark.fill" : "bookmark", selected: isSaved) {
|
||||
if isSaved {
|
||||
pm.forgetSongMix()
|
||||
ui.overlays.hud("Removed this song's mix", "bookmark.slash")
|
||||
} else {
|
||||
pm.saveSongMix()
|
||||
ui.overlays.hud("Mix saved for this song", "bookmark.fill")
|
||||
}
|
||||
}
|
||||
if let saved, !isSaved {
|
||||
PresetChip(text: "This Song", selected: false) { pm.applyMix(saved) }
|
||||
}
|
||||
PresetChip(text: "New Preset", icon: "plus", selected: false) {
|
||||
ui.overlays.prompt("Save Preset", "Saves this mix for every song.", "Save", placeholder: "Preset name") { name in
|
||||
let n = name.trimmingCharacters(in: .whitespaces)
|
||||
guard !n.isEmpty else { return }
|
||||
CustomPreset.add(n, pm.mix)
|
||||
ui.overlays.hud("Preset saved", "slider.horizontal.3")
|
||||
}
|
||||
}
|
||||
let s = g.settings
|
||||
ForEach(MixPresets.bar(s)) { preset in
|
||||
if let target = preset.build(names) {
|
||||
let on = MixPresets.normalized(target) == current
|
||||
let locked = s.lockedPreset == preset.id
|
||||
// Tapping the mix that's on goes back to the full song.
|
||||
PresetChip(text: preset.label, icon: locked ? "lock.fill" : nil, selected: on) { pm.applyMix(on ? [:] : target) }
|
||||
.contextMenu {
|
||||
if locked {
|
||||
Button("Unlock", systemImage: "lock.open") { s.lockedPreset = "" }
|
||||
} else {
|
||||
Button("Lock for All Songs", systemImage: "lock") { s.lockedPreset = preset.id; pm.applyMix(target) }
|
||||
}
|
||||
Button("Edit Stems", systemImage: "slider.horizontal.3") { ui.showInSettings(.StemEditor) }
|
||||
if preset.custom {
|
||||
Button("Delete Preset", systemImage: "trash", role: .destructive) { CustomPreset.remove(preset.label) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
// Every chip in one row when they fit, else Save plus a Presets menu, so none is cut off.
|
||||
ViewThatFits(in: .horizontal) {
|
||||
HStack(spacing: 8) { saveChips(pm); presetChips(pm, names) }.fixedSize()
|
||||
HStack(spacing: 8) { saveChips(pm); presetMenu(pm, names); Spacer(minLength: 0) }
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
// The meters' fall is timed, so 30 fps looks the same and costs a quarter of 120.
|
||||
TimelineView(.animation(minimumInterval: 1 / 30, paused: !stems || !pm.playWhenReady)) { _ in
|
||||
@@ -769,7 +738,7 @@ private struct MixerPanel: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer(minLength: roomy ? 8 : 16)
|
||||
Spacer(minLength: 8)
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
}
|
||||
@@ -781,9 +750,93 @@ private struct MixerPanel: View {
|
||||
}
|
||||
|
||||
extension MixerPanel {
|
||||
@ViewBuilder func saveChips(_ pm: PlaybackManager) -> some View {
|
||||
let current = MixPresets.normalized(pm.mix)
|
||||
let saved = pm.songMix.map(MixPresets.normalized)
|
||||
let isSaved = saved == current
|
||||
PresetChip(text: isSaved ? "Saved" : "Save", icon: isSaved ? "bookmark.fill" : "bookmark", selected: isSaved) {
|
||||
if isSaved {
|
||||
pm.forgetSongMix()
|
||||
ui.overlays.hud("Removed this song's mix", "bookmark.slash")
|
||||
} else {
|
||||
pm.saveSongMix()
|
||||
ui.overlays.hud("Mix saved for this song", "bookmark.fill")
|
||||
}
|
||||
}
|
||||
if let saved, !isSaved {
|
||||
PresetChip(text: "This Song", selected: false) { pm.applyMix(saved) }
|
||||
}
|
||||
}
|
||||
|
||||
private func newPreset(_ pm: PlaybackManager) {
|
||||
ui.overlays.prompt("Save Preset", "Saves this mix for every song.", "Save", placeholder: "Preset name") { name in
|
||||
let n = name.trimmingCharacters(in: .whitespaces)
|
||||
guard !n.isEmpty else { return }
|
||||
CustomPreset.add(n, pm.mix)
|
||||
ui.overlays.hud("Preset saved", "slider.horizontal.3")
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder func presetChips(_ pm: PlaybackManager, _ names: [String]) -> some View {
|
||||
let current = MixPresets.normalized(pm.mix)
|
||||
PresetChip(text: "New Preset", icon: "plus", selected: false) { newPreset(pm) }
|
||||
let s = g.settings
|
||||
ForEach(MixPresets.bar(s)) { preset in
|
||||
if let target = preset.build(names) {
|
||||
let on = MixPresets.normalized(target) == current
|
||||
let locked = s.lockedPreset == preset.id
|
||||
// Tapping the mix that's on goes back to the full song.
|
||||
PresetChip(text: preset.label, icon: locked ? "lock.fill" : nil, selected: on) { pm.applyMix(on ? [:] : target) }
|
||||
.contextMenu {
|
||||
if locked {
|
||||
Button("Unlock", systemImage: "lock.open") { s.lockedPreset = "" }
|
||||
} else {
|
||||
Button("Lock for All Songs", systemImage: "lock") { s.lockedPreset = preset.id; pm.applyMix(target) }
|
||||
}
|
||||
Button("Edit Stems", systemImage: "slider.horizontal.3") { ui.showInSettings(.StemEditor) }
|
||||
if preset.custom {
|
||||
Button("Delete Preset", systemImage: "trash", role: .destructive) { CustomPreset.remove(preset.label) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The presets as one menu chip, for panes too narrow for the row.
|
||||
func presetMenu(_ pm: PlaybackManager, _ names: [String]) -> some View {
|
||||
let current = MixPresets.normalized(pm.mix)
|
||||
let s = g.settings
|
||||
let presets = MixPresets.bar(s).compactMap { p in p.build(names).map { (p, $0) } }
|
||||
let active = presets.first { MixPresets.normalized($0.1) == current }?.0
|
||||
return Menu {
|
||||
ForEach(presets, id: \.0.id) { preset, target in
|
||||
let on = MixPresets.normalized(target) == current
|
||||
Button { pm.applyMix(on ? [:] : target) } label: {
|
||||
if on { Label(preset.label, systemImage: "checkmark") } else { Text(preset.label) }
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
Button("New Preset", systemImage: "plus") { newPreset(pm) }
|
||||
Button("Edit Stems", systemImage: "slider.horizontal.3") { ui.showInSettings(.StemEditor) }
|
||||
} label: {
|
||||
HStack(spacing: 5) {
|
||||
Text(active?.label ?? "Presets").lineLimit(1)
|
||||
Image(systemName: "chevron.down").font(.caption2.weight(.bold))
|
||||
}
|
||||
.font(.footnote.weight(.semibold)).foregroundStyle(active != nil ? p.bg : p.label)
|
||||
.padding(.horizontal, 14).frame(height: 32)
|
||||
.background(active != nil ? p.label : p.fill, in: Capsule())
|
||||
}
|
||||
}
|
||||
|
||||
static let roomyRow: CGFloat = 66
|
||||
/// Shortest stacked row: name line, fader and the gap under it.
|
||||
static let roomyMin: CGFloat = 60
|
||||
/// Shortest side-by-side row, the fader's own height.
|
||||
static let compactMin: CGFloat = 36
|
||||
/// Preset chips plus the bottom gap.
|
||||
static let roomyChrome: CGFloat = 56
|
||||
static let compactChrome: CGFloat = 56
|
||||
/// Height that shows the presets and every stem without scrolling, roomy rows.
|
||||
static func roomyHeight(_ stems: Int) -> CGFloat { roomyChrome + CGFloat(stems) * roomyRow }
|
||||
}
|
||||
@@ -823,7 +876,7 @@ private struct StemFader: View {
|
||||
var body: some View {
|
||||
let color = Color(hex: Stems.color(name))
|
||||
FaderRow(dot: setting.muted ? p.label3 : color, label: Stems.label(name), percent: Int(stemTaper(setting.level) * 100), dim: setting.muted, height: height, stacked: roomy) {
|
||||
// Live level, -48..0 dBFS, drawn as a light band inside the fader's fill.
|
||||
// Live level, -48..0 dBFS, drawn bright over the dimmed fill.
|
||||
let f = CGFloat(min(1, max(0, (20 * log10(level + 1e-5) + 48) / 48)))
|
||||
FaderSlider(value: setting.level, fill: setting.muted ? p.label3 : color, detent: StemSetting.unity, enabled: enabled, thumb: roomy ? 26 : 24, meter: enabled && !setting.muted ? f : nil) {
|
||||
pm.setStemLevel(name, $0)
|
||||
@@ -912,7 +965,7 @@ struct FaderSlider: View {
|
||||
var detent: Float?
|
||||
var enabled = true
|
||||
var thumb: CGFloat = 24
|
||||
/// 0...1 live level, shown as a lighter band over the filled part of the track.
|
||||
/// 0...1 live level, shown in the full fill colour over the dimmed filled part of the track.
|
||||
var meter: CGFloat?
|
||||
let onChange: (Float) -> Void
|
||||
|
||||
@@ -924,7 +977,7 @@ struct FaderSlider: View {
|
||||
self.value = value; self.fill = fill; self.detent = detent; self.enabled = enabled; self.thumb = thumb; self.meter = meter; self.onChange = onChange
|
||||
}
|
||||
|
||||
private var bar: CGFloat { meter == nil ? (thumb >= 26 ? 5 : 4) : 6 }
|
||||
private var bar: CGFloat { meter == nil ? (thumb >= 26 ? 5 : 4) : 8 }
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geo in
|
||||
@@ -932,9 +985,12 @@ struct FaderSlider: View {
|
||||
let x = CGFloat(min(max(value, 0), 1)) * track
|
||||
ZStack(alignment: .leading) {
|
||||
Capsule().fill(p.fillStrong).frame(height: bar).padding(.horizontal, thumb / 2)
|
||||
Capsule().fill(fill).frame(width: x + thumb / 2, height: bar).padding(.leading, thumb / 2 - 0.01)
|
||||
// With a meter the set level is a dim band of the stem's colour and the live level
|
||||
// runs over it in the full colour, so the two never blend.
|
||||
Capsule().fill(meter == nil ? fill : fill.opacity(0.32)).frame(width: x + thumb / 2, height: bar).padding(.leading, thumb / 2 - 0.01)
|
||||
if let meter, meter > 0.01 {
|
||||
Capsule().fill(.white.opacity(0.5)).frame(width: meter * (x + thumb / 2), height: bar)
|
||||
Capsule().fill(fill).frame(width: meter * (x + thumb / 2), height: bar)
|
||||
.shadow(color: fill.opacity(0.6), radius: 3)
|
||||
.padding(.leading, thumb / 2 - 0.01)
|
||||
.animation(.linear(duration: 1 / 30), value: meter)
|
||||
}
|
||||
@@ -967,9 +1023,12 @@ struct FaderSlider: View {
|
||||
|
||||
// ---- deck -----------------------------------------------------------------------------------
|
||||
|
||||
/// Unfolded iPhone Duo: the stems over the queue, on the other side of the hinge from Now Playing.
|
||||
/// Unfolded iPhone Duo: the stems over the queue, or the lyrics, on the other side of the hinge
|
||||
/// from Now Playing. The stems stay put and the queue scrolls in what's left under them.
|
||||
struct NowPlayingDeck: View {
|
||||
@Environment(Ui.self) private var ui
|
||||
@Environment(\.palette) private var base
|
||||
@AppStorage("duoSwap") private var swap = false
|
||||
@State private var tint: Color?
|
||||
private var g: AppGraph { .shared }
|
||||
|
||||
@@ -977,32 +1036,63 @@ struct NowPlayingDeck: View {
|
||||
let c = tint.map { base.tinted($0) } ?? base
|
||||
let track = g.playback.current?.track
|
||||
GeometryReader { geo in
|
||||
if track != nil {
|
||||
if let track {
|
||||
VStack(spacing: 0) {
|
||||
Text("Stems").font(.headline).foregroundStyle(c.label)
|
||||
.frame(maxWidth: .infinity, alignment: .leading).padding(.horizontal, 24)
|
||||
// As much as the stems need to show without scrolling, leaving the queue a few rows.
|
||||
MixerPanel(roomy: true).frame(height: min(MixerPanel.roomyHeight(max(g.playback.stemNames.count, 4)), geo.size.height * 0.72))
|
||||
Rectangle().fill(c.label3.opacity(0.35)).frame(height: 0.5).padding(.horizontal, 24).padding(.bottom, 8)
|
||||
QueuePanel()
|
||||
header(c)
|
||||
if ui.deckLyrics {
|
||||
LyricsPanel(track: track).frame(maxHeight: .infinity)
|
||||
} else {
|
||||
let n = max(g.playback.stemNames.count, 1)
|
||||
// Every stem without scrolling, leaving the queue at least a header and a few rows.
|
||||
let fit = MixerPanel.roomyChrome + CGFloat(n) * MixerPanel.roomyMin
|
||||
let mixH = max(min(MixerPanel.roomyHeight(n), geo.size.height - 230), min(fit, geo.size.height - 150))
|
||||
MixerPanel(roomy: true).frame(height: max(mixH, 0))
|
||||
Rectangle().fill(c.label3.opacity(0.35)).frame(height: 0.5).padding(.horizontal, 24).padding(.bottom, 4)
|
||||
QueuePanel().frame(maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Text("Nothing Playing").font(.title3.weight(.semibold)).foregroundStyle(c.label2)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
.padding(.top, 12)
|
||||
.padding(.top, 8)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(c.bg.ignoresSafeArea())
|
||||
.environment(\.palette, c)
|
||||
.modifier(NpScheme(dark: c.dark, docked: true))
|
||||
.tint(c.label)
|
||||
.animation(.easeInOut(duration: 0.3), value: tint)
|
||||
.animation(.snappy(duration: 0.25), value: ui.deckLyrics)
|
||||
.task(id: "\(track?.thumb ?? "")|\(g.settings.albumColorNowPlaying)|\(base.dark)") {
|
||||
guard g.settings.albumColorNowPlaying, let thumb = track?.thumb else { tint = nil; return }
|
||||
tint = await albumColor(thumb, dark: base.dark)
|
||||
}
|
||||
}
|
||||
|
||||
/// Stems or Lyrics, and the button that moves Now Playing to the other side of the hinge.
|
||||
private func header(_ c: Palette) -> some View {
|
||||
HStack(spacing: 18) {
|
||||
page("Stems", on: !ui.deckLyrics, c) { ui.showDeck(lyrics: false) }
|
||||
page("Lyrics", on: ui.deckLyrics, c) { ui.showDeck(lyrics: true) }
|
||||
Spacer(minLength: 0)
|
||||
Button { withAnimation(.spring(duration: 0.4, bounce: 0.1)) { swap.toggle() } } label: {
|
||||
Image(systemName: "arrow.left.arrow.right").font(.body.weight(.semibold)).foregroundStyle(c.label2)
|
||||
.frame(width: 40, height: 32).contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(PressFade())
|
||||
.accessibilityLabel("Swap Sides")
|
||||
}
|
||||
.padding(.horizontal, 24).frame(height: 36)
|
||||
}
|
||||
|
||||
private func page(_ title: String, on: Bool, _ c: Palette, _ action: @escaping () -> Void) -> some View {
|
||||
Button(action: action) {
|
||||
Text(title).font(.headline).foregroundStyle(on ? c.label : c.label3)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityAddTraits(on ? .isSelected : [])
|
||||
}
|
||||
}
|
||||
|
||||
// ---- queue ----------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user