Merge branch 'charlesmchen/landscapeOrientationFeatureFlag' into release/2.34.0

pull/1/head
Matthew Chen 6 years ago
commit b23a8b75d3

@ -148,8 +148,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>

@ -145,7 +145,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
// e.g. when getting to media details via message details screen, there's only
// one "Page" so the bounce doesn't make sense.
pagerScrollView.isScrollEnabled = sliderEnabled
pagerScrollViewContentOffsetObservation = pagerScrollView.observe(\.contentOffset, options: [.new]) { [weak self] object, change in
pagerScrollViewContentOffsetObservation = pagerScrollView.observe(\.contentOffset, options: [.new]) { [weak self] _, change in
guard let strongSelf = self else { return }
strongSelf.pagerScrollView(strongSelf.pagerScrollView, contentOffsetDidChange: change)
}
@ -607,10 +607,16 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
return
}
mediaGalleryDataSource.dismissMediaDetailViewController(self,
animated: isAnimated,
completion: completion)
if IsLandscapeOrientationEnabled() {
mediaGalleryDataSource.dismissMediaDetailViewController(self,
animated: isAnimated,
completion: completion)
} else {
mediaGalleryDataSource.dismissMediaDetailViewController(self, animated: isAnimated) {
UIDevice.current.ows_setOrientation(.portrait)
completion?()
}
}
}
// MARK: MediaDetailViewControllerDelegate

@ -93,7 +93,7 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate {
// MARK: Orientation
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .allButUpsideDown
return DefaultUIInterfaceOrientationMask()
}
// MARK: Present / Dismiss animations

@ -9,6 +9,6 @@ import Foundation
// MARK: Orientation
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .allButUpsideDown
return DefaultUIInterfaceOrientationMask()
}
}

@ -624,7 +624,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return (self.profileViewMode == ProfileViewMode_Registration ? UIInterfaceOrientationMaskPortrait
: UIInterfaceOrientationMaskAllButUpsideDown);
: DefaultUIInterfaceOrientationMask());
}
@end

@ -170,6 +170,6 @@ public class BackupRestoreViewController: OWSTableViewController {
// MARK: Orientation
public override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .allButUpsideDown
return DefaultUIInterfaceOrientationMask()
}
}

@ -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", @"");

@ -1,11 +1,15 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
BOOL IsLandscapeOrientationEnabled(void);
UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void);
@interface OWSViewController : UIViewController
@property (nonatomic) BOOL shouldIgnoreKeyboardChanges;

@ -8,6 +8,17 @@
NS_ASSUME_NONNULL_BEGIN
BOOL IsLandscapeOrientationEnabled(void)
{
return NO;
}
UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void)
{
return (IsLandscapeOrientationEnabled() ? UIInterfaceOrientationMaskAllButUpsideDown
: UIInterfaceOrientationMaskPortrait);
}
@interface OWSViewController ()
@property (nonatomic, weak) UIView *bottomLayoutView;
@ -185,7 +196,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
return DefaultUIInterfaceOrientationMask();
}
@end

Loading…
Cancel
Save