Fix permalink crash. (#2777)

This commit is contained in:
Doug
2024-05-03 14:58:06 +01:00
committed by GitHub
parent 8734f94df0
commit e9d690450e
@@ -190,10 +190,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
case .focusLive:
focusLive()
case .scrolledToFocussedItem:
Task { // Use a Task to mutate view state after the current view update.
state.timelineViewState.focussedEvent?.appearance = .hasAppeared
hideFocusLoadingIndicator()
}
// Use a Task to mutate view state after the current view update.
Task { didScrollToFocussedItem() }
case .hasSwitchedTimeline:
Task { state.timelineViewState.isSwitchingTimelines = false }
}
@@ -258,6 +256,14 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
timelineController.focusLive()
}
private func didScrollToFocussedItem() {
if var focussedEvent = state.timelineViewState.focussedEvent {
focussedEvent.appearance = .hasAppeared
state.timelineViewState.focussedEvent = focussedEvent
hideFocusLoadingIndicator()
}
}
private func attach(_ attachment: ComposerAttachmentType) {
switch attachment {
case .camera: