27 lines
646 B
Swift
27 lines
646 B
Swift
//
|
|
// RootView.swift
|
|
// Snail
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
/// Показывает вход или основной интерфейс в зависимости от состояния сессии.
|
|
struct RootView: View {
|
|
@Environment(AuthStore.self) private var auth
|
|
|
|
var body: some View {
|
|
Group {
|
|
switch auth.state {
|
|
case .loading:
|
|
ProgressView()
|
|
case .signedOut:
|
|
SignInView()
|
|
case .signedIn:
|
|
ProjectListView()
|
|
}
|
|
}
|
|
.animation(.default, value: auth.state)
|
|
.task { await auth.restoreSession() }
|
|
}
|
|
}
|