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 {
monarchy
.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 prevToken: String?
@ -149,7 +149,7 @@ internal class TokenChunkEventPersistor @Inject constructor(@SessionDatabase pri
}
?: ChunkEntity.create(realm, prevToken, nextToken)
if (receivedChunk.events.isEmpty() && !receivedChunk.hasMore()) {
if (receivedChunk.events.isNullOrEmpty() && !receivedChunk.hasMore()) {
handleReachEnd(realm, roomId, direction, currentChunk)
} else {
handlePagination(realm, roomId, direction, receivedChunk, currentChunk)
@ -189,7 +189,7 @@ internal class TokenChunkEventPersistor @Inject constructor(@SessionDatabase pri
receivedChunk: TokenChunkEvent,
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 eventList = receivedChunk.events
val stateEvents = receivedChunk.stateEvents

View File

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