mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 19:10:49 +02:00
Only display unencrypted rooms which we can use with the chat view.
This commit is contained in:
+8
-9
@@ -38,22 +38,21 @@ class TemplateRoomListViewModel: TemplateRoomListViewModelType, TemplateRoomList
|
||||
|
||||
init(templateRoomListService: TemplateRoomListServiceProtocol) {
|
||||
self.templateRoomListService = templateRoomListService
|
||||
|
||||
super.init(initialViewState: Self.defaultState(templateRoomListService: templateRoomListService))
|
||||
|
||||
templateRoomListService.roomsSubject
|
||||
.map(TemplateRoomListStateAction.updateRooms)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink(receiveValue: { [weak self] action in
|
||||
self?.dispatch(action:action)
|
||||
})
|
||||
.store(in: &cancellables)
|
||||
startObservingRooms()
|
||||
}
|
||||
|
||||
private static func defaultState(templateRoomListService: TemplateRoomListServiceProtocol) -> TemplateRoomListViewState {
|
||||
return TemplateRoomListViewState(rooms: templateRoomListService.roomsSubject.value)
|
||||
}
|
||||
|
||||
private func startObservingRooms() {
|
||||
let roomsUpdatePublisher = templateRoomListService.roomsSubject
|
||||
.map(TemplateRoomListStateAction.updateRooms)
|
||||
.eraseToAnyPublisher()
|
||||
dispatch(actionPublisher: roomsUpdatePublisher)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
override func process(viewAction: TemplateRoomListViewAction) {
|
||||
|
||||
Reference in New Issue
Block a user