[TMP] Update some readmarker debugging

Change-Id: Ia1de156f39622d90cc1433f0b16776bd00e2a462
This commit is contained in:
SpiritCroc 2022-03-11 10:04:40 +01:00
parent 12e4853c59
commit 6aabb38c3b
2 changed files with 6 additions and 1 deletions

View File

@ -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))
}

View File

@ -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
}