another.im-ios/ConversationsClassic/AppCore/Middlewares/MessagesMiddleware.swift

18 lines
519 B
Swift
Raw Normal View History

2024-07-23 09:58:26 +00:00
import Combine
import Foundation
final class MessagesMiddleware {
static let shared = MessagesMiddleware()
func middleware(state _: AppState, action: AppAction) -> AnyPublisher<AppAction, Never> {
switch action {
case .messagesAction(.currentConversationMessagesUpdated(let messages)):
return Just(.conversationAction(.messagesUpdated(messages: messages)))
.eraseToAnyPublisher()
default:
return Empty().eraseToAnyPublisher()
}
}
}