Timeline: dispatch update on a background thread

This commit is contained in:
ganfra 2021-10-08 12:55:37 +02:00
parent 3bdf264a53
commit c66d6aab5c

View file

@ -244,7 +244,8 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
interceptorHelper.intercept(models, partialState.unreadState, timeline, callback) interceptorHelper.intercept(models, partialState.unreadState, timeline, callback)
} }
fun update(viewState: RoomDetailViewState) = synchronized(modelCache) { fun update(viewState: RoomDetailViewState) = backgroundHandler.post {
synchronized(modelCache) {
val newPartialState = PartialState(viewState) val newPartialState = PartialState(viewState)
if (partialState.highlightedEventId != newPartialState.highlightedEventId) { if (partialState.highlightedEventId != newPartialState.highlightedEventId) {
// Clear cache to force a refresh // Clear cache to force a refresh
@ -260,6 +261,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
requestModelBuild() requestModelBuild()
} }
} }
}
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
super.onAttachedToRecyclerView(recyclerView) super.onAttachedToRecyclerView(recyclerView)