Permalink Tweaks (#2768)

* Revert back to creating a new flow when re-selecting the same room.

Fix the composer bug by adding IDs to the all of the module AnyViews.

* Don't show the live timeline when starting with a focussed event.
This commit is contained in:
Doug
2024-04-30 17:25:32 +01:00
committed by GitHub
parent 7c94ed98a5
commit f688d2eda4
15 changed files with 203 additions and 35 deletions
@@ -47,6 +47,11 @@ enum RoomFlowCoordinatorEntryPoint: Hashable {
case eventID(String)
/// The flow will start by showing the room's details.
case roomDetails
var isEventID: Bool {
guard case .eventID = self else { return false }
return true
}
}
// swiftlint:disable:next type_body_length
@@ -508,7 +513,14 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case .initial, .roomDetails(isRoot: true), .joinRoomScreen:
break
default:
return // The room is already on the stack, no need to present it again
// The room is already on the stack, no need to present it again
// Check if we need to focus on an event
if let focussedEventID {
roomScreenCoordinator?.focusOnEvent(eventID: focussedEventID)
}
return
}
}
@@ -524,6 +536,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID))
let timelineController = roomTimelineControllerFactory.buildRoomTimelineController(roomProxy: roomProxy,
initialFocussedEventID: focussedEventID,
timelineItemFactory: timelineItemFactory)
self.timelineController = timelineController
@@ -1012,6 +1025,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID))
let roomTimelineController = roomTimelineControllerFactory.buildRoomTimelineController(roomProxy: roomProxy,
initialFocussedEventID: nil,
timelineItemFactory: timelineItemFactory)
let parameters = RoomPollsHistoryScreenCoordinatorParameters(roomProxy: roomProxy,
@@ -272,15 +272,15 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
presentHomeScreen()
attemptStartingOnboarding()
case(.roomList(let selectedRoomID), .selectRoom(let roomID, let entryPoint), .roomList):
if selectedRoomID == roomID {
if let roomFlowCoordinator {
let route: AppRoute = switch entryPoint {
case .room: .room(roomID: roomID)
case .eventID(let eventID): .event(roomID: roomID, eventID: eventID)
case .roomDetails: .roomDetails(roomID: roomID)
}
roomFlowCoordinator.handleAppRoute(route, animated: animated)
if selectedRoomID == roomID,
!entryPoint.isEventID, // Don't reuse the existing room so the live timeline is hidden while the detached timeline is loading.
let roomFlowCoordinator {
let route: AppRoute = switch entryPoint {
case .room: .room(roomID: roomID)
case .roomDetails: .roomDetails(roomID: roomID)
case .eventID(let eventID): .event(roomID: roomID, eventID: eventID) // ignored.
}
roomFlowCoordinator.handleAppRoute(route, animated: animated)
} else {
Task { await self.startRoomFlow(roomID: roomID, entryPoint: entryPoint, animated: animated) }
}