Fix Dendrite sync response support

This commit is contained in:
Valere 2021-01-13 14:23:02 +01:00
parent b7a89f4055
commit 57f17620b5
2 changed files with 4 additions and 4 deletions

View File

@ -124,7 +124,7 @@ internal class TokenChunkEventPersistor @Inject constructor(@SessionDatabase pri
direction: PaginationDirection): Result { direction: PaginationDirection): Result {
monarchy monarchy
.awaitTransaction { realm -> .awaitTransaction { realm ->
Timber.v("Start persisting ${receivedChunk.events.size} events in $roomId towards $direction") Timber.v("Start persisting ${receivedChunk.events?.size} events in $roomId towards $direction")
val nextToken: String? val nextToken: String?
val prevToken: String? val prevToken: String?
@ -149,7 +149,7 @@ internal class TokenChunkEventPersistor @Inject constructor(@SessionDatabase pri
} }
?: ChunkEntity.create(realm, prevToken, nextToken) ?: ChunkEntity.create(realm, prevToken, nextToken)
if (receivedChunk.events.isEmpty() && !receivedChunk.hasMore()) { if (receivedChunk.events.isNullOrEmpty() && !receivedChunk.hasMore()) {
handleReachEnd(realm, roomId, direction, currentChunk) handleReachEnd(realm, roomId, direction, currentChunk)
} else { } else {
handlePagination(realm, roomId, direction, receivedChunk, currentChunk) handlePagination(realm, roomId, direction, receivedChunk, currentChunk)
@ -189,7 +189,7 @@ internal class TokenChunkEventPersistor @Inject constructor(@SessionDatabase pri
receivedChunk: TokenChunkEvent, receivedChunk: TokenChunkEvent,
currentChunk: ChunkEntity currentChunk: ChunkEntity
) { ) {
Timber.v("Add ${receivedChunk.events.size} events in chunk(${currentChunk.nextToken} | ${currentChunk.prevToken}") Timber.v("Add ${receivedChunk.events?.size} events in chunk(${currentChunk.nextToken} | ${currentChunk.prevToken}")
val roomMemberContentsByUser = HashMap<String, RoomMemberContent?>() val roomMemberContentsByUser = HashMap<String, RoomMemberContent?>()
val eventList = receivedChunk.events val eventList = receivedChunk.events
val stateEvents = receivedChunk.stateEvents val stateEvents = receivedChunk.stateEvents

View File

@ -94,7 +94,7 @@ internal class DefaultGetUploadsTask @Inject constructor(
nextToken = chunk.end ?: "", nextToken = chunk.end ?: "",
hasMore = chunk.hasMore() hasMore = chunk.hasMore()
) )
events = chunk.events events = chunk.events ?: emptyList()
} }
var uploadEvents = listOf<UploadEvent>() var uploadEvents = listOf<UploadEvent>()