import SwiftUI @main struct ProximityApp: App { @StateObject private var appState = AppState() var body: some Scene { WindowGroup { RootView() .environmentObject(appState) .environmentObject(appState.presenceViewModel) .environmentObject(appState.authService) .environmentObject(appState.profileImportService) .environmentObject(appState.revealFlow) .environmentObject(appState.chatViewModel) .environmentObject(appState.realtime) } } } /// Routes between the sign-in flow and the main app based on auth state. struct RootView: View { @EnvironmentObject private var appState: AppState @EnvironmentObject private var authService: AuthService var body: some View { Group { switch authService.state { case .signedOut: SignInView() case .authenticating: ProgressView("Signing in…") case .authenticated: ContentView() } } .task { await authService.restoreSession() } } }