mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 10:55:55 +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.
This commit is contained in:
parent
682f4c35d2
commit
6878a973ed
1 changed files with 8 additions and 2 deletions
|
@ -109,8 +109,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