From 9aa0d381162cf9b6d780e2f39b7302ac0e3abf9e Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 23 Jun 2020 09:25:25 +0200 Subject: [PATCH] Pagination do not set ageLocalTs --- .../session/room/timeline/TokenChunkEventPersistor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TokenChunkEventPersistor.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TokenChunkEventPersistor.kt index 1756c948b0..6d26aed601 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TokenChunkEventPersistor.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TokenChunkEventPersistor.kt @@ -207,13 +207,15 @@ internal class TokenChunkEventPersistor @Inject constructor(@SessionDatabase pri roomMemberContentsByUser[stateEvent.stateKey] = stateEvent.content.toModel() } } + val now = System.currentTimeMillis() val eventIds = ArrayList(eventList.size) for (event in eventList) { if (event.eventId == null || event.senderId == null) { continue } + val ageLocalTs = event.unsignedData?.age?.let { now - it } eventIds.add(event.eventId) - val eventEntity = event.toEntity(roomId, SendState.SYNCED).copyToRealmOrIgnore(realm) + val eventEntity = event.toEntity(roomId, SendState.SYNCED, ageLocalTs).copyToRealmOrIgnore(realm) if (event.type == EventType.STATE_ROOM_MEMBER && event.stateKey != null) { val contentToUse = if (direction == PaginationDirection.BACKWARDS) { event.prevContent