Skip to content

Commit

Permalink
Merge pull request #80 from maeji/feature/screen-rotation-lock
Browse files Browse the repository at this point in the history
Enable/Disable rotation flag
  • Loading branch information
huri000 authored Aug 31, 2018
2 parents 782f466 + a8d69fe commit a41a37d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Source/Infra/EKRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion Source/Model/EntryAttributes/EKAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
}

0 comments on commit a41a37d

Please sign in to comment.