From f5151463e254623c64a0c11118c2f1c4d6e01b63 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 17 Sep 2021 18:02:49 +0200 Subject: [PATCH] Add the number of rooms and toDevice events in the debug data --- .../sdk/api/session/initsync/InitialSyncProgressService.kt | 5 ++++- .../matrix/android/sdk/internal/session/sync/SyncTask.kt | 5 ++++- .../im/vector/app/features/sync/widget/SyncStateView.kt | 6 +++--- vector/src/main/res/layout/view_sync_state.xml | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/InitialSyncProgressService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/InitialSyncProgressService.kt index 54f515be57..e5bf6ae3b3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/InitialSyncProgressService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/InitialSyncProgressService.kt @@ -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() } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt index 656d22b06a..77cd6de13b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt @@ -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) } diff --git a/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt b/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt index 431acb682f..9f7b0fb419 100755 --- a/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt +++ b/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt @@ -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 -> "?" } } diff --git a/vector/src/main/res/layout/view_sync_state.xml b/vector/src/main/res/layout/view_sync_state.xml index d4de2c8d75..7924d689ee 100644 --- a/vector/src/main/res/layout/view_sync_state.xml +++ b/vector/src/main/res/layout/view_sync_state.xml @@ -9,9 +9,11 @@