diff --git a/ios/Stemify/UI/RootView.swift b/ios/Stemify/UI/RootView.swift index eaaa247..0d3e895 100644 --- a/ios/Stemify/UI/RootView.swift +++ b/ios/Stemify/UI/RootView.swift @@ -26,11 +26,9 @@ struct RootView: View { } .modifier(GlassMiniPlayerHost()) .background(p.bg.ignoresSafeArea()) - .devBanner() .onChange(of: s.tabLayout) { _, _ in ui.ensureValidTab() } .fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) { NowPlayingScreen() - .devBanner() .overlayHost(ui.overlays, level: 1) .environment(ui) .environment(\.palette, p) @@ -223,29 +221,3 @@ private struct DuoPane: View { return c.first > 200 && c.second > 200 ? c : nil } } - -/// Dev builds only: a strip over the app with the build number, so they're never mistaken for release. -private struct DevBanner: ViewModifier { - private static let label: String? = { - let info = Bundle.main.infoDictionary - guard info?["StemifyChannel"] as? String == "dev" else { return nil } - let v = info?["StemifyVersionLabel"] as? String ?? "" - let b = info?["CFBundleVersion"] as? String ?? "" - return "DEV BUILD \(b) ยท \(v)" - }() - func body(content: Content) -> some View { - if let label = Self.label { - content.safeAreaInset(edge: .top, spacing: 0) { - Text(label).font(.caption2.weight(.bold)).foregroundStyle(.black) - .frame(maxWidth: .infinity).frame(height: 16) - .background(Color.orange) - } - } else { - content - } - } -} - -extension View { - func devBanner() -> some View { modifier(DevBanner()) } -} diff --git a/ios/Stemify/UI/Screens/NowPlayingScreen.swift b/ios/Stemify/UI/Screens/NowPlayingScreen.swift index 72465ca..efee1e7 100644 --- a/ios/Stemify/UI/Screens/NowPlayingScreen.swift +++ b/ios/Stemify/UI/Screens/NowPlayingScreen.swift @@ -114,6 +114,8 @@ struct NowPlayingScreen: View { private var tight: Bool { docked || duoSeen } /// Size of the art panel in the stacked layout, so the controls can match the art's width. @State private var artBox: CGSize = .zero + /// The screen's height, for the strip at the top that a drag down closes from. + @State private var screenH: CGFloat = 0 private var artInset: CGFloat { tight ? 18 : 28 } private var hPad: CGFloat { tight ? 20 : 28 } private var g: AppGraph { .shared } @@ -125,7 +127,8 @@ struct NowPlayingScreen: View { // Wide when there's no room to stack art over controls: landscape, or iPhone Duo's // outer display. Tall layouts (including the unfolded Duo) cap the controls' width. GeometryReader { geo in - let wide = geo.size.width > geo.size.height * 0.9 + // Docked beside the hinge, the pane is phone-shaped: art stays on top unless it's truly wide. + let wide = geo.size.width > geo.size.height * (docked ? 1.2 : 0.9) if let track { if wide { // The column never drops below what the transport row needs, so the buttons @@ -143,11 +146,12 @@ struct NowPlayingScreen: View { let cap: CGFloat = tight ? 520 : 560 // Controls line up with the art's edges instead of running wider than it. let art = min(artBox.width - 2 * artInset, artBox.height - 16) - let w = panel == .Art && art > 0 ? min(cap, max(300, art + 2 * hPad)) : cap + // Every panel keeps the art screen's width, so switching to the stems doesn't widen it. + let w = art > 0 ? min(cap, max(300, art + 2 * hPad)) : cap VStack(spacing: 0) { panelView(track, header: true) - .frame(maxHeight: .infinity) - .onGeometryChange(for: CGSize.self) { $0.size } action: { artBox = $0 } + .frame(maxWidth: panel == .Art ? .infinity : min(w, geo.size.width), maxHeight: .infinity) + .onGeometryChange(for: CGSize.self) { $0.size } action: { if panel == .Art { artBox = $0 } } .transition(.opacity.combined(with: .scale(scale: 0.96))) controls(track, wide: false, width: min(w, geo.size.width)).frame(maxWidth: w) } @@ -167,12 +171,13 @@ struct NowPlayingScreen: View { if !docked { Capsule().fill(c.label3).frame(width: 36, height: 5) .frame(width: 120, height: 20).contentShape(Rectangle()) .onTapGesture { dismiss() } - .gesture(screenDrag) } + .gesture(screenDrag(header: true)) } } + .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { screenH = $0 } .offset(y: drop) - // On the art and the mixer: drag down anywhere to close, swipe up anywhere for the - // queue. The queue and lyrics scroll, so there it's the song header or the grabber. - .simultaneousGesture(screenDrag, including: panel == .Art || panel == .Mixer ? .all : .subviews) + // Drag down from the top strip (or the song header) to close, so it never fights the + // stem faders. Swipe up anywhere on the art for the queue. + .simultaneousGesture(screenDrag(), including: panel == .Art ? .all : .subviews) .environment(\.palette, c) .modifier(NpScheme(dark: c.dark, docked: docked)) .tint(c.label) @@ -189,9 +194,9 @@ struct NowPlayingScreen: View { private func panelView(_ track: Track, header: Bool) -> some View { switch panel { case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header || !tight ? artInset : 12).contentShape(Rectangle()) - case .Mixer: VStack(spacing: 0) { if header { MiniHeader(track: track) }; MixerPanel() } - case .Queue: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag) }; QueuePanel(close: { show(.Queue) }) } - case .Lyrics: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag) }; LyricsPanel(track: track) } + case .Mixer: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag(header: true)) }; MixerPanel() } + case .Queue: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag(header: true)) }; QueuePanel(close: { show(.Queue) }) } + case .Lyrics: VStack(spacing: 0) { if header { MiniHeader(track: track).contentShape(Rectangle()).gesture(screenDrag(header: true)) }; LyricsPanel(track: track) } } } @@ -301,16 +306,19 @@ struct NowPlayingScreen: View { } } - private var screenDrag: some Gesture { + /// Drag down to close: from the grabber or song header, or anywhere in the top tenth of the screen. + private func screenDrag(header: Bool = false) -> some Gesture { DragGesture(minimumDistance: 20) .onChanged { v in let dy = v.translation.height - drop = !docked && dy > 0 && dy > abs(v.translation.width) ? dy : 0 + let top = header || v.startLocation.y < max(screenH * 0.1, 56) + 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) - if !docked && vertical && (dy > 120 || v.predictedEndTranslation.height > 300) { dismiss(); return } + let top = header || v.startLocation.y < max(screenH * 0.1, 56) + 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. if !docked && vertical && dy < -50 && panel != .Mixer && g.settings.swipeUpQueue { @@ -722,11 +730,12 @@ private struct MixerPanel: View { .background(p.fill, in: RoundedRectangle(cornerRadius: 12, style: .continuous)) .padding(.vertical, 8) } else { - // 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) } + // One sliding row of chips, running out to the screen edges so none looks cut off mid-pane. + ScrollView(.horizontal) { + HStack(spacing: 8) { saveChips(pm); presetChips(pm, names) }.padding(.horizontal, 24) } + .scrollIndicators(.hidden) + .padding(.horizontal, -24) .padding(.vertical, 8) } // The meters' fall is timed, so 30 fps looks the same and costs a quarter of 120. @@ -802,33 +811,6 @@ extension MixerPanel { } } - /// 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 @@ -1043,9 +1025,9 @@ struct NowPlayingDeck: View { 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)) + // Every stem without scrolling comes first; the queue scrolls in whatever is left. + let fit = MixerPanel.roomyChrome + CGFloat(n) * MixerPanel.roomyMin + 8 + let mixH = min(max(fit, min(MixerPanel.roomyHeight(n), geo.size.height - 260)), geo.size.height - 36) 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) diff --git a/ios/project.yml b/ios/project.yml index d44d82f..f75e3e7 100644 --- a/ios/project.yml +++ b/ios/project.yml @@ -9,12 +9,12 @@ settings: # iOS needs a plain number for the bundle version; the label is what the app and releases show. MARKETING_VERSION: "1.0" VERSION_LABEL: "1.0 RC 4" - CURRENT_PROJECT_VERSION: "25" + CURRENT_PROJECT_VERSION: "26" # Dev builds override these (build-ipa.sh dev) so they install next to the release app. APP_ID: org.cdnutter.stemify APP_NAME: Stemify APP_ICON: AppIcon - # "dev" shows the DEV BUILD banner across the top of the app. + # Info key StemifyChannel: "dev" on dev builds (build-ipa.sh dev). STEMIFY_CHANNEL: release targets: Stemify: diff --git a/ios/scripts/build-ipa.sh b/ios/scripts/build-ipa.sh index 2acddff..d799014 100755 --- a/ios/scripts/build-ipa.sh +++ b/ios/scripts/build-ipa.sh @@ -20,8 +20,12 @@ case $MODE in *) echo "usage: $0 release|dev|prov" >&2; exit 1 ;; esac DD=$B/dd-$MODE -# Dev builds carry a DEV BUILD banner with their build number. +# Dev builds are marked as such (Info key StemifyChannel) and put the build number in the +# version string (1.0 -> 1.0.26), so SideStore sees every dev upload as an update. CHANNEL=$([ "$MODE" = dev ] && echo dev || echo release) +MV=$(sed -nE 's/^ *MARKETING_VERSION: "(.*)"/\1/p' project.yml) +BN=$(sed -nE 's/^ *CURRENT_PROJECT_VERSION: "(.*)"/\1/p' project.yml) +[ "$MODE" = dev ] && MV=$MV.$BN # "1.0 RC 1" -> 1.0-rc1, used in file names and release tags. VERSION=$(sed -nE 's/^ *VERSION_LABEL: "(.*)"/\1/p' project.yml | tr 'A-Z' 'a-z' | sed -E 's/ (rc|beta) /-\1/; s/ /-/g') IPA=$B/$MODE/stemify-$VERSION$SUFFIX.ipa @@ -37,7 +41,7 @@ rm -rf $OUT && mkdir -p $OUT/Payload $B/$MODE # xcodebuild compiles the app, the widget extension, the asset catalog and the App Intents metadata. xcodegen generate -q xcodebuild -project Stemify.xcodeproj -scheme Stemify -configuration Release -sdk iphoneos \ - -destination generic/platform=iOS -derivedDataPath $DD APP_ID=$APP_ID APP_NAME="$APP_NAME" APP_ICON=$APP_ICON STEMIFY_CHANNEL=$CHANNEL CODE_SIGNING_ALLOWED=NO -quiet build + -destination generic/platform=iOS -derivedDataPath $DD APP_ID=$APP_ID APP_NAME="$APP_NAME" APP_ICON=$APP_ICON STEMIFY_CHANNEL=$CHANNEL MARKETING_VERSION=$MV CODE_SIGNING_ALLOWED=NO -quiet build cp -R $DD/Build/Products/Release-iphoneos/Stemify.app $APP [ -d $EXT ] || { echo "widget extension missing" >&2; exit 1; }