ios_client
This commit is contained in:
47
ios_client 0.8.5/Kecalek/KecalekApp.swift
Normal file
47
ios_client 0.8.5/Kecalek/KecalekApp.swift
Normal file
@@ -0,0 +1,47 @@
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct KecalekApp: App {
|
||||
@State private var appState = AppState()
|
||||
@State private var authViewModel = AuthViewModel()
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
if appState.isLoggedIn {
|
||||
MainTabView(appState: appState)
|
||||
} else {
|
||||
LoginView(viewModel: authViewModel, appState: appState)
|
||||
}
|
||||
}
|
||||
.onChange(of: scenePhase) { _, newPhase in
|
||||
switch newPhase {
|
||||
case .background:
|
||||
appState.handleEnteredBackground()
|
||||
case .active:
|
||||
appState.handleBecameActive()
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainTabView: View {
|
||||
var appState: AppState
|
||||
@State private var convListVM = ConversationListVM()
|
||||
|
||||
var body: some View {
|
||||
TabView {
|
||||
ConversationListView(appState: appState, viewModel: convListVM)
|
||||
.tabItem {
|
||||
Label("Chats", systemImage: "bubble.left.and.bubble.right.fill")
|
||||
}
|
||||
|
||||
ProfileView(appState: appState, isOwnProfile: true)
|
||||
.tabItem {
|
||||
Label("Profile", systemImage: "person.fill")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user