conversations-classic-ios/ConversationsClassic/View/StartScreen.swift
2024-08-11 13:09:29 +02:00

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
}
}
}
}
}