Add a new RoomThreadListScreen and hook it up to the RoomThreadListService

It will automatically paginate to fill the screen and update the list as updates come in.
This commit is contained in:
Stefan Ceriu
2026-03-23 17:55:50 +02:00
committed by Stefan Ceriu
parent e97ed6ec5c
commit e7e1e990db
16 changed files with 413 additions and 8 deletions
@@ -47,6 +47,7 @@ enum RoomScreenCoordinatorAction {
case presentPinnedEventsTimeline
case presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy)
case presentKnockRequestsList
case presentThreadList
case presentThread(threadRootEventID: String, focussedEventID: String?)
case presentRoom(roomID: String, via: [String])
}
@@ -187,6 +188,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
actionsSubject.send(.presentRoom(roomID: roomID, via: via))
case .displayMessageForwarding(let forwardingItem):
actionsSubject.send(.presentMessageForwarding(forwardingItem: forwardingItem))
case .displayThreadList:
actionsSubject.send(.presentThreadList)
case .displayThread(let threadRootEventID, let focussedEventID):
actionsSubject.send(.presentThread(threadRootEventID: threadRootEventID, focussedEventID: focussedEventID))
}
@@ -12,6 +12,7 @@ import OrderedCollections
enum RoomScreenViewModelAction: Equatable {
case focusEvent(eventID: String)
case displayThreadList
case displayThread(threadRootEventID: String, focussedEventID: String)
case displayPinnedEventsTimeline
case displayRoomDetails
@@ -32,6 +33,7 @@ enum RoomScreenViewAction {
case dismissKnockRequests
case viewKnockRequests
case displaySuccessorRoom
case displayThreadList
}
struct RoomScreenViewState: BindableState {
@@ -119,6 +119,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
guard let successorID = roomProxy.infoPublisher.value.successor?.roomId else { return }
let serverNames = roomProxy.knownServerNames(maxCount: 50) // Limit to the same number used by ClientProxy.resolveRoomAlias(_:)
actionsSubject.send(.displayRoom(roomID: successorID, via: Array(serverNames)))
case .displayThreadList:
actionsSubject.send(.displayThreadList)
}
}
@@ -179,6 +179,17 @@ struct RoomScreen: View {
}
}
}
if #available(iOS 26, *) {
ToolbarSpacer(.fixed, placement: .primaryAction)
}
ToolbarItem(placement: .primaryAction) {
Button {
context.send(viewAction: .displayThreadList)
} label: {
CompoundIcon(\.threads)
}
}
}
@ViewBuilder