initial commit: Proximity iOS app proposal, full Swift code scaffold, reference backend, testing docs, generated Xcode project
This commit is contained in:
41
Proximity/App/ProximityApp.swift
Normal file
41
Proximity/App/ProximityApp.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user