29 lines
821 B
Swift
29 lines
821 B
Swift
|
import SwiftUI
|
||
|
|
||
|
struct StartScreen: View {
|
||
|
@EnvironmentObject var clientsStore: ClientsStore
|
||
|
@EnvironmentObject var navigation: NavigationStore
|
||
|
|
||
|
var body: some View {
|
||
|
ZStack {
|
||
|
Color.Material.Background.light
|
||
|
Image.logo
|
||
|
.resizable()
|
||
|
.aspectRatio(contentMode: .fit)
|
||
|
.frame(width: 200, height: 200)
|
||
|
}
|
||
|
.ignoresSafeArea()
|
||
|
.onAppear {
|
||
|
clientsStore.startFetching()
|
||
|
}
|
||
|
.onChange(of: clientsStore.ready) { ready in
|
||
|
if ready {
|
||
|
let flow: NavigationStore.Flow = clientsStore.clients.isEmpty ? .entering(.welcome) : .main(.conversations)
|
||
|
withAnimation {
|
||
|
navigation.flow = flow
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|