From bb86e1aafdbdf657e66276607935d66f22319408 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 7 Jan 2020 22:19:38 -0500 Subject: [PATCH] Allow rotaion in the attachment gallery Closes #77 --- Tusker/Info.plist | 2 ++ Tusker/Screens/Gallery/GalleryViewController.swift | 8 ++++++++ Tusker/Screens/Main/MainTabBarViewController.swift | 8 ++++++++ .../Onboarding/InstanceSelectorTableViewController.swift | 8 ++++++++ 4 files changed, 26 insertions(+) diff --git a/Tusker/Info.plist b/Tusker/Info.plist index 937a979e..7a90b6e8 100644 --- a/Tusker/Info.plist +++ b/Tusker/Info.plist @@ -69,6 +69,8 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationLandscapeLeft UISupportedInterfaceOrientations~ipad diff --git a/Tusker/Screens/Gallery/GalleryViewController.swift b/Tusker/Screens/Gallery/GalleryViewController.swift index d582d7dd..81d76482 100644 --- a/Tusker/Screens/Gallery/GalleryViewController.swift +++ b/Tusker/Screens/Gallery/GalleryViewController.swift @@ -35,6 +35,14 @@ class GalleryViewController: UIPageViewController, UIPageViewControllerDataSourc return viewControllers?.first } + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + if UIDevice.current.userInterfaceIdiom == .phone { + return .allButUpsideDown + } else { + return .all + } + } + init(attachments: [Attachment], sourcesInfo: [LargeImageViewController.SourceInfo?], startIndex: Int) { self.attachments = attachments self.sourcesInfo = sourcesInfo diff --git a/Tusker/Screens/Main/MainTabBarViewController.swift b/Tusker/Screens/Main/MainTabBarViewController.swift index 02590765..50ca2284 100644 --- a/Tusker/Screens/Main/MainTabBarViewController.swift +++ b/Tusker/Screens/Main/MainTabBarViewController.swift @@ -10,6 +10,14 @@ import UIKit class MainTabBarViewController: UITabBarController, UITabBarControllerDelegate { + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + if UIDevice.current.userInterfaceIdiom == .phone { + return .portrait + } else { + return .all + } + } + override func viewDidLoad() { super.viewDidLoad() diff --git a/Tusker/Screens/Onboarding/InstanceSelectorTableViewController.swift b/Tusker/Screens/Onboarding/InstanceSelectorTableViewController.swift index 95635f01..4c55262a 100644 --- a/Tusker/Screens/Onboarding/InstanceSelectorTableViewController.swift +++ b/Tusker/Screens/Onboarding/InstanceSelectorTableViewController.swift @@ -29,6 +29,14 @@ class InstanceSelectorTableViewController: UITableViewController { var urlHandler: AnyCancellable? var currentQuery: String? + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + if UIDevice.current.userInterfaceIdiom == .phone { + return .portrait + } else { + return .all + } + } + init() { super.init(style: .grouped)