mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Hook up the RoomThreadList to the RoomFlowCoordinator state machine and presenting threads.
This commit is contained in:
committed by
Stefan Ceriu
parent
212cd42161
commit
a358cacf31
@@ -394,6 +394,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
case (.room, .presentPinnedEventsTimeline, .pinnedEventsTimeline):
|
||||
startPinnedEventsTimelineFlow()
|
||||
|
||||
// Thread List
|
||||
|
||||
case (.room, .presentThreadList, .threadList):
|
||||
Task { await self.presentThreadList(animated: animated) }
|
||||
|
||||
// Thread
|
||||
|
||||
case (_, .presentThread(let threadRootEventID, let focusEventID), .thread):
|
||||
@@ -721,9 +726,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
case .presentKnockRequestsList:
|
||||
stateMachine.tryEvent(.presentKnockRequestsListScreen)
|
||||
case .presentThreadList:
|
||||
Task {
|
||||
await self.presentThreadList(animated: true)
|
||||
}
|
||||
stateMachine.tryEvent(.presentThreadList, userInfo: EventUserInfo(animated: animated))
|
||||
case .presentThread(let threadRootEventID, let focussedEventID):
|
||||
stateMachine.tryEvent(.presentThread(threadRootEventID: threadRootEventID, focusEventID: focussedEventID))
|
||||
case .presentRoom(let roomID, let via):
|
||||
@@ -738,12 +741,21 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
|
||||
private func presentThreadList(animated: Bool) async {
|
||||
let coordinator = await RoomThreadListScreenCoordinator(parameters: .init(threadListServiceProxy: roomProxy.threadListService(),
|
||||
mediaProvider: userSession.mediaProvider))
|
||||
let coordinator = RoomThreadListScreenCoordinator(parameters: .init(threadListServiceProxy: roomProxy.threadListService(),
|
||||
mediaProvider: userSession.mediaProvider))
|
||||
|
||||
coordinator.actionsPublisher.sink { [weak self] _ in }.store(in: &cancellables)
|
||||
coordinator.actionsPublisher.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .presentThread(let threadRootEventID):
|
||||
stateMachine.tryEvent(.presentThread(threadRootEventID: threadRootEventID, focusEventID: nil))
|
||||
}
|
||||
}.store(in: &cancellables)
|
||||
|
||||
navigationStackCoordinator.push(coordinator, animated: animated) { [weak self] in }
|
||||
navigationStackCoordinator.push(coordinator, animated: animated) { [weak self] in
|
||||
guard let self else { return }
|
||||
stateMachine.tryEvent(.dismissThreadList)
|
||||
}
|
||||
}
|
||||
|
||||
private func presentThread(threadRootEventID: String, focusEventID: String?, animated: Bool) async {
|
||||
|
||||
@@ -59,6 +59,7 @@ extension RoomFlowCoordinator {
|
||||
case initial
|
||||
case joinRoomScreen
|
||||
case room
|
||||
case threadList
|
||||
case thread(threadRootEventID: String, previousState: State)
|
||||
case roomDetails(isRoot: Bool)
|
||||
case roomDetailsEditScreen
|
||||
@@ -113,6 +114,9 @@ extension RoomFlowCoordinator {
|
||||
|
||||
case presentThread(threadRootEventID: String, focusEventID: String?)
|
||||
case dismissThread
|
||||
|
||||
case presentThreadList
|
||||
case dismissThreadList
|
||||
|
||||
case startSpaceFlow
|
||||
case finishedSpaceFlow
|
||||
@@ -236,6 +240,14 @@ extension RoomFlowCoordinator {
|
||||
case (.pinnedEventsTimeline(let previousState), .dismissPinnedEventsTimeline):
|
||||
return previousState
|
||||
|
||||
// Thread List
|
||||
case (.room, .presentThreadList):
|
||||
return .threadList
|
||||
case (.threadList, .dismissThreadList):
|
||||
return .room
|
||||
case (.threadList, .presentThread(let threadRootEventID, _)):
|
||||
return .thread(threadRootEventID: threadRootEventID, previousState: fromState)
|
||||
|
||||
// Thread
|
||||
case (.room, .presentThread(let threadRootEventID, _)):
|
||||
return .thread(threadRootEventID: threadRootEventID, previousState: fromState)
|
||||
|
||||
Reference in New Issue
Block a user