Timeline: remove previous lastForward chunk
This commit is contained in:
parent
ce5ccd4dab
commit
52d0da7053
|
@ -344,15 +344,17 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||||
syncLocalTimestampMillis: Long,
|
syncLocalTimestampMillis: Long,
|
||||||
aggregator: SyncResponsePostTreatmentAggregator): ChunkEntity {
|
aggregator: SyncResponsePostTreatmentAggregator): ChunkEntity {
|
||||||
val lastChunk = ChunkEntity.findLastForwardChunkOfRoom(realm, roomEntity.roomId)
|
val lastChunk = ChunkEntity.findLastForwardChunkOfRoom(realm, roomEntity.roomId)
|
||||||
|
if (isLimited && lastChunk != null) {
|
||||||
|
lastChunk.deleteOnCascade(deleteStateEvents = true, canDeleteRoot = true)
|
||||||
|
}
|
||||||
val chunkEntity = if (!isLimited && lastChunk != null) {
|
val chunkEntity = if (!isLimited && lastChunk != null) {
|
||||||
lastChunk
|
lastChunk
|
||||||
} else {
|
} else {
|
||||||
realm.createObject<ChunkEntity>().apply { this.prevToken = prevToken }
|
realm.createObject<ChunkEntity>().apply {
|
||||||
|
this.prevToken = prevToken
|
||||||
|
this.isLastForward = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Only one chunk has isLastForward set to true
|
|
||||||
lastChunk?.isLastForward = false
|
|
||||||
chunkEntity.isLastForward = true
|
|
||||||
|
|
||||||
val eventIds = ArrayList<String>(eventList.size)
|
val eventIds = ArrayList<String>(eventList.size)
|
||||||
val roomMemberContentsByUser = HashMap<String, RoomMemberContent?>()
|
val roomMemberContentsByUser = HashMap<String, RoomMemberContent?>()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue