From 0910baab6c2fa694b314ad88244864364d90f42d Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Tue, 22 Nov 2022 16:19:18 -0500 Subject: [PATCH] Allow media viewer to be rotated to any orientation --- .../Scene/MediaPreview/MediaPreviewViewController.swift | 4 ++++ Mastodon/Scene/Root/MainTab/MainTabBarController.swift | 3 +++ Mastodon/Scene/Root/RootSplitViewController.swift | 4 ++++ Mastodon/Supporting Files/AppDelegate.swift | 7 ------- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift index dee6c00ea..a14a0dccf 100644 --- a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift +++ b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift @@ -165,6 +165,10 @@ extension MediaPreviewViewController { !viewModel.showingChrome } + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + .all + } + } extension MediaPreviewViewController { diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index 2e5d5ae58..70e1455c3 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -369,6 +369,9 @@ extension MainTabBarController { updateAvatarButtonAppearance() } + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return UIDevice.current.userInterfaceIdiom == .phone ? .portrait : .all + } } extension MainTabBarController { diff --git a/Mastodon/Scene/Root/RootSplitViewController.swift b/Mastodon/Scene/Root/RootSplitViewController.swift index 0b6f4f97a..5332140db 100644 --- a/Mastodon/Scene/Root/RootSplitViewController.swift +++ b/Mastodon/Scene/Root/RootSplitViewController.swift @@ -112,6 +112,10 @@ extension RootSplitViewController { self.updateBehavior(size: size) } + + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + return UIDevice.current.userInterfaceIdiom == .phone ? .portrait : .all + } override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) diff --git a/Mastodon/Supporting Files/AppDelegate.swift b/Mastodon/Supporting Files/AppDelegate.swift index 84b819a5c..85fed2b28 100644 --- a/Mastodon/Supporting Files/AppDelegate.swift +++ b/Mastodon/Supporting Files/AppDelegate.swift @@ -64,13 +64,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } extension AppDelegate { - func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { - return UIDevice.current.userInterfaceIdiom == .phone ? .portrait : .all - } -} - -extension AppDelegate { - func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { appContext.notificationService.deviceToken.value = deviceToken }