diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt index 3b274bce91..d1ddc382a4 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt @@ -84,5 +84,5 @@ sealed class RoomDetailViewEvents : VectorViewEvents { object StopChatEffects : RoomDetailViewEvents() object RoomReplacementStarted : RoomDetailViewEvents() - data class ScDbgReadTracking(val event: TimelineEvent?) : RoomDetailViewEvents() + data class ScDbgReadTracking(val event: TimelineEvent?, val unreadState: UnreadState) : RoomDetailViewEvents() } 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 77a6c6805d..81e807b867 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 @@ -610,7 +610,7 @@ class TimelineFragment @Inject constructor( } private fun handleScDbgReadTracking(action: RoomDetailViewEvents.ScDbgReadTracking) { - views.scRoomDebugView.text = "Read: ${action.event?.eventId}/${action.event?.displayIndex}" + views.scRoomDebugView.text = "UnreadState: ${action.unreadState.javaClass.simpleName}\nRead: ${action.event?.eventId}/${action.event?.displayIndex}" } override fun onImageReady(uri: Uri?) { 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 a8e929e674..08a12436b2 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 @@ -161,7 +161,9 @@ class TimelineViewModel @AssistedInject constructor( set(value) { field = value if (DbgUtil.isDbgEnabled(DbgUtil.DBG_SHOW_READ_TRACKING)) { - _viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent)) + withState { + _viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it.unreadState)) + } } } @@ -1178,6 +1180,9 @@ class TimelineViewModel @AssistedInject constructor( private fun observeUnreadState() { onEach(RoomDetailViewState::unreadState) { Timber.v("Unread state: $it") + if (DbgUtil.isDbgEnabled(DbgUtil.DBG_SHOW_READ_TRACKING)) { + _viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it)) + } if (it is UnreadState.HasNoUnread) { startTrackingUnreadMessages() }