From 4f2931feae8130f511646c154b75de5777382971 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Wed, 9 Mar 2022 13:43:52 +0100 Subject: [PATCH] Fix another case of missing read markers HasUnread might not be correct on the first try while loading the timeline. Change-Id: I6bba6cc58ca21725764d41909deb9a0495d51ea0 --- .../vector/app/features/home/room/detail/TimelineViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt index edf8669d1f..dafb41abc9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt @@ -1132,10 +1132,12 @@ 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, as we might get additional information during loading of events. .distinctUntilChanged { previous, current -> when { 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 } }