Fix another case of missing read markers
HasUnread might not be correct on the first try while loading the timeline.
This commit is contained in:
parent
8efd389a3c
commit
1206c31e3a
|
@ -1099,9 +1099,11 @@ class TimelineViewModel @AssistedInject constructor(
|
||||||
computeUnreadState(timelineEvents, roomSummary)
|
computeUnreadState(timelineEvents, roomSummary)
|
||||||
}
|
}
|
||||||
// We don't want live update of unread so we skip when we already had a HasUnread or HasNoUnread
|
// We don't want live update of unread so we skip when we already had a HasUnread or HasNoUnread
|
||||||
|
// However, we want to update an existing HasUnread, as we might get additional information during loading of events.
|
||||||
.distinctUntilChanged { previous, current ->
|
.distinctUntilChanged { previous, current ->
|
||||||
when {
|
when {
|
||||||
previous is UnreadState.Unknown || previous is UnreadState.ReadMarkerNotLoaded -> false
|
previous is UnreadState.Unknown || previous is UnreadState.ReadMarkerNotLoaded -> false
|
||||||
|
previous is UnreadState.HasUnread && current is UnreadState.HasUnread -> false
|
||||||
current is UnreadState.HasUnread || current is UnreadState.HasNoUnread -> true
|
current is UnreadState.HasUnread || current is UnreadState.HasNoUnread -> true
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue