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

17 lines
463 B
Swift

import Combine
final class ChatsMiddleware {
static let shared = ChatsMiddleware()
func middleware(state _: AppState, action: AppAction) -> AnyPublisher<AppAction, Never> {
switch action {
case .databaseAction(.storedChatsLoaded(let chats)):
return Just(.chatsAction(.chatsListUpdated(chats: chats)))
.eraseToAnyPublisher()
default:
return Empty().eraseToAnyPublisher()
}
}
}