mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-21 21:54:28 +03:00
Merge pull request #5481 from SpiritCroc/readmarkerupdate
Fix updating unread marker if not to latest chunk
This commit is contained in:
commit
72bd398ae0
3 changed files with 5 additions and 1 deletions
changelog.d
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database
1
changelog.d/5481.bugfix
Normal file
1
changelog.d/5481.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix sometimes read marker not properly updating
|
|
@ -226,6 +226,9 @@ internal fun ChunkEntity.isMoreRecentThan(chunkToCheck: ChunkEntity): Boolean {
|
||||||
if (chunkToCheck.doesNextChunksVerifyCondition { it == this }) {
|
if (chunkToCheck.doesNextChunksVerifyCondition { it == this }) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if (this.doesNextChunksVerifyCondition { it == chunkToCheck }) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
// Otherwise check if this chunk is linked to last forward
|
// Otherwise check if this chunk is linked to last forward
|
||||||
if (this.doesNextChunksVerifyCondition { it.isLastForward }) {
|
if (this.doesNextChunksVerifyCondition { it.isLastForward }) {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -94,7 +94,7 @@ internal fun isReadMarkerMoreRecent(realmConfiguration: RealmConfiguration,
|
||||||
val eventToCheckIndex = eventToCheck?.displayIndex ?: Int.MAX_VALUE
|
val eventToCheckIndex = eventToCheck?.displayIndex ?: Int.MAX_VALUE
|
||||||
eventToCheckIndex <= readMarkerIndex
|
eventToCheckIndex <= readMarkerIndex
|
||||||
} else {
|
} else {
|
||||||
eventToCheckChunk?.isLastForward == false
|
eventToCheckChunk != null && readMarkerChunk?.isMoreRecentThan(eventToCheckChunk) == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue