Skip to content

Commit 03bf4d4

Browse files
committed
wip
1 parent 27e67ac commit 03bf4d4

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

Shared/Coordinators/Navigation/Router.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ struct Router: DynamicProperty {
7777
in: namespace
7878
)
7979
}
80+
81+
func root(
82+
_ root: RootItem
83+
) {
84+
router.root(root)
85+
}
8086
}
8187

8288
// `.dismiss` causes changes on disappear

Shared/Coordinators/Root/RootItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SwiftUI
1111
@MainActor
1212
struct RootItem: Identifiable {
1313

14-
var id: String
14+
let id: String
1515
let content: AnyView
1616

1717
init(

Swiftfin/App/AppDelegate.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ class AppDelegate: NSObject, UIApplicationDelegate {
1919
}
2020

2121
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
22-
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene,
23-
let topViewController = scene.keyWindow?.rootViewController,
24-
let presentedViewController = topViewController.presentedViewController,
22+
23+
guard UIDevice.isPhone else {
24+
return .allButUpsideDown
25+
}
26+
27+
if let presentedViewController = window?.rootViewController?.presentedViewController,
2528
let preferencesHostingController = presentedViewController as? UIPreferencesHostingController
2629
{
2730
return preferencesHostingController.supportedInterfaceOrientations
2831
}
2932

30-
return UIDevice.isPad ? .allButUpsideDown : .portrait
33+
return .portrait
3134
}
3235
}

Swiftfin/App/SwiftfinApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct SwiftfinApp: App {
8181
OverlayToastView {
8282
PreferencesView {
8383
RootView()
84-
.supportedOrientations(UIDevice.isPad ? .allButUpsideDown : .portrait)
84+
.supportedOrientations(.portrait)
8585
}
8686
}
8787
.ignoresSafeArea()

Swiftfin/Views/ServerCheckView.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import SwiftUI
1010

1111
struct ServerCheckView: View {
1212

13-
@EnvironmentObject
14-
private var rootCoordinator: RootCoordinator
15-
1613
@Router
1714
private var router
1815

@@ -44,7 +41,7 @@ struct ServerCheckView: View {
4441
.onReceive(viewModel.events) { event in
4542
switch event {
4643
case .connected:
47-
rootCoordinator.root(.mainTab)
44+
router.root(.mainTab)
4845
}
4946
}
5047
.topBarTrailing {

0 commit comments

Comments
 (0)