conversations-classic-ios/ConversationsClassic/AppCore/Reducers/AppReducer.swift
2024-07-23 11:58:26 +02:00

36 lines
1.2 KiB
Swift

import Foundation
extension AppState {
static func reducer(state: inout AppState, action: AppAction) {
switch action {
case .flushState:
state = AppState()
case .changeFlow(let flow):
state.previousFlow = state.currentFlow
state.currentFlow = flow
case .startAction(let action):
StartState.reducer(state: &state.startState, action: action)
case .databaseAction, .xmppAction, .fileAction, .info, .messagesAction:
break // this actions are processed by other middlewares
case .accountsAction(let action):
AccountsState.reducer(state: &state.accountsState, action: action)
case .rostersAction(let action):
RostersState.reducer(state: &state.rostersState, action: action)
case .chatsAction(let action):
ChatsState.reducer(state: &state.chatsState, action: action)
case .conversationAction(let action):
ConversationState.reducer(state: &state.conversationsState, action: action)
case .sharingAction(let action):
SharingState.reducer(state: &state.sharingState, action: action)
}
}
}