Compare commits

...
3 changed files with 23 additions and 13 deletions

No files matched your search

+9 -9
View File
@@ -149,20 +149,20 @@ final class Ui {
}
/// Leaves the lock as it is: freeing it let iOS turn the window while audio kept the app alive.
/// Folded with something playing, Now Playing goes up now so the app (and the snapshot iOS
/// shows on return) comes back on it instead of the library.
func backgrounded() {
away = true
showPlayingFolded()
}
func backgrounded() { away = true }
private var away = false
/// Folded with something playing, the app comes back on Now Playing.
private func showPlayingFolded() {
guard folded, !nowPlayingOpen, AppGraph.shared.playback.current != nil else { return }
var t = Transaction()
t.disablesAnimations = true
withTransaction(t) { nowPlayingOpen = true }
// Back from the background folded with something playing: Now Playing slides up as if
// swiped open, once the app's own opening animation has landed.
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(180))
guard self.folded, !self.nowPlayingOpen, AppGraph.shared.playback.current != nil else { return }
self.nowPlayingOpen = true
}
}
private func lockOrientation() {
+13 -3
View File
@@ -75,6 +75,8 @@ struct NowPlayingScreen: View {
@State private var ctlH: CGFloat = 0
/// The screen's height, for the strip at the top that a drag down closes from.
@State private var screenH: CGFloat = 0
/// Where the art sits on screen: folded, a drag down that starts on it closes Now Playing.
@State private var artFrame: CGRect = .zero
@Environment(\.verticalSizeClass) private var vSize
/// Folded iPhone Duo: the outer display keeps a status column down the right edge.
@State private var folded = false
@@ -142,6 +144,7 @@ struct NowPlayingScreen: View {
.padding(.top, docked ? 4 : tight ? 14 : 20)
.padding(.bottom, runsLow ? 0 : tight ? 4 : 8)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.coordinateSpace(.named("np"))
.background(c.bg.ignoresSafeArea())
.overlay(alignment: .top) {
// Stands in for the sheet's grabber: tap or drag down to close.
@@ -167,6 +170,7 @@ struct NowPlayingScreen: View {
switch panel {
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header ? artInset : 12,
leading: folded && !docked && !ui.split && g.settings.foldedArtLeft, edge: hPad).contentShape(Rectangle())
.onGeometryChange(for: CGRect.self) { $0.frame(in: .named("np")) } action: { artFrame = $0 }
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 .Lyrics: VStack(spacing: 0) { if header { mini(track) }; LyricsPanel(track: track) }
@@ -287,17 +291,23 @@ struct NowPlayingScreen: View {
}
/// Drag down to close: from the grabber or song header, or anywhere in the top tenth of the screen.
/// Folded, also from the art (only while it shows, so never over the stem dials).
private func fromTop(_ v: DragGesture.Value, header: Bool) -> Bool {
header || v.startLocation.y < max(screenH * 0.1, 56)
|| (folded && !docked && panel == .Art && artFrame.contains(v.startLocation))
}
private func screenDrag(header: Bool = false) -> some Gesture {
DragGesture(minimumDistance: 20)
DragGesture(minimumDistance: 20, coordinateSpace: .named("np"))
.onChanged { v in
let dy = v.translation.height
let top = header || v.startLocation.y < max(screenH * 0.1, 56)
let top = fromTop(v, header: header)
drop = !docked && top && dy > 0 && dy > abs(v.translation.width) ? dy : 0
}
.onEnded { v in
let dy = v.translation.height
let vertical = abs(dy) > abs(v.translation.width)
let top = header || v.startLocation.y < max(screenH * 0.1, 56)
let top = fromTop(v, header: header)
if !docked && top && 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.
+1 -1
View File
@@ -9,7 +9,7 @@ settings:
# iOS needs a plain number for the bundle version; the label is what the app and releases show.
MARKETING_VERSION: "0.10.1"
VERSION_LABEL: "0.10.1"
CURRENT_PROJECT_VERSION: "55"
CURRENT_PROJECT_VERSION: "57"
# Dev builds override these (build-ipa.sh dev) so they install next to the release app.
APP_ID: org.cdnutter.stemify
APP_NAME: Stemify