Dbg unread state

Change-Id: Ifa6c12b30338516c87a4f535a4756942af130192
This commit is contained in:
SpiritCroc 2022-03-18 15:41:48 +01:00
parent ab9caef466
commit 0d2c851788
3 changed files with 8 additions and 3 deletions

View File

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

View File

@ -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?) {

View File

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