Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4dfcfbf434 | ||
|
|
56c92e8b93 | ||
|
|
639b5368ff | ||
|
|
cfaedd06cf | ||
|
|
8f3a10df2f | ||
|
|
5868430f8a |
No files matched your search
@@ -37,19 +37,19 @@ enum Orientation {
|
|||||||
/// Folded Duo: portrait only. Unfolded Duo: landscape only. Anything else turns freely.
|
/// Folded Duo: portrait only. Unfolded Duo: landscape only. Anything else turns freely.
|
||||||
/// Also re-checks the window when the mask is unchanged: a request made while the app was
|
/// Also re-checks the window when the mask is unchanged: a request made while the app was
|
||||||
/// in the background can be refused, which left the folded screen stuck sideways on return.
|
/// in the background can be refused, which left the folded screen stuck sideways on return.
|
||||||
@MainActor static func lock(_ m: UIInterfaceOrientationMask, retry: Int = 2) {
|
@MainActor static func lock(_ m: UIInterfaceOrientationMask, retry: Int = 6) {
|
||||||
let changed = m != mask
|
let changed = m != mask
|
||||||
mask = m
|
mask = m
|
||||||
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes where scene.session.role == .windowApplication {
|
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes where scene.session.role == .windowApplication {
|
||||||
if changed { scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations() }
|
if changed { scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations() }
|
||||||
let now = UIInterfaceOrientationMask(rawValue: 1 << scene.effectiveGeometry.interfaceOrientation.rawValue)
|
let now = UIInterfaceOrientationMask(rawValue: 1 << scene.effectiveGeometry.interfaceOrientation.rawValue)
|
||||||
guard m != .allButUpsideDown, !m.contains(now) else { continue }
|
guard m != .allButUpsideDown, !m.contains(now) else { continue }
|
||||||
scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in
|
scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in }
|
||||||
guard retry > 0 else { return }
|
// The request can be dropped silently (mid-unfold, just back from the background), so check it took.
|
||||||
Task { @MainActor in
|
guard retry > 0 else { continue }
|
||||||
try? await Task.sleep(for: .milliseconds(300))
|
Task { @MainActor in
|
||||||
if mask == m { lock(m, retry: retry - 1) }
|
try? await Task.sleep(for: .milliseconds(500))
|
||||||
}
|
if mask == m { lock(m, retry: retry - 1) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ final class Ui {
|
|||||||
}
|
}
|
||||||
/// True while an unfolded iPhone Duo shows Now Playing docked beside the library.
|
/// True while an unfolded iPhone Duo shows Now Playing docked beside the library.
|
||||||
private(set) var split = false
|
private(set) var split = false
|
||||||
|
/// Unfolded Duo in any orientation (a hinge is showing), even before it has turned to landscape.
|
||||||
|
private(set) var unfolded = false
|
||||||
/// Split only: the Now Playing tab (the deck) is selected instead of `tab`.
|
/// Split only: the Now Playing tab (the deck) is selected instead of `tab`.
|
||||||
var deck = true
|
var deck = true
|
||||||
/// Split only: which of the deck's pages is showing.
|
/// Split only: which of the deck's pages is showing.
|
||||||
@@ -123,7 +125,7 @@ final class Ui {
|
|||||||
/// This phone has shown the Duo's folded status column at least once (saved).
|
/// This phone has shown the Duo's folded status column at least once (saved).
|
||||||
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
|
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
|
||||||
/// Folded iPhone Duo: the outer display, kept upright.
|
/// Folded iPhone Duo: the outer display, kept upright.
|
||||||
var folded: Bool { duo && !split }
|
var folded: Bool { duo && !split && !unfolded }
|
||||||
|
|
||||||
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
|
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
|
||||||
func sawInsets(trailing: CGFloat, upright: Bool) {
|
func sawInsets(trailing: CGFloat, upright: Bool) {
|
||||||
@@ -137,10 +139,20 @@ final class Ui {
|
|||||||
/// Split (unfolded) goes landscape at once. Portrait waits a moment and checks again, so a
|
/// Split (unfolded) goes landscape at once. Portrait waits a moment and checks again, so a
|
||||||
/// frame without a hinge reading mid-rotation can't throw an unfolded phone back upright.
|
/// frame without a hinge reading mid-rotation can't throw an unfolded phone back upright.
|
||||||
/// Back in the foreground: the phone may have been folded or unfolded meanwhile.
|
/// Back in the foreground: the phone may have been folded or unfolded meanwhile.
|
||||||
func resumed() { lockOrientation() }
|
/// The split/unfolded flags are from before the app left, so locking on them at once can force
|
||||||
|
/// landscape on a phone folded meanwhile. Free the rotation while away and decide again once
|
||||||
|
/// the window has settled to the screen it came back on.
|
||||||
|
func resumed() {
|
||||||
|
Task { @MainActor in
|
||||||
|
try? await Task.sleep(for: .milliseconds(300))
|
||||||
|
self.lockOrientation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func backgrounded() { Orientation.lock(.allButUpsideDown) }
|
||||||
|
|
||||||
private func lockOrientation() {
|
private func lockOrientation() {
|
||||||
if split { Orientation.lock(.landscape); return }
|
if split || unfolded { Orientation.lock(.landscape); return }
|
||||||
guard folded else { Orientation.lock(.allButUpsideDown); return }
|
guard folded else { Orientation.lock(.allButUpsideDown); return }
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
try? await Task.sleep(for: .milliseconds(400))
|
try? await Task.sleep(for: .milliseconds(400))
|
||||||
@@ -148,6 +160,12 @@ final class Ui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setUnfolded(_ on: Bool) {
|
||||||
|
guard on != unfolded else { return }
|
||||||
|
unfolded = on
|
||||||
|
lockOrientation()
|
||||||
|
}
|
||||||
|
|
||||||
func setSplit(_ on: Bool) {
|
func setSplit(_ on: Bool) {
|
||||||
guard on != split else { return }
|
guard on != split else { return }
|
||||||
split = on
|
split = on
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ struct RootView: View {
|
|||||||
.onGeometryChange(for: CGFloat.self) { $0.safeAreaInsets.trailing } action: { ui.sawInsets(trailing: $0, upright: vSize == .regular) }
|
.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() }
|
||||||
.onChange(of: phase) { _, ph in if ph == .active { ui.resumed() } }
|
.onChange(of: phase) { _, ph in
|
||||||
|
if ph == .active { ui.resumed() } else if ph == .background { ui.backgrounded() }
|
||||||
|
}
|
||||||
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
|
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
|
||||||
NowPlayingScreen()
|
NowPlayingScreen()
|
||||||
.overlayHost(ui.overlays, level: 1)
|
.overlayHost(ui.overlays, level: 1)
|
||||||
@@ -202,7 +204,9 @@ 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 hinge = Self.cut(geo)
|
||||||
|
// Unfolded upright (hinge across) never splits: the app turns to landscape instead.
|
||||||
|
let cut = hinge?.vertical == true ? hinge : nil
|
||||||
let flip = duoSwapEnabled && 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 {
|
||||||
@@ -227,6 +231,7 @@ private struct DuoPane<Content: View>: View {
|
|||||||
// The hinge gap shows whatever is behind; paint it so the two sides read as one.
|
// The hinge gap shows whatever is behind; paint it so the two sides read as one.
|
||||||
.background(p.bg.ignoresSafeArea())
|
.background(p.bg.ignoresSafeArea())
|
||||||
.animation(.spring(duration: 0.4, bounce: 0.1), value: flip)
|
.animation(.spring(duration: 0.4, bounce: 0.1), value: flip)
|
||||||
|
.onChange(of: hinge != nil, initial: true) { _, on in ui.setUnfolded(on) }
|
||||||
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) }
|
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,6 +255,10 @@ private struct DuoPane<Content: View>: View {
|
|||||||
let screenW = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.screen.bounds.width
|
let screenW = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.screen.bounds.width
|
||||||
let half = ((screenW ?? size.width) / 2 - geo.frame(in: .global).minX).rounded()
|
let half = ((screenW ?? size.width) / 2 - geo.frame(in: .global).minX).rounded()
|
||||||
c = Cut(vertical: true, first: half - 12, gap: 24, second: size.width - half - 12)
|
c = Cut(vertical: true, first: half - 12, gap: 24, second: size.width - half - 12)
|
||||||
|
} else if UIDevice.current.userInterfaceIdiom == .phone, size.width >= 500, size.height >= 700 {
|
||||||
|
// Unfolded but still upright: only marks the phone as unfolded so it turns to landscape.
|
||||||
|
let half = (size.height / 2).rounded()
|
||||||
|
c = Cut(vertical: false, first: half - 12, gap: 24, second: size.height - half - 12)
|
||||||
}
|
}
|
||||||
guard let c else { return nil }
|
guard let c else { return nil }
|
||||||
// A region that doesn't leave usable room on both sides isn't a hinge worth splitting at.
|
// A region that doesn't leave usable room on both sides isn't a hinge worth splitting at.
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ struct NowPlayingScreen: View {
|
|||||||
Spacer(minLength: 8)
|
Spacer(minLength: 8)
|
||||||
EllipsisButton(items: ui.menu.track(track))
|
EllipsisButton(items: ui.menu.track(track))
|
||||||
}
|
}
|
||||||
.padding(.top, tight || snug ? 8 : 14)
|
.padding(.top, snug && !docked ? 20 : tight ? 8 : 14)
|
||||||
.transition(.opacity.combined(with: .move(edge: .top)))
|
.transition(.opacity.combined(with: .move(edge: .top)))
|
||||||
}
|
}
|
||||||
ProgressVolumeBar(played: g.settings.albumTheme ? c.accent : c.label, unplayed: c.label3, centerLabel: badge(track))
|
ProgressVolumeBar(played: g.settings.albumTheme ? c.accent : c.label, unplayed: c.label3, centerLabel: badge(track))
|
||||||
|
|||||||
+3
-3
@@ -7,9 +7,9 @@ settings:
|
|||||||
base:
|
base:
|
||||||
SWIFT_VERSION: "5.0"
|
SWIFT_VERSION: "5.0"
|
||||||
# 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.10.0"
|
MARKETING_VERSION: "0.10.1"
|
||||||
VERSION_LABEL: "0.10.0"
|
VERSION_LABEL: "0.10.1"
|
||||||
CURRENT_PROJECT_VERSION: "45"
|
CURRENT_PROJECT_VERSION: "47"
|
||||||
# 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
|
||||||
|
|||||||
@@ -15,6 +15,16 @@
|
|||||||
"tintColor": "#FA2D48",
|
"tintColor": "#FA2D48",
|
||||||
"category": "entertainment",
|
"category": "entertainment",
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"version": "0.10.1",
|
||||||
|
"marketingVersion": "0.10.1",
|
||||||
|
"buildVersion": "47",
|
||||||
|
"date": "2026-11-20T10:17:10-08:00",
|
||||||
|
"localizedDescription": "iOS: free orientation in background, re-lock after resume settles",
|
||||||
|
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.10.1/stemify-0.10.1.ipa",
|
||||||
|
"size": 3136176,
|
||||||
|
"minOSVersion": "17.0"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.10.0",
|
"version": "0.10.0",
|
||||||
"marketingVersion": "0.10.0",
|
"marketingVersion": "0.10.0",
|
||||||
|
|||||||
Reference in new issue
Block a user