diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index d1ce31a54a..b5cb4d2064 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -2039,6 +2039,7 @@ class TimelineFragment @Inject constructor( } override fun onLoadMore(direction: Timeline.Direction) { + Timber.i("ReadMarker debug: on load more $direction") timelineViewModel.handle(RoomDetailAction.LoadMoreTimelineEvents(direction)) } 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 773de5131c..542862b292 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 @@ -638,6 +638,7 @@ class TimelineViewModel @AssistedInject constructor( if (trackUnreadMessages.getAndSet(false)) { mostRecentDisplayedEvent?.root?.eventId?.also { session.coroutineScope.launch(NonCancellable) { + Timber.i("ReadMarker debug: set RM and RR to $it") tryOrNull { room.setReadMarker(it) } if (loadRoomAtFirstUnread()) { tryOrNull { room.setReadReceipt(it) } @@ -1127,6 +1128,7 @@ class TimelineViewModel @AssistedInject constructor( } } .setOnEach { + Timber.i("ReadMarker debug: update unreadState = $it") copy(unreadState = it) } } @@ -1156,11 +1158,13 @@ class TimelineViewModel @AssistedInject constructor( if (!isFromMe) { return UnreadState.HasUnread(eventId) } + Timber.i("ReadMarker debug: hasNoUnread / firstDisplayableEventIndex: $firstDisplayableEventIndex / " + + "latest previewable from summary ${roomSummary.latestPreviewableOriginalContentEvent?.eventId} - ${timeline.getIndexOfEvent(roomSummary.latestPreviewableOriginalContentEvent?.eventId)} / " + + "event-0 ${events.getOrNull(0)?.eventId}") } Timber.i("ReadMarker debug: hasNoUnread / firstDisplayableEventIndex: $firstDisplayableEventIndex / " + "latest previewable from summary ${roomSummary.latestPreviewableOriginalContentEvent?.eventId} - ${timeline.getIndexOfEvent(roomSummary.latestPreviewableOriginalContentEvent?.eventId)} / " + "event-0 ${events.getOrNull(0)?.eventId}") - // TODO: if we return HasNoUnread, we need to be sure, since later HasUnread will be ignored in distinctUntilChanged. However, when loading the room at the last read directly, this doesn't always work return UnreadState.HasNoUnread }