Add a Messages tab to global search

Split global search into Rooms and Messages tabs. The Messages tab lists
matching events with the room's name and avatar, a sender-prefixed preview,
rich media (image/video/audio/file) previews, and a loading indicator, then
paginates as you scroll. Queries are debounced and the previous one is
superseded so late results can't clobber a newer search.
This commit is contained in:
Stefan Ceriu
2026-07-02 13:25:56 +03:00
parent 5851100f07
commit 4fbfc87551
13 changed files with 727 additions and 81 deletions
@@ -10,11 +10,13 @@ import SwiftUI
struct SearchScreenCoordinatorParameters {
let roomSummaryProvider: RoomSummaryProviderProtocol
let searchService: SearchServiceProxyProtocol
let clientProxy: ClientProxyProtocol
let mediaProvider: MediaProviderProtocol
}
enum SearchScreenCoordinatorAction {
case presentRoom(roomID: String)
case presentRoom(roomID: String, eventID: String?)
case cancel
}
@@ -30,6 +32,8 @@ final class SearchScreenCoordinator: CoordinatorProtocol {
init(parameters: SearchScreenCoordinatorParameters) {
viewModel = SearchScreenViewModel(roomSummaryProvider: parameters.roomSummaryProvider,
searchService: parameters.searchService,
clientProxy: parameters.clientProxy,
mediaProvider: parameters.mediaProvider)
}
@@ -37,8 +41,8 @@ final class SearchScreenCoordinator: CoordinatorProtocol {
viewModel.actionsPublisher.sink { [weak self] action in
guard let self else { return }
switch action {
case .presentRoom(let roomID):
actionsSubject.send(.presentRoom(roomID: roomID))
case .presentRoom(let roomID, let eventID):
actionsSubject.send(.presentRoom(roomID: roomID, eventID: eventID))
case .cancel:
actionsSubject.send(.cancel)
}