Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1072dde293 | ||
|
|
150e47a305 | ||
|
|
29a1742f8d |
No files matched your search
@@ -20,12 +20,31 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
|
|||||||
return UISceneConfiguration(name: "Phone", sessionRole: session.role)
|
return UISceneConfiguration(name: "Phone", sessionRole: session.role)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
|
||||||
|
Orientation.mask
|
||||||
|
}
|
||||||
|
|
||||||
/// Siri: "Play <album> on Stemify".
|
/// Siri: "Play <album> on Stemify".
|
||||||
func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? {
|
func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? {
|
||||||
intent is INPlayMediaIntent ? PlayMediaHandler() : nil
|
intent is INPlayMediaIntent ? PlayMediaHandler() : nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Folded on the iPhone Duo the app stays upright; everywhere else it turns as usual.
|
||||||
|
enum Orientation {
|
||||||
|
nonisolated(unsafe) static var mask: UIInterfaceOrientationMask = .allButUpsideDown
|
||||||
|
|
||||||
|
@MainActor static func lock(_ upright: Bool) {
|
||||||
|
let m: UIInterfaceOrientationMask = upright ? .portrait : .allButUpsideDown
|
||||||
|
guard m != mask else { return }
|
||||||
|
mask = m
|
||||||
|
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes {
|
||||||
|
scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||||
|
if upright { scene.requestGeometryUpdate(.iOS(interfaceOrientations: .portrait)) { _ in } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct StemifyApp: App {
|
struct StemifyApp: App {
|
||||||
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ final class Settings: @unchecked Sendable {
|
|||||||
"servers", "plexUrl", "plexToken", "plexUser", "plexMachineId", "musicSection", "musicSectionTitle",
|
"servers", "plexUrl", "plexToken", "plexUser", "plexMachineId", "musicSection", "musicSectionTitle",
|
||||||
"stemUrl", "stemToken", "plexAccountToken", "stemRoots", "theme", "accent", "albumColorNowPlaying", "highRefreshRate",
|
"stemUrl", "stemToken", "plexAccountToken", "stemRoots", "theme", "accent", "albumColorNowPlaying", "highRefreshRate",
|
||||||
"stemQuality", "cacheLimitGb", "downloadsWifiOnly", "downloadSort", "keepStemMix", "masterVolume", "tabLayout",
|
"stemQuality", "cacheLimitGb", "downloadsWifiOnly", "downloadSort", "keepStemMix", "masterVolume", "tabLayout",
|
||||||
"karaokeVocals", "karaokeSoftDb", "playbackSpeed", "stemsOnly", "noStems", "precacheCount", "hiddenNowPlaying", "presets", "presetOrder", "hiddenPresets", "lockedPreset", "webStations", "lockScreenMix", "swipeUpQueue", "acapella", "crossfadeSec", "sweetFades",
|
"karaokeVocals", "karaokeSoftDb", "playbackSpeed", "stemsOnly", "noStems", "precacheCount", "hiddenNowPlaying", "presets", "presetOrder", "hiddenPresets", "lockedPreset", "webStations", "lockScreenMix", "swipeUpQueue", "acapella", "crossfadeSec", "sweetFades", "foldedArtLeft",
|
||||||
]
|
]
|
||||||
|
|
||||||
private func read<T>(_ kp: KeyPath<Settings, T>, _ key: String, _ def: T) -> T {
|
private func read<T>(_ kp: KeyPath<Settings, T>, _ key: String, _ def: T) -> T {
|
||||||
@@ -220,6 +220,8 @@ final class Settings: @unchecked Sendable {
|
|||||||
var swipeUpQueue: Bool { get { read(\.swipeUpQueue, "swipeUpQueue", true) } set { write(\.swipeUpQueue, "swipeUpQueue", newValue, true) } }
|
var swipeUpQueue: Bool { get { read(\.swipeUpQueue, "swipeUpQueue", true) } set { write(\.swipeUpQueue, "swipeUpQueue", newValue, true) } }
|
||||||
var lockScreenMix: Bool { get { read(\.lockScreenMix, "lockScreenMix", false) } set { write(\.lockScreenMix, "lockScreenMix", newValue, false) } }
|
var lockScreenMix: Bool { get { read(\.lockScreenMix, "lockScreenMix", false) } set { write(\.lockScreenMix, "lockScreenMix", newValue, false) } }
|
||||||
var albumColorNowPlaying: Bool { get { read(\.albumColorNowPlaying, "albumColorNowPlaying", false) } set { write(\.albumColorNowPlaying, "albumColorNowPlaying", newValue, false) } }
|
var albumColorNowPlaying: Bool { get { read(\.albumColorNowPlaying, "albumColorNowPlaying", false) } set { write(\.albumColorNowPlaying, "albumColorNowPlaying", newValue, false) } }
|
||||||
|
/// Folded iPhone Duo: Now Playing's art sits at the left instead of centred.
|
||||||
|
var foldedArtLeft: Bool { get { read(\.foldedArtLeft, "foldedArtLeft", false) } set { write(\.foldedArtLeft, "foldedArtLeft", newValue, false) } }
|
||||||
var highRefreshRate: Bool { get { read(\.highRefreshRate, "highRefreshRate", true) } set { write(\.highRefreshRate, "highRefreshRate", newValue, true) } }
|
var highRefreshRate: Bool { get { read(\.highRefreshRate, "highRefreshRate", true) } set { write(\.highRefreshRate, "highRefreshRate", newValue, true) } }
|
||||||
|
|
||||||
var stemQuality: StemQuality { get { readEnum(\.stemQuality, "stemQuality", .High) } set { writeEnum(\.stemQuality, "stemQuality", newValue, .High) } }
|
var stemQuality: StemQuality { get { readEnum(\.stemQuality, "stemQuality", .High) } set { writeEnum(\.stemQuality, "stemQuality", newValue, .High) } }
|
||||||
|
|||||||
@@ -298,6 +298,19 @@ struct Loaded<T, Content: View>: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Swapping Now Playing to the other side of the Duo's hinge. Off for now: no button, and a
|
||||||
|
/// saved swap is ignored.
|
||||||
|
let duoSwapEnabled = false
|
||||||
|
|
||||||
|
/// Split at the iPhone Duo's hinge, a tab's rows run right up to it (no inset is real on that side).
|
||||||
|
struct HingeEdge: ViewModifier {
|
||||||
|
@Environment(Ui.self) private var ui
|
||||||
|
@AppStorage("duoSwap") private var swap = false
|
||||||
|
func body(content: Content) -> some View {
|
||||||
|
content.ignoresSafeArea(.container, edges: ui.split ? (swap && duoSwapEnabled ? .leading : .trailing) : [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A plain scrolling page with a large title, like the Android shell's Page.
|
/// A plain scrolling page with a large title, like the Android shell's Page.
|
||||||
struct Page<Content: View>: View {
|
struct Page<Content: View>: View {
|
||||||
let title: String
|
let title: String
|
||||||
@@ -309,6 +322,7 @@ struct Page<Content: View>: View {
|
|||||||
LazyVStack(alignment: .leading, spacing: 0) { content() }
|
LazyVStack(alignment: .leading, spacing: 0) { content() }
|
||||||
.padding(.bottom, 24)
|
.padding(.bottom, 24)
|
||||||
}
|
}
|
||||||
|
.modifier(HingeEdge())
|
||||||
.background(p.bg)
|
.background(p.bg)
|
||||||
.navigationTitle(title)
|
.navigationTitle(title)
|
||||||
.navigationBarTitleDisplayMode(large ? .large : .inline)
|
.navigationBarTitleDisplayMode(large ? .large : .inline)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ enum DeckPage: String, CaseIterable, Hashable {
|
|||||||
enum Route: Hashable {
|
enum Route: Hashable {
|
||||||
case Artists, Albums, Songs, RecentlyAdded, Playlists, Genres, Downloads, DownloadQueue, TabBar, WebRadio
|
case Artists, Albums, Songs, RecentlyAdded, Playlists, Genres, Downloads, DownloadQueue, TabBar, WebRadio
|
||||||
case Eq, EqFilters(profileId: String), EqFilterPage(profileId: String, filterId: String)
|
case Eq, EqFilters(profileId: String), EqFilterPage(profileId: String, filterId: String)
|
||||||
case Servers, ServerList, Server(String), StemServer, Quality, Storage, Appearance, NowPlayingOptions, StemEditor, About
|
case Servers, ServerList, Server(String), StemServer, Quality, Storage, Appearance, NowPlayingOptions, StemEditor, LibraryLayout, About
|
||||||
case GenrePage(String), ArtistPage(Artist), AlbumPage(Album), PlaylistPage(Playlist), StemPlaylistPage(String)
|
case GenrePage(String), ArtistPage(Artist), AlbumPage(Album), PlaylistPage(Playlist), StemPlaylistPage(String)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,9 +120,24 @@ final class Ui {
|
|||||||
/// Split only: brings the stems and queue (or the lyrics) back beside Now Playing.
|
/// Split only: brings the stems and queue (or the lyrics) back beside Now Playing.
|
||||||
func showDeck(_ page: DeckPage? = nil) { deck = true; if let page { deckPage = page } }
|
func showDeck(_ page: DeckPage? = nil) { deck = true; if let page { deckPage = page } }
|
||||||
|
|
||||||
|
/// This phone has shown the Duo's folded status column at least once (saved).
|
||||||
|
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
|
||||||
|
/// Folded iPhone Duo: the outer display, kept upright.
|
||||||
|
var folded: Bool { duo && !split }
|
||||||
|
|
||||||
|
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
|
||||||
|
func sawInsets(trailing: CGFloat, upright: Bool) {
|
||||||
|
if !duo && upright && !split && trailing > 20 {
|
||||||
|
duo = true
|
||||||
|
UserDefaults.standard.set(true, forKey: "duoSeen")
|
||||||
|
}
|
||||||
|
Orientation.lock(folded)
|
||||||
|
}
|
||||||
|
|
||||||
func setSplit(_ on: Bool) {
|
func setSplit(_ on: Bool) {
|
||||||
guard on != split else { return }
|
guard on != split else { return }
|
||||||
split = on
|
split = on
|
||||||
|
Orientation.lock(folded)
|
||||||
if on {
|
if on {
|
||||||
nowPlayingOpen = false
|
nowPlayingOpen = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,28 +11,10 @@ struct RootView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
let s = g.settings
|
let s = g.settings
|
||||||
let p = Palette.of(s.theme, s.accent)
|
let p = Palette.of(s.theme, s.accent)
|
||||||
TabView(selection: Binding(get: { ui.showsDeck ? BarItem.deck : .tab(ui.tab) },
|
bar
|
||||||
set: { if case .tab(let t) = $0 { ui.selectTab(t) } else { ui.showDeck() } })) {
|
|
||||||
// Unfolded with something playing, Now Playing leads the bar: the deck (stems, lyrics,
|
|
||||||
// queue, EQ) on this side of the hinge, the player docked on the other.
|
|
||||||
if ui.hasDeckTab {
|
|
||||||
DuoPane { NowPlayingDeck() }
|
|
||||||
.tabItem { Label("Now Playing", systemImage: "waveform") }
|
|
||||||
.tag(BarItem.deck)
|
|
||||||
}
|
|
||||||
ForEach(ui.tabs, id: \.self) { t in
|
|
||||||
DuoPane {
|
|
||||||
NavigationStack(path: ui.path(t)) {
|
|
||||||
root(t).miniPlayerRoom()
|
|
||||||
.navigationDestination(for: Route.self) { destination($0).miniPlayerRoom() }
|
|
||||||
}
|
|
||||||
.modifier(FloatingMiniPlayer())
|
|
||||||
}
|
|
||||||
.tabItem { Label(t.rawValue, systemImage: t.icon) }
|
|
||||||
.tag(BarItem.tab(t))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.modifier(GlassMiniPlayerHost())
|
.modifier(GlassMiniPlayerHost())
|
||||||
|
// Folded on the Duo the app stays upright (the window's trailing inset gives the Duo away).
|
||||||
|
.onGeometryChange(for: CGFloat.self) { $0.safeAreaInsets.trailing } action: { ui.sawInsets(trailing: $0, upright: vSize == .regular) }
|
||||||
.background(p.bg.ignoresSafeArea())
|
.background(p.bg.ignoresSafeArea())
|
||||||
.onChange(of: ui.tabs) { _, _ in ui.ensureValidTab() }
|
.onChange(of: ui.tabs) { _, _ in ui.ensureValidTab() }
|
||||||
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
|
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
|
||||||
@@ -53,8 +35,53 @@ struct RootView: View {
|
|||||||
.tint(p.accent)
|
.tint(p.accent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Environment(\.verticalSizeClass) private var vSize
|
||||||
|
|
||||||
private enum BarItem: Hashable { case deck, tab(Tab) }
|
private enum BarItem: Hashable { case deck, tab(Tab) }
|
||||||
|
|
||||||
|
private var selection: Binding<BarItem> {
|
||||||
|
Binding(get: { ui.showsDeck ? BarItem.deck : .tab(ui.tab) },
|
||||||
|
set: { if case .tab(let t) = $0 { ui.selectTab(t) } else { ui.showDeck() } })
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unfolded with something playing, Now Playing leads the bar: the deck (stems, lyrics, queue,
|
||||||
|
/// EQ) on this side of the hinge, the player docked on the other. On iOS 18 every item stays in
|
||||||
|
/// the bar and only hides, so folding and unfolding can't shuffle the order.
|
||||||
|
@ViewBuilder private var bar: some View {
|
||||||
|
if #available(iOS 18, *) {
|
||||||
|
let shown = ui.tabs
|
||||||
|
TabView(selection: selection) {
|
||||||
|
SwiftUI.Tab("Now Playing", systemImage: "waveform", value: BarItem.deck) { DuoPane { NowPlayingDeck() } }
|
||||||
|
.hidden(!ui.hasDeckTab)
|
||||||
|
ForEach(Tab.layout(g.settings.tabLayout), id: \.self) { t in
|
||||||
|
SwiftUI.Tab(t.rawValue, systemImage: t.icon, value: BarItem.tab(t)) { page(t) }
|
||||||
|
.hidden(!shown.contains(t))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TabView(selection: selection) {
|
||||||
|
if ui.hasDeckTab {
|
||||||
|
DuoPane { NowPlayingDeck() }
|
||||||
|
.tabItem { Label("Now Playing", systemImage: "waveform") }
|
||||||
|
.tag(BarItem.deck)
|
||||||
|
}
|
||||||
|
ForEach(ui.tabs, id: \.self) { t in
|
||||||
|
page(t).tabItem { Label(t.rawValue, systemImage: t.icon) }.tag(BarItem.tab(t))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func page(_ t: Tab) -> some View {
|
||||||
|
DuoPane {
|
||||||
|
NavigationStack(path: ui.path(t)) {
|
||||||
|
root(t).miniPlayerRoom()
|
||||||
|
.navigationDestination(for: Route.self) { destination($0).miniPlayerRoom() }
|
||||||
|
}
|
||||||
|
.modifier(FloatingMiniPlayer())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ViewBuilder private func root(_ t: Tab) -> some View {
|
@ViewBuilder private func root(_ t: Tab) -> some View {
|
||||||
switch t {
|
switch t {
|
||||||
case .Library: LibraryHome()
|
case .Library: LibraryHome()
|
||||||
@@ -94,6 +121,7 @@ struct RootView: View {
|
|||||||
case .Appearance: AppearanceScreen()
|
case .Appearance: AppearanceScreen()
|
||||||
case .NowPlayingOptions: NowPlayingOptionsScreen()
|
case .NowPlayingOptions: NowPlayingOptionsScreen()
|
||||||
case .StemEditor: StemEditorScreen()
|
case .StemEditor: StemEditorScreen()
|
||||||
|
case .LibraryLayout: LibraryLayoutScreen()
|
||||||
case .About: AboutScreen()
|
case .About: AboutScreen()
|
||||||
case .ArtistPage(let a): ArtistScreen(artist: a)
|
case .ArtistPage(let a): ArtistScreen(artist: a)
|
||||||
case .AlbumPage(let a): AlbumScreen(album: a)
|
case .AlbumPage(let a): AlbumScreen(album: a)
|
||||||
@@ -165,11 +193,15 @@ private struct DuoPane<Content: View>: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { geo in
|
GeometryReader { geo in
|
||||||
let cut = Self.cut(geo)
|
let cut = Self.cut(geo)
|
||||||
let flip = swap && cut?.vertical == true
|
let flip = duoSwapEnabled && swap && cut?.vertical == true
|
||||||
let layout = cut?.vertical == false ? AnyLayout(VStackLayout(spacing: cut?.gap ?? 0)) : AnyLayout(HStackLayout(spacing: cut?.gap ?? 0))
|
let layout = cut?.vertical == false ? AnyLayout(VStackLayout(spacing: cut?.gap ?? 0)) : AnyLayout(HStackLayout(spacing: cut?.gap ?? 0))
|
||||||
layout {
|
layout {
|
||||||
content
|
content
|
||||||
.environment(\.layoutDirection, .leftToRight)
|
.environment(\.layoutDirection, .leftToRight)
|
||||||
|
// The tab's navigation picks up the window's right-hand inset (the status column)
|
||||||
|
// even though it ends at the hinge, so the bar and rows stopped short of it. The
|
||||||
|
// hinge side never needs an inset.
|
||||||
|
.ignoresSafeArea(.container, edges: cut?.vertical == true ? (flip ? .leading : .trailing) : [])
|
||||||
.frame(width: cut.map { $0.vertical ? (flip ? $0.second : $0.first) : geo.size.width } ?? geo.size.width,
|
.frame(width: cut.map { $0.vertical ? (flip ? $0.second : $0.first) : geo.size.width } ?? geo.size.width,
|
||||||
height: cut.map { $0.vertical ? geo.size.height : $0.first } ?? geo.size.height)
|
height: cut.map { $0.vertical ? geo.size.height : $0.first } ?? geo.size.height)
|
||||||
if let cut {
|
if let cut {
|
||||||
|
|||||||
@@ -10,32 +10,33 @@ struct LibraryHome: View {
|
|||||||
@State private var added: [Track] = []
|
@State private var added: [Track] = []
|
||||||
@State private var reload = 0
|
@State private var reload = 0
|
||||||
@Environment(\.scenePhase) private var scenePhase
|
@Environment(\.scenePhase) private var scenePhase
|
||||||
@State private var editing = false
|
|
||||||
private var g: AppGraph { .shared }
|
private var g: AppGraph { .shared }
|
||||||
|
|
||||||
/// Rows in the saved order. Titles not saved yet keep their default order after the saved ones.
|
/// Rows in the saved order. Titles not saved yet keep their default order after the saved ones.
|
||||||
private func ordered<T>(_ items: [T], _ title: (T) -> String) -> [T] {
|
static func ordered<T>(_ items: [T], _ s: Settings, _ title: (T) -> String) -> [T] {
|
||||||
let saved = g.settings.libraryOrder.split(separator: "|").map(String.init)
|
let saved = s.libraryOrder.split(separator: "|").map(String.init)
|
||||||
func rank(_ t: String) -> Int { saved.firstIndex(of: t) ?? saved.count }
|
func rank(_ t: String) -> Int { saved.firstIndex(of: t) ?? saved.count }
|
||||||
return items.enumerated().sorted { (rank(title($0.element)), $0.offset) < (rank(title($1.element)), $1.offset) }.map(\.element)
|
return items.enumerated().sorted { (rank(title($0.element)), $0.offset) < (rank(title($1.element)), $1.offset) }.map(\.element)
|
||||||
}
|
}
|
||||||
|
private func ordered<T>(_ items: [T], _ title: (T) -> String) -> [T] { Self.ordered(items, g.settings, title) }
|
||||||
|
|
||||||
/// Moves a row one place within its section and saves the whole order.
|
/// Moves rows within one group (Settings > Library Layout) and saves the whole order.
|
||||||
private func move(_ title: String, _ by: Int, in titles: [String]) {
|
static func reorder(_ group: [String], from: IndexSet, to: Int, _ s: Settings) {
|
||||||
guard let i = titles.firstIndex(of: title), titles.indices.contains(i + by) else { return }
|
var t = ordered(group, s) { $0 }
|
||||||
var t = titles
|
t.move(fromOffsets: from, toOffset: to)
|
||||||
t.swapAt(i, i + by)
|
let saved = s.libraryOrder.split(separator: "|").map(String.init)
|
||||||
let saved = g.settings.libraryOrder.split(separator: "|").map(String.init)
|
s.libraryOrder = (t + saved.filter { !t.contains($0) }).joined(separator: "|")
|
||||||
g.settings.libraryOrder = (t + saved.filter { !t.contains($0) }).joined(separator: "|")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static let sectionNames = ["Recent Plays", "Recently Added", "On This Day", "Stations", "Browse"]
|
static let sectionNames = ["Recent Plays", "Recently Added", "On This Day", "Stations", "Browse"]
|
||||||
|
static let stationNames = ["Library Radio", "Random Album Radio"]
|
||||||
|
static let browseNames = ["Playlists", "Artists", "Albums", "Songs", "Genres", "Downloads", "Web Radio"]
|
||||||
private var shownSections: [String] { ordered(Self.sectionNames) { $0 } }
|
private var shownSections: [String] { ordered(Self.sectionNames) { $0 } }
|
||||||
private var hiddenSections: Set<String> { Set(g.settings.libraryHidden.split(separator: "|").map(String.init)) }
|
static func hidden(_ s: Settings) -> Set<String> { Set(s.libraryHidden.split(separator: "|").map(String.init)) }
|
||||||
private func toggle(_ name: String) {
|
static func toggle(_ name: String, _ s: Settings) {
|
||||||
var h = hiddenSections
|
var h = hidden(s)
|
||||||
if h.contains(name) { h.remove(name) } else { h.insert(name) }
|
if h.contains(name) { h.remove(name) } else { h.insert(name) }
|
||||||
g.settings.libraryHidden = Self.sectionNames.filter(h.contains).joined(separator: "|")
|
s.libraryHidden = sectionNames.filter(h.contains).joined(separator: "|")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder private func section(_ name: String) -> some View {
|
@ViewBuilder private func section(_ name: String) -> some View {
|
||||||
@@ -88,8 +89,7 @@ struct LibraryHome: View {
|
|||||||
]
|
]
|
||||||
let shown = ordered(stations) { $0.1 }
|
let shown = ordered(stations) { $0.1 }
|
||||||
ForEach(shown, id: \.1) { st in
|
ForEach(shown, id: \.1) { st in
|
||||||
LibraryRow(icon: st.0, title: st.1, last: st.1 == shown.last?.1, editing: editing,
|
LibraryRow(icon: st.0, title: st.1, last: st.1 == shown.last?.1) { play(st.2) }
|
||||||
move: { move(st.1, $0, in: shown.map(\.1)) }) { play(st.2) }
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// Every tab except Settings (and this one).
|
// Every tab except Settings (and this one).
|
||||||
@@ -101,8 +101,7 @@ struct LibraryHome: View {
|
|||||||
]
|
]
|
||||||
let shownRows = ordered(rows) { $0.1 }
|
let shownRows = ordered(rows) { $0.1 }
|
||||||
ForEach(shownRows, id: \.1) { r in
|
ForEach(shownRows, id: \.1) { r in
|
||||||
LibraryRow(icon: r.0, title: r.1, last: r.1 == shownRows.last?.1, editing: editing,
|
LibraryRow(icon: r.0, title: r.1, last: r.1 == shownRows.last?.1) { ui.push(r.2) }
|
||||||
move: { move(r.1, $0, in: shownRows.map(\.1)) }) { ui.push(r.2) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,24 +118,9 @@ struct LibraryHome: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ready {
|
if ready {
|
||||||
ForEach(shownSections, id: \.self) { name in
|
// Order and visibility are set in Settings > Library Layout.
|
||||||
let off = hiddenSections.contains(name)
|
let off = Self.hidden(s)
|
||||||
if editing {
|
ForEach(shownSections.filter { !off.contains($0) }, id: \.self) { section($0) }
|
||||||
SectionEditBar(title: name, off: off,
|
|
||||||
move: { move(name, $0, in: shownSections) },
|
|
||||||
toggle: { toggle(name) })
|
|
||||||
}
|
|
||||||
if !off || editing {
|
|
||||||
section(name).opacity(off ? 0.35 : 1).allowsHitTesting(!editing || !off)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.toolbar {
|
|
||||||
if ready {
|
|
||||||
ToolbarItem(placement: .topBarTrailing) {
|
|
||||||
Button(editing ? "Done" : "Reorder") { withAnimation { editing.toggle() } }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onChange(of: scenePhase) { _, ph in if ph == .active { reload += 1 } }
|
.onChange(of: scenePhase) { _, ph in if ph == .active { reload += 1 } }
|
||||||
@@ -226,26 +210,6 @@ private struct RecentShelf: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Edit-mode header for a whole section: move it or switch it on/off.
|
|
||||||
private struct SectionEditBar: View {
|
|
||||||
let title: String
|
|
||||||
let off: Bool
|
|
||||||
let move: (Int) -> Void
|
|
||||||
let toggle: () -> Void
|
|
||||||
@Environment(\.palette) private var p
|
|
||||||
var body: some View {
|
|
||||||
HStack(spacing: 18) {
|
|
||||||
Text(title).font(.headline).foregroundStyle(p.label)
|
|
||||||
Spacer()
|
|
||||||
Image(systemName: off ? "eye.slash" : "eye").onTapGesture { toggle() }
|
|
||||||
Image(systemName: "chevron.up").onTapGesture { move(-1) }
|
|
||||||
Image(systemName: "chevron.down").onTapGesture { move(1) }
|
|
||||||
}
|
|
||||||
.font(.system(size: 17, weight: .semibold)).foregroundStyle(p.accent)
|
|
||||||
.padding(.horizontal, MARGIN).padding(.vertical, 10)
|
|
||||||
.background(p.label3.opacity(0.12))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct LibraryRow: View {
|
private struct LibraryRow: View {
|
||||||
let icon: String
|
let icon: String
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ struct NowPlayingScreen: View {
|
|||||||
@State private var artBox: CGSize = .zero
|
@State private var artBox: CGSize = .zero
|
||||||
/// The screen's height, for the strip at the top that a drag down closes from.
|
/// The screen's height, for the strip at the top that a drag down closes from.
|
||||||
@State private var screenH: CGFloat = 0
|
@State private var screenH: CGFloat = 0
|
||||||
|
@Environment(\.verticalSizeClass) private var vSize
|
||||||
|
/// Folded iPhone Duo: the outer display keeps a status column down the right edge.
|
||||||
|
@State private var folded = false
|
||||||
private var artInset: CGFloat { tight ? 18 : 28 }
|
private var artInset: CGFloat { tight ? 18 : 28 }
|
||||||
private var hPad: CGFloat { tight ? 20 : 28 }
|
private var hPad: CGFloat { tight ? 20 : 28 }
|
||||||
private var g: AppGraph { .shared }
|
private var g: AppGraph { .shared }
|
||||||
@@ -161,6 +164,12 @@ struct NowPlayingScreen: View {
|
|||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Folded, the iPhone Duo keeps a status column down the right edge. Run the player under it
|
||||||
|
// (it only overlaps the sliding preset chips) instead of leaving a quarter of the screen empty.
|
||||||
|
// Upright iPhones have no side insets, so this only changes the Duo.
|
||||||
|
.ignoresSafeArea(.container, edges: !docked && vSize == .regular ? .trailing : [])
|
||||||
|
// Measured outside the line above, so it still sees the status column.
|
||||||
|
.onGeometryChange(for: Bool.self) { $0.safeAreaInsets.trailing > 20 } action: { folded = $0 && vSize == .regular }
|
||||||
.padding(.top, docked ? 4 : tight ? 14 : 20)
|
.padding(.top, docked ? 4 : tight ? 14 : 20)
|
||||||
.padding(.bottom, tight ? 4 : 8)
|
.padding(.bottom, tight ? 4 : 8)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
@@ -192,14 +201,22 @@ struct NowPlayingScreen: View {
|
|||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func panelView(_ track: Track, header: Bool) -> some View {
|
private func panelView(_ track: Track, header: Bool) -> some View {
|
||||||
switch panel {
|
switch panel {
|
||||||
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header || !tight ? artInset : 12).contentShape(Rectangle())
|
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header || !tight ? artInset : 12,
|
||||||
case .Mixer: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag(header: true)) }; MixerPanel() }
|
leading: folded && g.settings.foldedArtLeft).contentShape(Rectangle())
|
||||||
case .Queue: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag(header: true)) }; QueuePanel(close: { show(.Queue) }) }
|
case .Mixer: VStack(spacing: 0) { if header { mini(track) }; MixerPanel(spread: folded) }
|
||||||
case .Lyrics: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag(header: true)) }; LyricsPanel(track: track) }
|
case .Queue: VStack(spacing: 0) { if header { mini(track) }; QueuePanel(close: { show(.Queue) }) }
|
||||||
|
case .Lyrics: VStack(spacing: 0) { if header { mini(track) }; LyricsPanel(track: track) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Folded on the Duo the status column sits over the header's right end, so the menu goes.
|
||||||
|
private func mini(_ track: Track) -> some View {
|
||||||
|
MiniHeader(track: track, menu: !folded, compact: folded).contentShape(Rectangle()).gesture(screenDrag(header: true))
|
||||||
|
}
|
||||||
|
|
||||||
private func controls(_ track: Track, wide: Bool, width: CGFloat) -> some View {
|
private func controls(_ track: Track, wide: Bool, width: CGFloat) -> some View {
|
||||||
|
// Folded with a panel open, the controls give the panel some of their spacing.
|
||||||
|
let snug = folded && panel != .Art
|
||||||
let pm = g.playback
|
let pm = g.playback
|
||||||
let c = tint.map { base.tinted($0) } ?? base
|
let c = tint.map { base.tinted($0) } ?? base
|
||||||
let pad: CGFloat = wide && tight ? 14 : hPad
|
let pad: CGFloat = wide && tight ? 14 : hPad
|
||||||
@@ -222,7 +239,7 @@ struct NowPlayingScreen: View {
|
|||||||
.transition(.opacity.combined(with: .move(edge: .top)))
|
.transition(.opacity.combined(with: .move(edge: .top)))
|
||||||
}
|
}
|
||||||
ProgressVolumeBar(played: c.label, unplayed: c.label3, centerLabel: badge(track))
|
ProgressVolumeBar(played: c.label, unplayed: c.label3, centerLabel: badge(track))
|
||||||
.padding(.top, tight ? (wide ? 14 : 18) : wide ? 24 : panel == .Art ? 34 : 30)
|
.padding(.top, tight ? (wide ? 14 : 18) : snug ? 14 : wide ? 24 : panel == .Art ? 34 : 30)
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
SideToggle(symbol: "shuffle", on: pm.shuffle, action: pm.toggleShuffle, width: narrow ? 36 : 40)
|
SideToggle(symbol: "shuffle", on: pm.shuffle, action: pm.toggleShuffle, width: narrow ? 36 : 40)
|
||||||
Spacer(minLength: 2)
|
Spacer(minLength: 2)
|
||||||
@@ -243,8 +260,8 @@ struct NowPlayingScreen: View {
|
|||||||
Spacer(minLength: 2)
|
Spacer(minLength: 2)
|
||||||
SideToggle(symbol: pm.repeatMode == .One ? "repeat.1" : "repeat", on: pm.repeatMode != .Off, action: pm.cycleRepeat, width: narrow ? 36 : 40)
|
SideToggle(symbol: pm.repeatMode == .One ? "repeat.1" : "repeat", on: pm.repeatMode != .Off, action: pm.cycleRepeat, width: narrow ? 36 : 40)
|
||||||
}
|
}
|
||||||
.frame(height: tight ? 76 : 84)
|
.frame(height: tight || snug ? 76 : 84)
|
||||||
.padding(.top, tight ? 4 : 14)
|
.padding(.top, tight || snug ? 4 : 14)
|
||||||
HStack {
|
HStack {
|
||||||
let hidden = NowPlayingButton.hidden(g.settings.hiddenNowPlaying)
|
let hidden = NowPlayingButton.hidden(g.settings.hiddenNowPlaying)
|
||||||
if !hidden.contains(.Mixer) { PanelToggle(symbol: "slider.vertical.3", on: docked ? ui.showsDeck && ui.deckPage == .Stems : panel == .Mixer) { show(.Mixer) } }
|
if !hidden.contains(.Mixer) { PanelToggle(symbol: "slider.vertical.3", on: docked ? ui.showsDeck && ui.deckPage == .Stems : panel == .Mixer) { show(.Mixer) } }
|
||||||
@@ -258,9 +275,9 @@ struct NowPlayingScreen: View {
|
|||||||
if !docked { Button { show(.Queue) } label: {
|
if !docked { Button { show(.Queue) } label: {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
Image(systemName: panel == .Queue ? "chevron.compact.down" : "chevron.compact.up").font(.system(size: 22, weight: .medium))
|
Image(systemName: panel == .Queue ? "chevron.compact.down" : "chevron.compact.up").font(.system(size: 22, weight: .medium))
|
||||||
if panel != .Queue && !tight { Text("Playing Next").font(.caption2.weight(.medium)) }
|
if panel != .Queue && !tight && !snug { Text("Playing Next").font(.caption2.weight(.medium)) }
|
||||||
}
|
}
|
||||||
.foregroundStyle(c.label3).frame(maxWidth: .infinity, minHeight: tight ? 24 : 30).contentShape(Rectangle())
|
.foregroundStyle(c.label3).frame(maxWidth: .infinity, minHeight: tight || snug ? 24 : 30).contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
.buttonStyle(PressFade())
|
.buttonStyle(PressFade())
|
||||||
.gesture(swipe(up: panel != .Queue)) }
|
.gesture(swipe(up: panel != .Queue)) }
|
||||||
@@ -477,14 +494,16 @@ private struct ArtPanel: View {
|
|||||||
let thumb: String?
|
let thumb: String?
|
||||||
let playing: Bool
|
let playing: Bool
|
||||||
var inset: CGFloat = 28
|
var inset: CGFloat = 28
|
||||||
|
/// Settings > Appearance, folded Duo only: art against the left edge.
|
||||||
|
var leading = false
|
||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { geo in
|
GeometryReader { geo in
|
||||||
let side = max(min(geo.size.width, geo.size.height), 1)
|
let side = max(min(geo.size.width, geo.size.height), 1)
|
||||||
Artwork(thumb: thumb, size: side, corner: 12)
|
Artwork(thumb: thumb, size: side, corner: 12)
|
||||||
.shadow(color: .black.opacity(playing ? 0.35 : 0.15), radius: playing ? 24 : 10, y: 10)
|
.shadow(color: .black.opacity(playing ? 0.35 : 0.15), radius: playing ? 24 : 10, y: 10)
|
||||||
.scaleEffect(playing ? 1 : 0.82)
|
.scaleEffect(playing ? 1 : 0.82, anchor: leading ? .leading : .center)
|
||||||
.animation(.spring(response: 0.45, dampingFraction: 0.62), value: playing)
|
.animation(.spring(response: 0.45, dampingFraction: 0.62), value: playing)
|
||||||
.frame(width: geo.size.width, height: geo.size.height)
|
.frame(width: geo.size.width, height: geo.size.height, alignment: leading ? .leading : .center)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, inset).padding(.vertical, 8)
|
.padding(.horizontal, inset).padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
@@ -492,19 +511,21 @@ private struct ArtPanel: View {
|
|||||||
|
|
||||||
private struct MiniHeader: View {
|
private struct MiniHeader: View {
|
||||||
let track: Track
|
let track: Track
|
||||||
|
var menu = true
|
||||||
|
var compact = false
|
||||||
@Environment(Ui.self) private var ui
|
@Environment(Ui.self) private var ui
|
||||||
@Environment(\.palette) private var p
|
@Environment(\.palette) private var p
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(spacing: 14) {
|
HStack(spacing: 14) {
|
||||||
Artwork(thumb: track.thumb, size: 64, corner: 8)
|
Artwork(thumb: track.thumb, size: compact ? 52 : 64, corner: 8)
|
||||||
VStack(alignment: .leading, spacing: 1) {
|
VStack(alignment: .leading, spacing: 1) {
|
||||||
Text(track.title).font(.headline).foregroundStyle(p.label).lineLimit(1)
|
Text(track.title).font(.headline).foregroundStyle(p.label).lineLimit(1)
|
||||||
Text(track.artist).font(.subheadline).foregroundStyle(p.label2).lineLimit(1)
|
Text(track.artist).font(.subheadline).foregroundStyle(p.label2).lineLimit(1)
|
||||||
}
|
}
|
||||||
Spacer(minLength: 8)
|
Spacer(minLength: 8)
|
||||||
EllipsisButton(items: ui.menu.track(track))
|
if menu { EllipsisButton(items: ui.menu.track(track)) }
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 24).padding(.vertical, 10)
|
.padding(.horizontal, 24).padding(.vertical, compact ? 6 : 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,9 +726,12 @@ private struct MixerPanel: View {
|
|||||||
/// The iPhone Duo deck: each stem's name sits over its fader so the fader gets the row's full
|
/// The iPhone Duo deck: each stem's name sits over its fader so the fader gets the row's full
|
||||||
/// width, with a bigger thumb for fine moves.
|
/// width, with a bigger thumb for fine moves.
|
||||||
var roomy = false
|
var roomy = false
|
||||||
|
/// Folded Duo: the outer display is short, so rows get a taller floor (it scrolls sooner).
|
||||||
|
var spread = false
|
||||||
@Environment(Ui.self) private var ui
|
@Environment(Ui.self) private var ui
|
||||||
@Environment(\.palette) private var p
|
@Environment(\.palette) private var p
|
||||||
@State private var meters = Meters()
|
@State private var meters = Meters()
|
||||||
|
@State private var chipsH: CGFloat = 48
|
||||||
private var g: AppGraph { .shared }
|
private var g: AppGraph { .shared }
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -719,7 +743,9 @@ private struct MixerPanel: View {
|
|||||||
let count = CGFloat(max(names.count, 1))
|
let count = CGFloat(max(names.count, 1))
|
||||||
// Rows shrink to fit every stem before anything has to scroll (the folded outer display is short).
|
// 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))
|
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))
|
: min(62, max(spread ? Self.foldedMin : Self.compactMin, (geo.size.height - chipsH - 8) / count))
|
||||||
|
// Gap above the rows that centres them on the whole panel, not just the space under the chips.
|
||||||
|
let lead = max(0, (geo.size.height - rowH * count) / 2 - chipsH)
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
if pm.source == .Original {
|
if pm.source == .Original {
|
||||||
@@ -736,7 +762,10 @@ private struct MixerPanel: View {
|
|||||||
.scrollIndicators(.hidden)
|
.scrollIndicators(.hidden)
|
||||||
.padding(.horizontal, -24)
|
.padding(.horizontal, -24)
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
|
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { chipsH = $0 }
|
||||||
}
|
}
|
||||||
|
// Rows sit centred on the panel; what's left after them goes below.
|
||||||
|
Color.clear.frame(height: pm.source == .Original ? 0 : lead)
|
||||||
// The meters' fall is timed, so 30 fps looks the same and costs a quarter of 120.
|
// 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
|
TimelineView(.animation(minimumInterval: 1 / 30, paused: !stems || !pm.playWhenReady)) { _ in
|
||||||
let levels = stems ? meters.step(pm.engine, names.count) : []
|
let levels = stems ? meters.step(pm.engine, names.count) : []
|
||||||
@@ -745,10 +774,14 @@ private struct MixerPanel: View {
|
|||||||
StemFader(name: name, setting: pm.mix[name] ?? StemSetting(), level: i < levels.count ? levels[i] : 0, enabled: stems, height: rowH, roomy: roomy)
|
StemFader(name: name, setting: pm.mix[name] ?? StemSetting(), level: i < levels.count ? levels[i] : 0, enabled: stems, height: rowH, roomy: roomy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Wide panes keep the faders a sensible length, centred across the panel.
|
||||||
|
.frame(maxWidth: roomy ? 560 : .infinity)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
}
|
}
|
||||||
Spacer(minLength: 8)
|
Spacer(minLength: 8)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 24)
|
.padding(.horizontal, 24)
|
||||||
|
.frame(minHeight: geo.size.height)
|
||||||
}
|
}
|
||||||
.scrollIndicators(.hidden)
|
.scrollIndicators(.hidden)
|
||||||
// Holds still when everything fits, so a drag down closes Now Playing instead.
|
// Holds still when everything fits, so a drag down closes Now Playing instead.
|
||||||
@@ -814,7 +847,8 @@ extension MixerPanel {
|
|||||||
/// Shortest stacked row: name line, fader and the gap under it.
|
/// Shortest stacked row: name line, fader and the gap under it.
|
||||||
static let roomyMin: CGFloat = 60
|
static let roomyMin: CGFloat = 60
|
||||||
/// Shortest side-by-side row, the fader's own height.
|
/// Shortest side-by-side row, the fader's own height.
|
||||||
static let compactMin: CGFloat = 36
|
static let compactMin: CGFloat = 30
|
||||||
|
static let foldedMin: CGFloat = 40
|
||||||
/// Preset chips plus the bottom gap.
|
/// Preset chips plus the bottom gap.
|
||||||
static let roomyChrome: CGFloat = 56
|
static let roomyChrome: CGFloat = 56
|
||||||
static let compactChrome: CGFloat = 56
|
static let compactChrome: CGFloat = 56
|
||||||
@@ -1059,12 +1093,14 @@ struct NowPlayingDeck: View {
|
|||||||
ScrollView(.horizontal) { pages(c, spacing: 18) }.scrollIndicators(.hidden)
|
ScrollView(.horizontal) { pages(c, spacing: 18) }.scrollIndicators(.hidden)
|
||||||
}
|
}
|
||||||
Spacer(minLength: 0)
|
Spacer(minLength: 0)
|
||||||
Button { withAnimation(.spring(duration: 0.4, bounce: 0.1)) { swap.toggle() } } label: {
|
if duoSwapEnabled {
|
||||||
Image(systemName: "arrow.left.arrow.right").font(.body.weight(.semibold)).foregroundStyle(c.label2)
|
Button { withAnimation(.spring(duration: 0.4, bounce: 0.1)) { swap.toggle() } } label: {
|
||||||
.frame(width: 40, height: 32).contentShape(Rectangle())
|
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")
|
||||||
}
|
}
|
||||||
.buttonStyle(PressFade())
|
|
||||||
.accessibilityLabel("Swap Sides")
|
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 24).frame(height: 36)
|
.padding(.horizontal, 24).frame(height: 36)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ struct SettingsScreen: View {
|
|||||||
Section {
|
Section {
|
||||||
NavCell(title: "Equalizer", value: !g.eq.state.enabled ? "Off" : g.eq.active?.name ?? "On", icon: "slider.vertical.3", iconBg: 0x34C759, route: .Eq)
|
NavCell(title: "Equalizer", value: !g.eq.state.enabled ? "Off" : g.eq.active?.name ?? "On", icon: "slider.vertical.3", iconBg: 0x34C759, route: .Eq)
|
||||||
NavCell(title: "Appearance", value: s.theme.label, icon: "paintbrush.fill", iconBg: 0x007AFF, route: .Appearance)
|
NavCell(title: "Appearance", value: s.theme.label, icon: "paintbrush.fill", iconBg: 0x007AFF, route: .Appearance)
|
||||||
|
NavCell(title: "Library Layout", value: nil, icon: "books.vertical.fill", iconBg: 0xFF9F0A, route: .LibraryLayout)
|
||||||
} header: { Header(text: "Sound and look") }
|
} header: { Header(text: "Sound and look") }
|
||||||
Section {
|
Section {
|
||||||
StepperCell(title: "Cache Ahead", value: $s.precacheCount, icon: "arrow.down.to.line", iconBg: 0xFF9500)
|
StepperCell(title: "Cache Ahead", value: $s.precacheCount, icon: "arrow.down.to.line", iconBg: 0xFF9500)
|
||||||
@@ -282,6 +283,45 @@ struct SettingsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- library layout -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// The Library tab's section order and which sections show, plus the order of its station and
|
||||||
|
/// browse rows. Always in edit mode, so the drag handles are right there.
|
||||||
|
struct LibraryLayoutScreen: View {
|
||||||
|
private var g: AppGraph { .shared }
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
let s = g.settings
|
||||||
|
let off = LibraryHome.hidden(s)
|
||||||
|
List {
|
||||||
|
Section {
|
||||||
|
ForEach(LibraryHome.ordered(LibraryHome.sectionNames, s) { $0 }, id: \.self) { name in
|
||||||
|
Toggle(name, isOn: Binding(get: { !off.contains(name) }, set: { _ in LibraryHome.toggle(name, s) }))
|
||||||
|
.themedRow()
|
||||||
|
}
|
||||||
|
.onMove { LibraryHome.reorder(LibraryHome.sectionNames, from: $0, to: $1, s) }
|
||||||
|
} header: { Header(text: "Sections") } footer: {
|
||||||
|
Footer(text: "Drag to reorder. Switch a section off to hide it from Library.")
|
||||||
|
}
|
||||||
|
rows("Stations", LibraryHome.stationNames, s)
|
||||||
|
rows("Browse", LibraryHome.browseNames, s)
|
||||||
|
}
|
||||||
|
.listStyle(.insetGrouped)
|
||||||
|
.listSectionSpacing(22)
|
||||||
|
.environment(\.editMode, .constant(.active))
|
||||||
|
.themedList()
|
||||||
|
.navigationTitle("Library Layout")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func rows(_ title: String, _ names: [String], _ s: Settings) -> some View {
|
||||||
|
Section {
|
||||||
|
ForEach(LibraryHome.ordered(names, s) { $0 }, id: \.self) { Text($0).themedRow() }
|
||||||
|
.onMove { LibraryHome.reorder(names, from: $0, to: $1, s) }
|
||||||
|
} header: { Header(text: title) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- about ----------------------------------------------------------------------------------
|
// ---- about ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
private struct Maintainer: Identifiable {
|
private struct Maintainer: Identifiable {
|
||||||
@@ -989,7 +1029,10 @@ struct AppearanceScreen: View {
|
|||||||
Toggle(isOn: $s.albumColorNowPlaying) { Text("Album Colour Background").foregroundStyle(c.label) }
|
Toggle(isOn: $s.albumColorNowPlaying) { Text("Album Colour Background").foregroundStyle(c.label) }
|
||||||
.tint(Color(hex: 0x34C759))
|
.tint(Color(hex: 0x34C759))
|
||||||
.themedRow()
|
.themedRow()
|
||||||
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Paints the Now Playing screen in one solid colour taken from the album art.") }
|
Toggle(isOn: $s.foldedArtLeft) { Text("Left-Align Art When Folded").foregroundStyle(c.label) }
|
||||||
|
.tint(Color(hex: 0x34C759))
|
||||||
|
.themedRow()
|
||||||
|
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Album Colour paints the Now Playing screen in one solid colour taken from the album art. Left-Align moves the art to the left edge on the folded iPhone Duo.") }
|
||||||
Section {
|
Section {
|
||||||
Toggle(isOn: $s.acapella) { Text("Spell It “Acapella”").foregroundStyle(c.label) }
|
Toggle(isOn: $s.acapella) { Text("Spell It “Acapella”").foregroundStyle(c.label) }
|
||||||
.tint(Color(hex: 0x34C759))
|
.tint(Color(hex: 0x34C759))
|
||||||
|
|||||||
@@ -65,9 +65,15 @@ extension View {
|
|||||||
|
|
||||||
private struct ThemedList: ViewModifier {
|
private struct ThemedList: ViewModifier {
|
||||||
@Environment(\.palette) private var p
|
@Environment(\.palette) private var p
|
||||||
|
@Environment(Ui.self) private var ui
|
||||||
let grouped: Bool
|
let grouped: Bool
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
content.scrollContentBackground(.hidden).background(grouped ? p.groupedBg : p.bg)
|
content.scrollContentBackground(.hidden)
|
||||||
|
// Split on the Duo the window is wide enough to count as regular, so inset lists took
|
||||||
|
// iPad-sized margins. Each pane is phone-sized, so lay lists out like a phone.
|
||||||
|
.transformEnvironment(\.horizontalSizeClass) { if ui.split { $0 = .compact } }
|
||||||
|
.modifier(HingeEdge())
|
||||||
|
.background(grouped ? p.groupedBg : p.bg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ settings:
|
|||||||
# iOS needs a plain number for the bundle version; the label is what the app and releases show.
|
# iOS needs a plain number for the bundle version; the label is what the app and releases show.
|
||||||
MARKETING_VERSION: "0.9.0"
|
MARKETING_VERSION: "0.9.0"
|
||||||
VERSION_LABEL: "0.9.0"
|
VERSION_LABEL: "0.9.0"
|
||||||
CURRENT_PROJECT_VERSION: "28"
|
CURRENT_PROJECT_VERSION: "31"
|
||||||
# Dev builds override these (build-ipa.sh dev) so they install next to the release app.
|
# Dev builds override these (build-ipa.sh dev) so they install next to the release app.
|
||||||
APP_ID: org.cdnutter.stemify
|
APP_ID: org.cdnutter.stemify
|
||||||
APP_NAME: Stemify
|
APP_NAME: Stemify
|
||||||
|
|||||||
Reference in new issue
Block a user