From b322f484a429c21ffea57b4db6fc79f1fe7af9bc Mon Sep 17 00:00:00 2001 From: Hanju Park Date: Tue, 7 Aug 2018 15:17:22 +0900 Subject: [PATCH] Enable/Disable rotation Enable/Disable rotation --- Source/Infra/EKRootViewController.swift | 9 +++++++++ Source/Model/EntryAttributes/EKAttributes.swift | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Source/Infra/EKRootViewController.swift b/Source/Infra/EKRootViewController.swift index 3c73cdf5..0854fda4 100644 --- a/Source/Infra/EKRootViewController.swift +++ b/Source/Infra/EKRootViewController.swift @@ -34,6 +34,15 @@ class EKRootViewController: UIViewController { EKWindowProvider.shared.entryWindow.isAbleToReceiveTouches = isResponsive } } + + // Rotation lock control + override var shouldAutorotate: Bool { + if lastAttributes == nil { + return true + } + + return lastAttributes.enableRotate + } // MARK: - Lifecycle diff --git a/Source/Model/EntryAttributes/EKAttributes.swift b/Source/Model/EntryAttributes/EKAttributes.swift index 578b9f69..0afc867e 100644 --- a/Source/Model/EntryAttributes/EKAttributes.swift +++ b/Source/Model/EntryAttributes/EKAttributes.swift @@ -81,4 +81,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) + + /** Autorotate Enable/Disable */ + public var enableRotate: Bool = true }