35 lines
979 B
Swift
35 lines
979 B
Swift
import SwiftUI
|
|
import LabWiseKit
|
|
import UIKit
|
|
|
|
// Controls which orientations are allowed app-wide at runtime.
|
|
// SpreadsheetView flips this to .landscape; all other screens use .allButUpsideDown.
|
|
final class AppDelegate: NSObject, UIApplicationDelegate {
|
|
static var orientationLock: UIInterfaceOrientationMask = .allButUpsideDown
|
|
|
|
func application(
|
|
_ application: UIApplication,
|
|
supportedInterfaceOrientationsFor window: UIWindow?
|
|
) -> UIInterfaceOrientationMask {
|
|
AppDelegate.orientationLock
|
|
}
|
|
}
|
|
|
|
@main
|
|
struct LabWiseApp: App {
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
|
|
@State private var appState = AppState.shared
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
if appState.isAuthenticated {
|
|
DashboardView()
|
|
.environment(appState)
|
|
} else {
|
|
LoginView()
|
|
.environment(appState)
|
|
}
|
|
}
|
|
}
|
|
}
|