@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
swift 20 lines 934 Bytes
Raw
1 import ExpoModulesCore
2 import UIKit
3
4 public final class T3WorkspaceOrientationSubscriber: ExpoAppDelegateSubscriber {
5 private static let hingeWindows = NSHashTable<UIWindow>.weakObjects()
6
7 static func allowHingeOrientations(in window: UIWindow) {
8 guard !hingeWindows.contains(window) else { return }
9 hingeWindows.add(window)
10 window.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
11 }
12
13 public func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
14 if UIDevice.current.userInterfaceIdiom == .pad {
15 let orientations = Bundle.main.object(forInfoDictionaryKey: "UISupportedInterfaceOrientations~ipad") as? [String] ?? []
16 return orientations == ["UIInterfaceOrientationPortrait"] ? .portrait : .all
17 }
18 return window.map { Self.hingeWindows.contains($0) } == true ? .allButUpsideDown : .portrait
19 }
20 }