Only show HasUnread -> HasUnread updates for same readMarker
Change-Id: Id4c3bb55a7cfcfc97bc362c64213c2c165a24ab3
This commit is contained in:
parent
ece413887a
commit
47a47a9e97
|
@ -37,7 +37,7 @@ sealed class UnreadState {
|
|||
object Unknown : UnreadState()
|
||||
object HasNoUnread : UnreadState()
|
||||
data class ReadMarkerNotLoaded(val readMarkerId: String) : UnreadState()
|
||||
data class HasUnread(val firstUnreadEventId: String) : UnreadState()
|
||||
data class HasUnread(val firstUnreadEventId: String, val readMarkerId: String) : UnreadState()
|
||||
}
|
||||
|
||||
data class JitsiState(
|
||||
|
|
|
@ -1134,7 +1134,8 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
.distinctUntilChanged { previous, current ->
|
||||
when {
|
||||
previous is UnreadState.Unknown || previous is UnreadState.ReadMarkerNotLoaded -> false
|
||||
previous is UnreadState.HasUnread && current is UnreadState.HasUnread -> false
|
||||
previous is UnreadState.HasUnread && current is UnreadState.HasUnread &&
|
||||
previous.readMarkerId == current.readMarkerId -> false
|
||||
current is UnreadState.HasUnread || current is UnreadState.HasNoUnread -> true
|
||||
else -> false
|
||||
}
|
||||
|
@ -1168,7 +1169,7 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
val isFromMe = timelineEvent.root.senderId == session.myUserId
|
||||
rmDimber.i{"isFromMe = $isFromMe"}
|
||||
if (!isFromMe) {
|
||||
return UnreadState.HasUnread(eventId)
|
||||
return UnreadState.HasUnread(eventId, readMarkerIdSnapshot)
|
||||
}
|
||||
}
|
||||
rmDimber.i{"hasNoUnread / firstDisplayableEventIndex: $firstDisplayableEventIndex / " +
|
||||
|
|
Loading…
Reference in New Issue