Landscape orientation.

This commit is contained in:
Matthew Chen 2019-01-08 11:47:40 -05:00
parent aefe0eabed
commit 5adcbac5ef
4 changed files with 26 additions and 6 deletions

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "AppDelegate.h"
@ -946,6 +946,16 @@ static NSTimeInterval launchStartedAt;
- (UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window
{
if (!window) {
// If `window` is nil, be permissive. Otherwise orientation
// gets messed up during presentation of windows.
return UIInterfaceOrientationMaskAllButUpsideDown;
}
if (window == self.windowManager.menuActionsWindow) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
if (self.windowManager.rootWindow != window) {
return UIInterfaceOrientationMaskPortrait;
}

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -92,8 +92,8 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate {
// MARK: Orientation
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .allButUpsideDown
}
// MARK: Present / Dismiss animations

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@ -27,6 +27,7 @@ extern const UIWindowLevel UIWindowLevel_Background;
- (void)setupWithRootWindow:(UIWindow *)rootWindow screenBlockingWindow:(UIWindow *)screenBlockingWindow;
@property (nonatomic, readonly) UIWindow *rootWindow;
@property (nonatomic, readonly) UIWindow *menuActionsWindow;
- (void)setIsScreenBlockActive:(BOOL)isScreenBlockActive;

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSWindowManager.h"
@ -65,11 +65,14 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
return CGFLOAT_MAX - 100;
}
#pragma mark -
@interface MessageActionsWindow : UIWindow
@end
#pragma mark -
@implementation MessageActionsWindow
- (UIWindowLevel)windowLevel
@ -83,6 +86,8 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
@end
#pragma mark -
@implementation OWSWindowRootViewController
- (BOOL)canBecomeFirstResponder
@ -99,10 +104,14 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
@end
#pragma mark -
@interface OWSWindowRootNavigationViewController : UINavigationController
@end
#pragma mark -
@implementation OWSWindowRootNavigationViewController : UINavigationController
#pragma mark - Orientation