From 2bd38efab001cde968894612f139006371862ee9 Mon Sep 17 00:00:00 2001 From: Boyko Mihail Date: Mon, 5 Oct 2020 10:31:48 +0300 Subject: [PATCH] cherry-pick 4c81de418f29bdc7ddc0382d8d0dc7c5f20c85c4 --- .../BaseOrientationNavigationController.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Sources/Classes/Controllers/BaseOrientationNavigationController.swift b/Sources/Classes/Controllers/BaseOrientationNavigationController.swift index c24c0110..9b9280a0 100644 --- a/Sources/Classes/Controllers/BaseOrientationNavigationController.swift +++ b/Sources/Classes/Controllers/BaseOrientationNavigationController.swift @@ -1,25 +1,26 @@ -import RxSwift import UIKit open class OrientationNavigationController: UINavigationController { // MARK: - Public properties + + var presentedOrTopViewController: UIViewController? { + presentedViewController ?? topViewController + } + open override var shouldAutorotate: Bool { - return presentedViewController?.shouldAutorotate - ?? topViewController?.shouldAutorotate + presentedOrTopViewController?.shouldAutorotate ?? super.shouldAutorotate } open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return presentedViewController?.supportedInterfaceOrientations - ?? topViewController?.supportedInterfaceOrientations + presentedOrTopViewController?.supportedInterfaceOrientations ?? super.supportedInterfaceOrientations } open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { - return presentedViewController?.preferredInterfaceOrientationForPresentation - ?? topViewController?.preferredInterfaceOrientationForPresentation + presentedOrTopViewController?.preferredInterfaceOrientationForPresentation ?? super.preferredInterfaceOrientationForPresentation } }