Timeline: small on fixes on new implementation

This commit is contained in:
ganfra 2021-09-08 15:33:40 +02:00
parent 9238037067
commit 4f145e365e
2 changed files with 8 additions and 4 deletions

View file

@ -109,7 +109,6 @@ class DefaultTimeline internal constructor(private val roomId: String,
ensureReadReceiptAreLoaded(realm)
backgroundRealm.set(realm)
openAround(initialEventId)
strategy.onStart()
}
}
}

View file

@ -58,6 +58,7 @@ import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlRetriever
import im.vector.app.features.media.ImageContentRenderer
import im.vector.app.features.media.VideoContentRenderer
import im.vector.app.features.settings.VectorPreferences
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.toModel
@ -355,7 +356,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
timelineEventVisibilityHelper.shouldShowEvent(it, partialState.highlightedEventId)
}
// Should be build if not cached or if model should be refreshed
if (modelCache[position] == null || modelCache[position]?.isCacheable == false) {
if (modelCache[position] == null || modelCache[position]?.isCacheable(partialState).orFalse()) {
val timelineEventsGroup = timelineEventsGroups.getOrNull(event)
val params = TimelineItemFactoryParams(
event = event,
@ -537,6 +538,10 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
val eventModel: EpoxyModel<*>? = null,
val mergedHeaderModel: BasedMergedItem<*>? = null,
val formattedDayModel: DaySeparatorItem? = null,
val isCacheable: Boolean = true
)
private val isCacheable: Boolean = true
) {
fun isCacheable(partialState: PartialState): Boolean {
return isCacheable || partialState.highlightedEventId == eventId
}
}
}