mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 14:38:45 +03:00
Fix a case of missing read markers
Case: bottom-most loaded event has read marker, but there are messages below it that haven't been loaded yet. Change-Id: I24336ac20558d637840c38ff00527dc2f2c65f75
This commit is contained in:
parent
93ae1e954e
commit
df0b5ca0a0
1 changed files with 5 additions and 0 deletions
|
@ -1156,6 +1156,11 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
Timber.i("ReadMarker debug: not live")
|
||||
UnreadState.Unknown
|
||||
}
|
||||
// If the read marker is at the bottom-most event, this doesn't mean we read all, in case we just haven't loaded more events.
|
||||
// Avoid incorrectly returning HasNoUnread in this case.
|
||||
if (firstDisplayableEventIndex == 0 && timeline.hasMoreToLoad(Timeline.Direction.FORWARDS)) {
|
||||
return UnreadState.Unknown
|
||||
}
|
||||
for (i in (firstDisplayableEventIndex - 1) downTo 0) {
|
||||
val timelineEvent = events.getOrNull(i) ?: return UnreadState.Unknown
|
||||
val eventId = timelineEvent.root.eventId ?: return UnreadState.Unknown
|
||||
|
|
Loading…
Reference in a new issue