another.im-ios/old/AppCore/Reducers/AccountsReducer.swift

26 lines
841 B
Swift
Raw Normal View History

2024-06-19 15:15:27 +00:00
extension AccountsState {
static func reducer(state: inout AccountsState, action: AccountsAction) {
switch action {
case .accountsListUpdated(let accounts):
state.accounts = accounts
case .goTo(let navigation):
state.navigation = navigation
case .tryAddAccountWithCredentials(let login, let password):
let account = Account(bareJid: login, pass: password, isActive: true, isTemp: true)
state.accounts.append(account)
case .addAccountError(let jid, let reason):
state.accounts = state.accounts.filter { $0.bareJid != jid }
state.addAccountError = reason
2024-07-22 12:02:33 +00:00
case .clientServerFeaturesUpdated(let jid, let features):
state.discoFeatures[jid] = features
2024-06-19 15:15:27 +00:00
default:
break
}
}
}