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.
This commit is contained in:
parent
cbdc28dd9b
commit
8efd389a3c
|
@ -1120,6 +1120,11 @@ class TimelineViewModel @AssistedInject constructor(
|
||||||
} else {
|
} else {
|
||||||
UnreadState.Unknown
|
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) {
|
for (i in (firstDisplayableEventIndex - 1) downTo 0) {
|
||||||
val timelineEvent = events.getOrNull(i) ?: return UnreadState.Unknown
|
val timelineEvent = events.getOrNull(i) ?: return UnreadState.Unknown
|
||||||
val eventId = timelineEvent.root.eventId ?: return UnreadState.Unknown
|
val eventId = timelineEvent.root.eventId ?: return UnreadState.Unknown
|
||||||
|
|
Loading…
Reference in New Issue