2024-06-19 15:15:27 +00:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
enum AppFlow: Codable {
|
|
|
|
case start
|
|
|
|
case accounts
|
|
|
|
case chats
|
|
|
|
case contacts
|
|
|
|
case settings
|
2024-06-21 10:42:50 +00:00
|
|
|
case conversation
|
2024-08-07 08:36:33 +00:00
|
|
|
case createConversation
|
2024-06-19 15:15:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct AppState: Stateable {
|
|
|
|
var appVersion: String
|
|
|
|
var previousFlow: AppFlow
|
|
|
|
var currentFlow: AppFlow
|
|
|
|
|
|
|
|
var startState: StartState
|
|
|
|
var accountsState: AccountsState
|
|
|
|
var rostersState: RostersState
|
|
|
|
var chatsState: ChatsState
|
2024-06-21 10:32:16 +00:00
|
|
|
var conversationsState: ConversationState
|
2024-07-10 14:13:47 +00:00
|
|
|
var sharingState: SharingState
|
2024-06-19 15:15:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: Init
|
|
|
|
extension AppState {
|
|
|
|
init() {
|
|
|
|
appVersion = Const.appVersion
|
|
|
|
previousFlow = .start
|
|
|
|
currentFlow = .start
|
|
|
|
|
|
|
|
startState = StartState()
|
|
|
|
accountsState = AccountsState()
|
|
|
|
rostersState = RostersState()
|
|
|
|
chatsState = ChatsState()
|
2024-06-21 10:32:16 +00:00
|
|
|
conversationsState = ConversationState()
|
2024-07-10 14:13:47 +00:00
|
|
|
sharingState = SharingState()
|
2024-06-19 15:15:27 +00:00
|
|
|
}
|
|
|
|
}
|