Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1072dde293 |
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) } }
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -201,7 +201,8 @@ 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,
|
||||||
|
leading: folded && g.settings.foldedArtLeft).contentShape(Rectangle())
|
||||||
case .Mixer: VStack(spacing: 0) { if header { mini(track) }; MixerPanel(spread: folded) }
|
case .Mixer: VStack(spacing: 0) { if header { mini(track) }; MixerPanel(spread: folded) }
|
||||||
case .Queue: VStack(spacing: 0) { if header { mini(track) }; QueuePanel(close: { show(.Queue) }) }
|
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) }
|
case .Lyrics: VStack(spacing: 0) { if header { mini(track) }; LyricsPanel(track: track) }
|
||||||
@@ -493,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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1029,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))
|
||||||
|
|||||||
+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: "30"
|
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