From b668237e8031645b5c8147036a17c0b9c0250c2e Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 9 Jan 2019 13:53:29 -0500 Subject: [PATCH 1/3] Landscape orientation. --- .../ExperienceUpgradesPageViewController.swift | 8 +++++++- Signal/src/ViewControllers/MediaDetailViewController.h | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index 71bd77d56..fbdc4a0ad 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // import Foundation @@ -814,4 +814,10 @@ public class ExperienceUpgradesPageViewController: OWSViewController, UIPageView Logger.debug("") self.dismiss(animated: true) } + + // MARK: Orientation + + override public var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return .portrait + } } diff --git a/Signal/src/ViewControllers/MediaDetailViewController.h b/Signal/src/ViewControllers/MediaDetailViewController.h index 36d770932..dea8cb45a 100644 --- a/Signal/src/ViewControllers/MediaDetailViewController.h +++ b/Signal/src/ViewControllers/MediaDetailViewController.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // #import @@ -39,8 +39,6 @@ typedef NS_OPTIONS(NSInteger, MediaGalleryOption) { viewItem:(nullable id)viewItem; #pragma mark - Actions -- (void)didPressShare:(id)sender; -- (void)didPressDelete:(id)sender; - (void)didPressPlayBarButton:(id)sender; - (void)didPressPauseBarButton:(id)sender; - (void)playVideo; From 2ddde368ecaaacc5e9839b6cebc6e631a53ed255 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 9 Jan 2019 14:32:52 -0500 Subject: [PATCH 2/3] Landscape orientation. --- Signal/src/AppDelegate.m | 9 +++++++++ SignalMessaging/utils/OWSWindowManager.h | 2 ++ SignalMessaging/utils/OWSWindowManager.m | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 549c00a1f..6ecf5c0c1 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -957,6 +957,15 @@ static NSTimeInterval launchStartedAt; return UIInterfaceOrientationMaskAllButUpsideDown; } + if (![self.windowManager isAppWindow:window]) { + // iOS uses various windows for animations, transitions, etc. + // e.g. _UIInteractiveHighlightEffectWindow, + // UITextEffectsWindow. + // + // We should be permissive with these windows. + return UIInterfaceOrientationMaskAllButUpsideDown; + } + if (window == self.windowManager.menuActionsWindow) { return UIInterfaceOrientationMaskAllButUpsideDown; } diff --git a/SignalMessaging/utils/OWSWindowManager.h b/SignalMessaging/utils/OWSWindowManager.h index 280159e35..cfebd30d7 100644 --- a/SignalMessaging/utils/OWSWindowManager.h +++ b/SignalMessaging/utils/OWSWindowManager.h @@ -31,6 +31,8 @@ extern const UIWindowLevel UIWindowLevel_Background; - (void)setIsScreenBlockActive:(BOOL)isScreenBlockActive; +- (BOOL)isAppWindow:(UIWindow *)window; + #pragma mark - Message Actions @property (nonatomic, readonly) BOOL isPresentingMenuActions; diff --git a/SignalMessaging/utils/OWSWindowManager.m b/SignalMessaging/utils/OWSWindowManager.m index e5afcc115..ff8d1888d 100644 --- a/SignalMessaging/utils/OWSWindowManager.m +++ b/SignalMessaging/utils/OWSWindowManager.m @@ -310,6 +310,14 @@ const UIWindowLevel UIWindowLevel_MessageActions(void) [self ensureWindowState]; } +- (BOOL)isAppWindow:(UIWindow *)window +{ + OWSAssertDebug(window); + + return (window == self.rootWindow || window == self.returnToCallWindow || window == self.callViewWindow + || window == self.menuActionsWindow || window == self.screenBlockingWindow); +} + #pragma mark - Message Actions - (BOOL)isPresentingMenuActions From 4ab0c8fe58694bc326590d3ac98334fd4ac84488 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 9 Jan 2019 14:36:11 -0500 Subject: [PATCH 3/3] Landscape orientation. --- .../ViewControllers/OWSViewController.m | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/SignalMessaging/ViewControllers/OWSViewController.m b/SignalMessaging/ViewControllers/OWSViewController.m index 5bc88b39b..563156c58 100644 --- a/SignalMessaging/ViewControllers/OWSViewController.m +++ b/SignalMessaging/ViewControllers/OWSViewController.m @@ -115,35 +115,39 @@ NS_ASSUME_NONNULL_BEGIN - (void)keyboardWillShow:(NSNotification *)notification { - [self handleKeyboardNotification:notification]; + [self handleKeyboardNotificationBase:notification]; } - (void)keyboardDidShow:(NSNotification *)notification { - [self handleKeyboardNotification:notification]; + [self handleKeyboardNotificationBase:notification]; } - (void)keyboardWillHide:(NSNotification *)notification { - [self handleKeyboardNotification:notification]; + [self handleKeyboardNotificationBase:notification]; } - (void)keyboardDidHide:(NSNotification *)notification { - [self handleKeyboardNotification:notification]; + [self handleKeyboardNotificationBase:notification]; } - (void)keyboardWillChangeFrame:(NSNotification *)notification { - [self handleKeyboardNotification:notification]; + [self handleKeyboardNotificationBase:notification]; } - (void)keyboardDidChangeFrame:(NSNotification *)notification { - [self handleKeyboardNotification:notification]; + [self handleKeyboardNotificationBase:notification]; } -- (void)handleKeyboardNotification:(NSNotification *)notification +// We use the name `handleKeyboardNotificationBase` instead of +// `handleKeyboardNotification` to avoid accidentally +// calling similarly methods with that name in subclasses, +// e.g. ConversationViewController. +- (void)handleKeyboardNotificationBase:(NSNotification *)notification { OWSAssertIsOnMainThread();