mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 20:38:41 +00:00
Fixes #2805 - Fixes animation artifacts when focusing on in-reply-to messages
This commit is contained in:
committed by
Stefan Ceriu
parent
136ecb125c
commit
d8845303fd
@@ -193,8 +193,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
case .focusLive:
|
case .focusLive:
|
||||||
focusLive()
|
focusLive()
|
||||||
case .scrolledToFocussedItem:
|
case .scrolledToFocussedItem:
|
||||||
// Use a Task to mutate view state after the current view update.
|
didScrollToFocussedItem()
|
||||||
Task { didScrollToFocussedItem() }
|
|
||||||
case .hasSwitchedTimeline:
|
case .hasSwitchedTimeline:
|
||||||
Task { state.timelineViewState.isSwitchingTimelines = false }
|
Task { state.timelineViewState.isSwitchingTimelines = false }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,10 +340,13 @@ class TimelineTableViewController: UIViewController {
|
|||||||
|
|
||||||
/// Scrolls to the item with the corresponding event ID if loaded in the timeline.
|
/// Scrolls to the item with the corresponding event ID if loaded in the timeline.
|
||||||
private func scrollToItem(eventID: String, animated: Bool) {
|
private func scrollToItem(eventID: String, animated: Bool) {
|
||||||
if let kvPair = timelineItemsDictionary.first(where: { $0.value.identifier.eventID == eventID }),
|
DispatchQueue.main.async { [weak self] in // Fixes #2805
|
||||||
let indexPath = dataSource?.indexPath(for: kvPair.key) {
|
guard let self else { return }
|
||||||
tableView.scrollToRow(at: indexPath, at: .middle, animated: animated)
|
if let kvPair = timelineItemsDictionary.first(where: { $0.value.identifier.eventID == eventID }),
|
||||||
coordinator.send(viewAction: .scrolledToFocussedItem)
|
let indexPath = dataSource?.indexPath(for: kvPair.key) {
|
||||||
|
tableView.scrollToRow(at: indexPath, at: .middle, animated: animated)
|
||||||
|
coordinator.send(viewAction: .scrolledToFocussedItem)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user