32 lines
748 B
Swift
32 lines
748 B
Swift
|
|
import SwiftUI
|
||
|
|
|
||
|
|
@main
|
||
|
|
struct NASBackupApp: App {
|
||
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
|
||
|
|
|
||
|
|
@StateObject private var store = ConnectionStore.shared
|
||
|
|
@StateObject private var engine = BackupEngine.shared
|
||
|
|
@StateObject private var lanMonitor = LANMonitor.shared
|
||
|
|
|
||
|
|
var body: some Scene {
|
||
|
|
WindowGroup {
|
||
|
|
RootView()
|
||
|
|
.environmentObject(store)
|
||
|
|
.environmentObject(engine)
|
||
|
|
.environmentObject(lanMonitor)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
struct RootView: View {
|
||
|
|
@EnvironmentObject var store: ConnectionStore
|
||
|
|
|
||
|
|
var body: some View {
|
||
|
|
if store.savedConnection != nil {
|
||
|
|
LoginView()
|
||
|
|
} else {
|
||
|
|
ConnectView()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|