conversations-classic-ios/ConversationsClassic/View/StartScreen.swift

29 lines
821 B
Swift
Raw Normal View History

2024-08-11 00:28:01 +00:00
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
}
}
}
}
}