mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 14:38:45 +03:00
TokenChunkEventPersistor: always link all matching chunks
The previous fix only works around the issue when it is detected. This may require re-entering the room once when it gets stuck. If we ensure proper linking from the beginning, hopefully we don't run into any issues at all. Change-Id: Idf0f1882ec4f197f58f3818e63386a4def838b25
This commit is contained in:
parent
0d43fc6861
commit
ab9caef466
1 changed files with 8 additions and 2 deletions
|
@ -108,8 +108,14 @@ internal class TokenChunkEventPersistor @Inject constructor(
|
|||
this.nextChunk = nextChunk
|
||||
this.prevChunk = prevChunk
|
||||
}
|
||||
nextChunk?.prevChunk = currentChunk
|
||||
prevChunk?.nextChunk = currentChunk
|
||||
val allNextChunks = ChunkEntity.findAll(realm, roomId, prevToken = nextToken)
|
||||
val allPrevChunks = ChunkEntity.findAll(realm, roomId, nextToken = prevToken)
|
||||
allNextChunks?.forEach {
|
||||
it.prevChunk = currentChunk
|
||||
}
|
||||
allPrevChunks?.forEach {
|
||||
it.nextChunk = currentChunk
|
||||
}
|
||||
if (receivedChunk.events.isEmpty() && !receivedChunk.hasMore()) {
|
||||
handleReachEnd(roomId, direction, currentChunk)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue