diff --git a/Source/Infra/EKRootViewController.swift b/Source/Infra/EKRootViewController.swift index c3fe5f56..4c677ca6 100644 --- a/Source/Infra/EKRootViewController.swift +++ b/Source/Infra/EKRootViewController.swift @@ -42,6 +42,15 @@ class EKRootViewController: UIViewController { EKWindowProvider.shared.entryWindow.isAbleToReceiveTouches = isResponsive } } + + // Rotation lock control + override var shouldAutorotate: Bool { + if lastAttributes == nil { + return true + } + + return lastAttributes.positionConstraints.isRotationEnabled + } override var preferredStatusBarStyle: UIStatusBarStyle { return statusBar?.appearance.style ?? previousStatusBar.appearance.style diff --git a/Source/Model/EntryAttributes/EKAttributes+PositionConstraints.swift b/Source/Model/EntryAttributes/EKAttributes+PositionConstraints.swift index 302d0ecf..07dd54a7 100644 --- a/Source/Model/EntryAttributes/EKAttributes+PositionConstraints.swift +++ b/Source/Model/EntryAttributes/EKAttributes+PositionConstraints.swift @@ -12,7 +12,9 @@ public extension EKAttributes { /** Describes the frame of the entry. It's limitations, width and offset from the anchor (top / bottom of the screen) */ public struct PositionConstraints { - + /** Autorotate Enable/Disable */ + public var isRotationEnabled: Bool = true + /** Describes safe area relation */ public enum SafeArea { diff --git a/Source/Model/EntryAttributes/EKAttributes.swift b/Source/Model/EntryAttributes/EKAttributes.swift index 020a949e..3dd5fbf5 100644 --- a/Source/Model/EntryAttributes/EKAttributes.swift +++ b/Source/Model/EntryAttributes/EKAttributes.swift @@ -86,7 +86,7 @@ public struct EKAttributes { /** Describes the previous entry behaviour when a new entry with higher display-priority shows */ public var popBehavior = PopBehavior.animated(animation: .translation) - + /** Init with default attributes */ public init() {} }