Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f68aa588b |
No files matched your search
@@ -34,13 +34,13 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
|
|||||||
enum Orientation {
|
enum Orientation {
|
||||||
nonisolated(unsafe) static var mask: UIInterfaceOrientationMask = .allButUpsideDown
|
nonisolated(unsafe) static var mask: UIInterfaceOrientationMask = .allButUpsideDown
|
||||||
|
|
||||||
@MainActor static func lock(_ upright: Bool) {
|
/// Folded Duo: portrait only. Unfolded Duo: landscape only. Anything else turns freely.
|
||||||
let m: UIInterfaceOrientationMask = upright ? .portrait : .allButUpsideDown
|
@MainActor static func lock(_ m: UIInterfaceOrientationMask) {
|
||||||
guard m != mask else { return }
|
guard m != mask else { return }
|
||||||
mask = m
|
mask = m
|
||||||
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes {
|
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes {
|
||||||
scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
|
scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||||
if upright { scene.requestGeometryUpdate(.iOS(interfaceOrientations: .portrait)) { _ in } }
|
if m != .allButUpsideDown { scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,13 +131,24 @@ final class Ui {
|
|||||||
duo = true
|
duo = true
|
||||||
UserDefaults.standard.set(true, forKey: "duoSeen")
|
UserDefaults.standard.set(true, forKey: "duoSeen")
|
||||||
}
|
}
|
||||||
Orientation.lock(folded)
|
lockOrientation()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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.
|
||||||
|
private func lockOrientation() {
|
||||||
|
if split { Orientation.lock(.landscape); return }
|
||||||
|
guard folded else { Orientation.lock(.allButUpsideDown); return }
|
||||||
|
Task { @MainActor in
|
||||||
|
try? await Task.sleep(for: .milliseconds(400))
|
||||||
|
if self.folded { Orientation.lock(.portrait) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
lockOrientation()
|
||||||
if on {
|
if on {
|
||||||
nowPlayingOpen = false
|
nowPlayingOpen = false
|
||||||
}
|
}
|
||||||
|
|||||||
+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: "34"
|
CURRENT_PROJECT_VERSION: "35"
|
||||||
# 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