mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Add the number of rooms and toDevice events in the debug data
This commit is contained in:
parent
63a84dcb8a
commit
f5151463e2
4 changed files with 13 additions and 5 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 -> "?"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in a new issue