another.im-ios/ConversationsClassic/AppCore/Reducers/RostersReducer.swift
2024-06-19 17:15:27 +02:00

26 lines
711 B
Swift

extension RostersState {
static func reducer(state: inout RostersState, action: RostersAction) {
switch action {
case .addRosterDone(let jid):
state.newAddedRosterJid = jid
state.newAddedRosterError = nil
case .addRosterError(let reason):
state.newAddedRosterJid = nil
state.newAddedRosterError = reason
case .rostersListUpdated(let rosters):
state.rosters = rosters
case .markRosterAsLocallyDeleted, .deleteRoster:
state.deleteRosterError = nil
case .rosterDeletingFailed(let reson):
state.deleteRosterError = reson
default:
break
}
}
}