mirror of
https://github.com/yattee/yattee.git
synced 2025-11-25 10:48:17 +00:00
Restrict orientation locking to iPhone only
- Add device checks in Orientation enum to prevent locking on iPad - Hide "Lock portrait mode" setting on iPad in BrowsingSettings - Use Constants.isIPhone for consistent device detection
This commit is contained in:
@@ -185,7 +185,7 @@ struct BrowsingSettings: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
Toggle("Show Documents", isOn: $showDocuments)
|
Toggle("Show Documents", isOn: $showDocuments)
|
||||||
|
|
||||||
if Constants.isIPad {
|
if Constants.isIPhone {
|
||||||
Toggle("Lock portrait mode", isOn: $lockPortraitWhenBrowsing)
|
Toggle("Lock portrait mode", isOn: $lockPortraitWhenBrowsing)
|
||||||
.onChange(of: lockPortraitWhenBrowsing) { lock in
|
.onChange(of: lockPortraitWhenBrowsing) { lock in
|
||||||
if lock {
|
if lock {
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ enum Orientation {
|
|||||||
static var logger = Logger(label: "stream.yattee.orientation")
|
static var logger = Logger(label: "stream.yattee.orientation")
|
||||||
|
|
||||||
static func lockOrientation(_ orientation: UIInterfaceOrientationMask) {
|
static func lockOrientation(_ orientation: UIInterfaceOrientationMask) {
|
||||||
|
// Orientation locking is only for iPhone, not iPad
|
||||||
|
guard Constants.isIPhone else {
|
||||||
|
logger.info("skipping orientation lock on iPad")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if let delegate = AppDelegate.instance {
|
if let delegate = AppDelegate.instance {
|
||||||
delegate.orientationLock = orientation
|
delegate.orientationLock = orientation
|
||||||
|
|
||||||
@@ -18,6 +24,12 @@ enum Orientation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func lockOrientation(_ orientation: UIInterfaceOrientationMask, andRotateTo rotateOrientation: UIInterfaceOrientation? = nil) {
|
static func lockOrientation(_ orientation: UIInterfaceOrientationMask, andRotateTo rotateOrientation: UIInterfaceOrientation? = nil) {
|
||||||
|
// Orientation locking and rotation is only for iPhone, not iPad
|
||||||
|
guard Constants.isIPhone else {
|
||||||
|
logger.info("skipping orientation lock and rotation on iPad")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
lockOrientation(orientation)
|
lockOrientation(orientation)
|
||||||
|
|
||||||
guard let rotateOrientation else {
|
guard let rotateOrientation else {
|
||||||
|
|||||||
Reference in New Issue
Block a user