From eab3599ce91236feeb286883acda2e0f44af92de Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 16 Jan 2019 16:42:11 -0500 Subject: [PATCH] Add feature flag for landscape orientation. --- Signal/Signal-Info.plist | 2 -- .../ViewControllers/MenuActionsViewController.swift | 2 +- .../ViewControllers/OWSImagePickerController.swift | 2 +- Signal/src/ViewControllers/ProfileViewController.m | 2 +- .../Registration/BackupRestoreViewController.swift | 2 +- .../ViewControllers/CountryCodeViewController.m | 2 +- SignalMessaging/ViewControllers/OWSViewController.h | 6 +++++- SignalMessaging/ViewControllers/OWSViewController.m | 11 ++++++++++- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 5d4bce5c0..3504f3fa2 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -148,8 +148,6 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance diff --git a/Signal/src/ViewControllers/MenuActionsViewController.swift b/Signal/src/ViewControllers/MenuActionsViewController.swift index 3019edf69..285268c25 100644 --- a/Signal/src/ViewControllers/MenuActionsViewController.swift +++ b/Signal/src/ViewControllers/MenuActionsViewController.swift @@ -93,7 +93,7 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate { // MARK: Orientation override public var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return .allButUpsideDown + return DefaultUIInterfaceOrientationMask() } // MARK: Present / Dismiss animations diff --git a/Signal/src/ViewControllers/OWSImagePickerController.swift b/Signal/src/ViewControllers/OWSImagePickerController.swift index 4583f5414..904a239df 100644 --- a/Signal/src/ViewControllers/OWSImagePickerController.swift +++ b/Signal/src/ViewControllers/OWSImagePickerController.swift @@ -9,6 +9,6 @@ import Foundation // MARK: Orientation override public var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return .allButUpsideDown + return DefaultUIInterfaceOrientationMask() } } diff --git a/Signal/src/ViewControllers/ProfileViewController.m b/Signal/src/ViewControllers/ProfileViewController.m index 9a18d755b..90d65feb1 100644 --- a/Signal/src/ViewControllers/ProfileViewController.m +++ b/Signal/src/ViewControllers/ProfileViewController.m @@ -624,7 +624,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return (self.profileViewMode == ProfileViewMode_Registration ? UIInterfaceOrientationMaskPortrait - : UIInterfaceOrientationMaskAllButUpsideDown); + : DefaultUIInterfaceOrientationMask()); } @end diff --git a/Signal/src/ViewControllers/Registration/BackupRestoreViewController.swift b/Signal/src/ViewControllers/Registration/BackupRestoreViewController.swift index 7547704b0..7da4aea50 100644 --- a/Signal/src/ViewControllers/Registration/BackupRestoreViewController.swift +++ b/Signal/src/ViewControllers/Registration/BackupRestoreViewController.swift @@ -170,6 +170,6 @@ public class BackupRestoreViewController: OWSTableViewController { // MARK: Orientation public override var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return .allButUpsideDown + return DefaultUIInterfaceOrientationMask() } } diff --git a/SignalMessaging/ViewControllers/CountryCodeViewController.m b/SignalMessaging/ViewControllers/CountryCodeViewController.m index 4d83e0098..16ea98bc4 100644 --- a/SignalMessaging/ViewControllers/CountryCodeViewController.m +++ b/SignalMessaging/ViewControllers/CountryCodeViewController.m @@ -28,7 +28,7 @@ [super loadView]; self.shouldUseTheme = NO; - self.interfaceOrientationMask = UIInterfaceOrientationMaskAllButUpsideDown; + self.interfaceOrientationMask = DefaultUIInterfaceOrientationMask(); self.view.backgroundColor = [UIColor whiteColor]; self.title = NSLocalizedString(@"COUNTRYCODE_SELECT_TITLE", @""); diff --git a/SignalMessaging/ViewControllers/OWSViewController.h b/SignalMessaging/ViewControllers/OWSViewController.h index a195e4c4c..acb69ade3 100644 --- a/SignalMessaging/ViewControllers/OWSViewController.h +++ b/SignalMessaging/ViewControllers/OWSViewController.h @@ -1,11 +1,15 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // #import NS_ASSUME_NONNULL_BEGIN +#define LANDSCAPE_ORIENTATION_ENABLED + +UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void); + @interface OWSViewController : UIViewController @property (nonatomic) BOOL shouldIgnoreKeyboardChanges; diff --git a/SignalMessaging/ViewControllers/OWSViewController.m b/SignalMessaging/ViewControllers/OWSViewController.m index 563156c58..4b73e852d 100644 --- a/SignalMessaging/ViewControllers/OWSViewController.m +++ b/SignalMessaging/ViewControllers/OWSViewController.m @@ -8,6 +8,15 @@ NS_ASSUME_NONNULL_BEGIN +UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void) +{ +#ifdef LANDSCAPE_ORIENTATION_ENABLED + return UIInterfaceOrientationMaskAllButUpsideDown; +#else + return UIInterfaceOrientationMaskPortrait; +#endif +} + @interface OWSViewController () @property (nonatomic, weak) UIView *bottomLayoutView; @@ -185,7 +194,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIInterfaceOrientationMask)supportedInterfaceOrientations { - return UIInterfaceOrientationMaskAllButUpsideDown; + return DefaultUIInterfaceOrientationMask(); } @end