mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 09:56:00 +03:00
Read marker: fix banner visibility when following permalink
This commit is contained in:
parent
c8f0c83cd3
commit
5bde7b9f17
1 changed files with 7 additions and 2 deletions
|
@ -819,9 +819,14 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
|||
if (events.isEmpty()) return UnreadState.Unknown
|
||||
val readMarkerIdSnapshot = roomSummary.readMarkerId ?: return UnreadState.Unknown
|
||||
val firstDisplayableEventId = timeline.getFirstDisplayableEventId(readMarkerIdSnapshot)
|
||||
?: return UnreadState.ReadMarkerNotLoaded(readMarkerIdSnapshot)
|
||||
val firstDisplayableEventIndex = timeline.getIndexOfEvent(firstDisplayableEventId)
|
||||
?: return UnreadState.ReadMarkerNotLoaded(readMarkerIdSnapshot)
|
||||
if (firstDisplayableEventId == null || firstDisplayableEventIndex == null) {
|
||||
return if (timeline.isLive) {
|
||||
UnreadState.ReadMarkerNotLoaded(readMarkerIdSnapshot)
|
||||
} else {
|
||||
UnreadState.Unknown
|
||||
}
|
||||
}
|
||||
for (i in (firstDisplayableEventIndex - 1) downTo 0) {
|
||||
val timelineEvent = events.getOrNull(i) ?: return UnreadState.Unknown
|
||||
val eventId = timelineEvent.root.eventId ?: return UnreadState.Unknown
|
||||
|
|
Loading…
Reference in a new issue