Developer info: also show whether read marker is being tracked

Change-Id: I642139d1639d5ada08308ab141fc913ca620bf3c
This commit is contained in:
SpiritCroc 2022-03-21 12:52:41 +01:00
parent 47a47a9e97
commit 86c49cba5d
3 changed files with 8 additions and 4 deletions

View file

@ -84,5 +84,5 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
object StopChatEffects : RoomDetailViewEvents()
object RoomReplacementStarted : RoomDetailViewEvents()
data class ScDbgReadTracking(val event: TimelineEvent?, val unreadState: UnreadState) : RoomDetailViewEvents()
data class ScDbgReadTracking(val event: TimelineEvent?, val unreadState: UnreadState, val trackUnreadMessages: Boolean) : RoomDetailViewEvents()
}

View file

@ -610,7 +610,8 @@ class TimelineFragment @Inject constructor(
}
private fun handleScDbgReadTracking(action: RoomDetailViewEvents.ScDbgReadTracking) {
views.scRoomDebugView.text = "UnreadState: ${action.unreadState.javaClass.simpleName}\nRead: ${action.event?.eventId}/${action.event?.displayIndex}"
views.scRoomDebugView.text = "UnreadState: ${action.unreadState.javaClass.simpleName}, Tracking: ${action.trackUnreadMessages}\n" +
"Read: ${action.event?.eventId}/${action.event?.displayIndex}"
}
override fun onImageReady(uri: Uri?) {

View file

@ -162,7 +162,7 @@ class TimelineViewModel @AssistedInject constructor(
field = value
if (DbgUtil.isDbgEnabled(DbgUtil.DBG_SHOW_READ_TRACKING)) {
withState {
_viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it.unreadState))
_viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it.unreadState, trackUnreadMessages.get()))
}
}
}
@ -643,6 +643,9 @@ class TimelineViewModel @AssistedInject constructor(
private fun startTrackingUnreadMessages() {
trackUnreadMessages.set(true)
withState {
_viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it.unreadState, trackUnreadMessages.get()))
}
setState { copy(canShowJumpToReadMarker = false) }
}
@ -1182,7 +1185,7 @@ class TimelineViewModel @AssistedInject constructor(
onEach(RoomDetailViewState::unreadState) {
Timber.v("Unread state: $it")
if (DbgUtil.isDbgEnabled(DbgUtil.DBG_SHOW_READ_TRACKING)) {
_viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it))
_viewEvents.post(RoomDetailViewEvents.ScDbgReadTracking(mostRecentDisplayedEvent, it, trackUnreadMessages.get()))
}
if (it is UnreadState.HasNoUnread) {
startTrackingUnreadMessages()