mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-27 11:09:18 +03:00
Fix another case of missing read markers
HasUnread might not be correct on the first try while loading the timeline. Change-Id: I6bba6cc58ca21725764d41909deb9a0495d51ea0
This commit is contained in:
parent
df0b5ca0a0
commit
4f2931feae
1 changed files with 3 additions and 1 deletions
|
@ -1132,10 +1132,12 @@ 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
|
||||||
current is UnreadState.HasUnread /*|| current is UnreadState.HasNoUnread */ -> true
|
previous is UnreadState.HasUnread && current is UnreadState.HasUnread -> false
|
||||||
|
current is UnreadState.HasUnread || current is UnreadState.HasNoUnread -> true
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue