mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-18 07:11:58 +03:00
Update read marker when we go back in live (#8306)
This commit is contained in:
parent
7f42eb3fb6
commit
99aa9493d6
1 changed files with 5 additions and 1 deletions
|
@ -1325,13 +1325,17 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
computeUnreadState(timelineEvents, roomSummary)
|
||||
}
|
||||
// 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, if the readMarkerId hasn't changed,
|
||||
// However, we want to update an existing HasUnread, if the readMarkerId hasn't changed or when we go back in live,
|
||||
// as we might be loading new events to fill gaps in the timeline.
|
||||
.distinctUntilChanged { previous, current ->
|
||||
when {
|
||||
previous is UnreadState.Unknown || previous is UnreadState.ReadMarkerNotLoaded -> false
|
||||
previous is UnreadState.HasUnread && current is UnreadState.HasUnread &&
|
||||
previous.readMarkerId == current.readMarkerId -> false
|
||||
previous is UnreadState.HasUnread && (
|
||||
current is UnreadState.HasUnread && previous.firstUnreadEventId != current.firstUnreadEventId ||
|
||||
current is UnreadState.HasNoUnread
|
||||
) && timeline?.isLive.orFalse() -> false
|
||||
current is UnreadState.HasUnread || current is UnreadState.HasNoUnread -> true
|
||||
else -> false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue