diff --git a/PasscodeLock/PasscodeLockViewController.swift b/PasscodeLock/PasscodeLockViewController.swift index a14a58fa..0526425d 100644 --- a/PasscodeLock/PasscodeLockViewController.swift +++ b/PasscodeLock/PasscodeLockViewController.swift @@ -110,6 +110,16 @@ open class PasscodeLockViewController: UIViewController, PasscodeLockTypeDelegat touchIDButton?.isHidden = !passcodeLock.isTouchIDAllowed } + // MARK: - Orientations + + open override var shouldAutorotate: Bool { + return self.passcodeConfiguration.shouldAutorotate + } + + open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return self.passcodeConfiguration.supportedInterfaceOrientations + } + // MARK: - Events fileprivate func setupEvents() { diff --git a/PasscodeLock/Protocols/PasscodeLockConfigurationType.swift b/PasscodeLock/Protocols/PasscodeLockConfigurationType.swift index ec158e75..77c34677 100644 --- a/PasscodeLock/Protocols/PasscodeLockConfigurationType.swift +++ b/PasscodeLock/Protocols/PasscodeLockConfigurationType.swift @@ -16,4 +16,25 @@ public protocol PasscodeLockConfigurationType { var shouldRequestTouchIDImmediately: Bool {get} var touchIdReason: String? {get set} var maximumInccorectPasscodeAttempts: Int {get} + var supportedInterfaceOrientations: UIInterfaceOrientationMask {get} + var shouldAutorotate: Bool {get} +} + +// set configuration optionals +extension PasscodeLockConfigurationType { + var passcodeLength: Int { + return 4 + } + + var maximumInccorectPasscodeAttempts: Int { + return -1 + } + + var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return .portrait + } + + var shouldAutorotate: Bool { + return false + } } diff --git a/PasscodeLock/Views/PasscodeLockView.xib b/PasscodeLock/Views/PasscodeLockView.xib index c17dae99..b9002e9c 100644 --- a/PasscodeLock/Views/PasscodeLockView.xib +++ b/PasscodeLock/Views/PasscodeLockView.xib @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -14,94 +18,94 @@ - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -116,23 +120,23 @@ - + diff --git a/PasscodeLockDemo/Base.lproj/Main.storyboard b/PasscodeLockDemo/Base.lproj/Main.storyboard index bea52e36..865cd846 100644 --- a/PasscodeLockDemo/Base.lproj/Main.storyboard +++ b/PasscodeLockDemo/Base.lproj/Main.storyboard @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -14,44 +18,44 @@ - + - + - + @@ -60,7 +64,7 @@ - + diff --git a/PasscodeLockDemo/Info.plist b/PasscodeLockDemo/Info.plist index 0ca4d80e..40c6215d 100644 --- a/PasscodeLockDemo/Info.plist +++ b/PasscodeLockDemo/Info.plist @@ -33,6 +33,8 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad diff --git a/PasscodeLockDemo/PasscodeLockConfiguration.swift b/PasscodeLockDemo/PasscodeLockConfiguration.swift index 5a176bd7..68439d43 100644 --- a/PasscodeLockDemo/PasscodeLockConfiguration.swift +++ b/PasscodeLockDemo/PasscodeLockConfiguration.swift @@ -10,6 +10,10 @@ import Foundation import PasscodeLock struct PasscodeLockConfiguration: PasscodeLockConfigurationType { + public var touchIdReason: String? + + let shouldAutorotate = false + let supportedInterfaceOrientations = UIInterfaceOrientationMask.portrait let repository: PasscodeRepositoryType let passcodeLength = 4