Add the number of rooms and toDevice events in the debug data

This commit is contained in:
Benoit Marty 2021-09-17 18:02:49 +02:00 committed by Benoit Marty
parent 63a84dcb8a
commit f5151463e2
4 changed files with 13 additions and 5 deletions

View File

@ -32,7 +32,10 @@ interface InitialSyncProgressService {
abstract class IncrementalSyncStatus: Status()
object IncrementalSyncIdle : IncrementalSyncStatus()
object IncrementalSyncParsing : IncrementalSyncStatus()
data class IncrementalSyncParsing(
val rooms: Int,
val toDevice: Int
) : IncrementalSyncStatus()
object IncrementalSyncDone : IncrementalSyncStatus()
}
}

View File

@ -137,7 +137,10 @@ internal class DefaultSyncTask @Inject constructor(
readTimeOut = readTimeOut
)
}
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncParsing)
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncParsing(
rooms = syncResponse.rooms?.invite.orEmpty().size + syncResponse.rooms?.join.orEmpty().size + syncResponse.rooms?.leave.orEmpty().size,
toDevice = syncResponse.toDevice?.events.orEmpty().size
))
syncResponseHandler.handleResponse(syncResponse, token, null)
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncDone)
}

View File

@ -73,9 +73,9 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute
private fun InitialSyncProgressService.Status.IncrementalSyncStatus.toHumanReadable(): String {
return when (this) {
is InitialSyncProgressService.Status.IncrementalSyncIdle -> "Idle"
is InitialSyncProgressService.Status.IncrementalSyncParsing -> "Parsing"
is InitialSyncProgressService.Status.IncrementalSyncDone -> "Done"
InitialSyncProgressService.Status.IncrementalSyncIdle -> "Idle"
is InitialSyncProgressService.Status.IncrementalSyncParsing -> "Parsing ${this.rooms} room(s) ${this.toDevice} toDevice(s)"
InitialSyncProgressService.Status.IncrementalSyncDone -> "Done"
else -> "?"
}
}

View File

@ -9,9 +9,11 @@
<TextView
android:id="@+id/syncStateDebugInfo"
style="@style/Widget.Vector.TextView.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="monospace"
android:padding="2dp"
android:visibility="gone"
tools:text="debug info"
tools:visibility="visible" />