mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Use a static room summary provider to resolve room summaries through id and aliases (#3863)
* trying to debug why sometimes the value is missing even if it appears in the room list * static room provider implementation * set the page size through the init * removed reset filters on .cancel since using the sop function is safer
This commit is contained in:
@@ -51,4 +51,8 @@ class GlobalSearchScreenCoordinator: CoordinatorProtocol {
|
||||
func toPresentable() -> AnyView {
|
||||
AnyView(GlobalSearchScreen(context: viewModel.context))
|
||||
}
|
||||
|
||||
func stop() {
|
||||
viewModel.stop()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ class GlobalSearchScreenViewModel: GlobalSearchScreenViewModelType, GlobalSearch
|
||||
updateRooms(with: roomSummaryProvider.roomListPublisher.value)
|
||||
}
|
||||
|
||||
func stop() {
|
||||
// This is a shared provider so we should reset the filtering when we are done with the view
|
||||
roomSummaryProvider.setFilter(.all(filters: []))
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
override func process(viewAction: GlobalSearchScreenViewAction) {
|
||||
@@ -55,7 +60,6 @@ class GlobalSearchScreenViewModel: GlobalSearchScreenViewModelType, GlobalSearch
|
||||
switch viewAction {
|
||||
case .dismiss:
|
||||
actionsSubject.send(.dismiss)
|
||||
roomSummaryProvider.setFilter(.all(filters: [])) // This is a shared provider
|
||||
case .select(let roomID):
|
||||
actionsSubject.send(.select(roomID: roomID))
|
||||
case .reachedTop:
|
||||
|
||||
@@ -11,4 +11,6 @@ import Combine
|
||||
protocol GlobalSearchScreenViewModelProtocol {
|
||||
var actions: AnyPublisher<GlobalSearchScreenViewModelAction, Never> { get }
|
||||
var context: GlobalSearchScreenViewModelType.Context { get }
|
||||
|
||||
func stop()
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
||||
roomInfo = invitedRoomProxy.info
|
||||
case .knocked(let knockedRoomProxy):
|
||||
roomInfo = knockedRoomProxy.info
|
||||
if let roomSummaryProvider = clientProxy.alternateRoomSummaryProvider {
|
||||
if let roomSummaryProvider = clientProxy.staticRoomSummaryProvider {
|
||||
membershipStateChangeCancellable = roomSummaryProvider.roomListPublisher
|
||||
.compactMap { summaries -> Void? in
|
||||
guard let roomSummary = summaries.first(where: { $0.id == roomInfo?.id }),
|
||||
|
||||
+4
@@ -53,4 +53,8 @@ final class MessageForwardingScreenCoordinator: CoordinatorProtocol {
|
||||
func toPresentable() -> AnyView {
|
||||
AnyView(MessageForwardingScreen(context: viewModel.context))
|
||||
}
|
||||
|
||||
func stop() {
|
||||
viewModel.stop()
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -60,7 +60,6 @@ class MessageForwardingScreenViewModel: MessageForwardingScreenViewModelType, Me
|
||||
switch viewAction {
|
||||
case .cancel:
|
||||
actionsSubject.send(.dismiss)
|
||||
roomSummaryProvider.setFilter(.all(filters: []))
|
||||
case .send:
|
||||
Task { await forward() }
|
||||
case .selectRoom(let roomID):
|
||||
@@ -72,6 +71,11 @@ class MessageForwardingScreenViewModel: MessageForwardingScreenViewModelType, Me
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
// This is a shared provider so we should reset the filtering when we are done with the view
|
||||
roomSummaryProvider.setFilter(.all(filters: []))
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func updateRooms() {
|
||||
|
||||
+2
@@ -11,4 +11,6 @@ import Combine
|
||||
protocol MessageForwardingScreenViewModelProtocol {
|
||||
var actions: AnyPublisher<MessageForwardingScreenViewModelAction, Never> { get }
|
||||
var context: MessageForwardingScreenViewModelType.Context { get }
|
||||
|
||||
func stop()
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ final class RoomSelectionScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func stop() {
|
||||
viewModel.stop()
|
||||
}
|
||||
|
||||
func toPresentable() -> AnyView {
|
||||
AnyView(RoomSelectionScreen(context: viewModel.context))
|
||||
|
||||
@@ -54,7 +54,6 @@ class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelect
|
||||
switch viewAction {
|
||||
case .cancel:
|
||||
actionsSubject.send(.dismiss)
|
||||
roomSummaryProvider.setFilter(.all(filters: []))
|
||||
case .confirm:
|
||||
guard let selectedRoomID = state.selectedRoomID else {
|
||||
return
|
||||
@@ -70,6 +69,11 @@ class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelect
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
// This is a shared provider so we should reset the filtering when we are done with the view
|
||||
roomSummaryProvider.setFilter(.all(filters: []))
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func updateRooms() {
|
||||
|
||||
+2
@@ -11,4 +11,6 @@ import Combine
|
||||
protocol RoomSelectionScreenViewModelProtocol {
|
||||
var actionsPublisher: AnyPublisher<RoomSelectionScreenViewModelAction, Never> { get }
|
||||
var context: RoomSelectionScreenViewModelType.Context { get }
|
||||
|
||||
func stop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user