Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/Disable rotation flag #80

Merged
merged 2 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {}
}