Fix incorrect expectations on TimelineController availability when processing room presentations.

This commit is contained in:
Stefan Ceriu
2025-07-22 15:32:59 +03:00
committed by Stefan Ceriu
parent fb40bfd690
commit 60b8b04142
@@ -281,13 +281,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
// Room // Room
case (_, .presentRoom(let presentationAction), .room): case (_, .presentRoom(let presentationAction), .room):
guard let timelineController = (context.userInfo as? EventUserInfo)?.timelineController else {
fatalError()
}
Task { Task {
await self.presentRoom(fromState: context.fromState, await self.presentRoom(fromState: context.fromState,
presentationAction: presentationAction, presentationAction: presentationAction,
timelineController: timelineController,
animated: animated) animated: animated)
} }
case (_, .dismissFlow, .complete): case (_, .dismissFlow, .complete):
@@ -433,11 +429,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
/// - Parameters: /// - Parameters:
/// - fromState: The state that asked for the room presentation. /// - fromState: The state that asked for the room presentation.
/// - presentationAction: The action that should happen after the room is presented /// - presentationAction: The action that should happen after the room is presented
/// - timelineController: This room's main timeline controller
/// - animated: whether it should animate the transition /// - animated: whether it should animate the transition
private func presentRoom(fromState: State, private func presentRoom(fromState: State,
presentationAction: PresentationAction?, presentationAction: PresentationAction?,
timelineController: TimelineControllerProtocol,
animated: Bool) async { animated: Bool) async {
// If any sheets are presented dismiss them, rely on their dismissal callbacks to transition the state machine // If any sheets are presented dismiss them, rely on their dismissal callbacks to transition the state machine
// through the correct states before presenting the room // through the correct states before presenting the room
@@ -941,13 +935,13 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
animated: Bool) { animated: Bool) {
let stackCoordinator = NavigationStackCoordinator() let stackCoordinator = NavigationStackCoordinator()
let parameters = MediaUploadPreviewScreenCoordinatorParameters(roomProxy: roomProxy, let parameters = MediaUploadPreviewScreenCoordinatorParameters(timelineController: timelineController,
timelineController: timelineController,
userIndicatorController: userIndicatorController, userIndicatorController: userIndicatorController,
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: appSettings), mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: appSettings),
title: url.lastPathComponent, title: url.lastPathComponent,
url: url, url: url,
shouldShowCaptionWarning: appSettings.shouldShowMediaCaptionWarning) shouldShowCaptionWarning: appSettings.shouldShowMediaCaptionWarning,
isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted)
let mediaUploadPreviewScreenCoordinator = MediaUploadPreviewScreenCoordinator(parameters: parameters) let mediaUploadPreviewScreenCoordinator = MediaUploadPreviewScreenCoordinator(parameters: parameters)