2024-06-25 12:20:20 +00:00
|
|
|
// TODO: implement complex merging list of messages
|
2024-06-21 10:32:16 +00:00
|
|
|
extension ConversationState {
|
|
|
|
static func reducer(state: inout ConversationState, action: ConversationAction) {
|
|
|
|
switch action {
|
2024-06-21 10:42:50 +00:00
|
|
|
case .makeConversationActive(let chat):
|
|
|
|
state.currentChat = chat
|
2024-06-21 10:32:16 +00:00
|
|
|
|
2024-06-24 13:28:26 +00:00
|
|
|
case .messageForCurrentConversationReceived(let message):
|
|
|
|
state.currentMessages.append(message)
|
|
|
|
|
2024-06-21 10:32:16 +00:00
|
|
|
default:
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|