From 34ac987494a9d9706fd01352d2df275ec80033b9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 9 Jul 2019 16:36:46 +0200 Subject: [PATCH] Cleanup --- .../session/DefaultInitialSyncProgressService.kt | 12 ++++++------ .../internal/session/sync/SyncResponseHandler.kt | 4 ++-- .../vector/riotx/features/rageshake/BugReporter.kt | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/DefaultInitialSyncProgressService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/DefaultInitialSyncProgressService.kt index e4f1f571d2..cefdcc7290 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/DefaultInitialSyncProgressService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/DefaultInitialSyncProgressService.kt @@ -61,13 +61,13 @@ class DefaultInitialSyncProgressService @Inject constructor() : InitialSyncProgr parent?.incrementProgress(endedTask.offset + (endedTask.totalProgress * endedTask.parentWeight).toInt()) } if (endedTask?.parent == null) { - this@DefaultInitialSyncProgressService.status.postValue(null) + status.postValue(null) } } fun endAll() { rootTask = null - this@DefaultInitialSyncProgressService.status.postValue(null) + status.postValue(null) } @@ -96,7 +96,7 @@ class DefaultInitialSyncProgressService @Inject constructor() : InitialSyncProgr } if (parent == null) { Timber.e("--- ${leaf().nameRes}: ${currentProgress}") - this@DefaultInitialSyncProgressService.status.postValue( + status.postValue( InitialSyncProgressService.Status(leaf().nameRes, currentProgress) ) } @@ -105,7 +105,7 @@ class DefaultInitialSyncProgressService @Inject constructor() : InitialSyncProgr } -public inline fun reportSubtask(reporter: DefaultInitialSyncProgressService?, nameRes: Int, totalProgress: Int, parentWeight: Float = 1f, block: () -> T): T { +inline fun reportSubtask(reporter: DefaultInitialSyncProgressService?, nameRes: Int, totalProgress: Int, parentWeight: Float = 1f, block: () -> T): T { reporter?.startTask(nameRes, totalProgress, parentWeight) return block().also { reporter?.endTask(nameRes) @@ -113,8 +113,8 @@ public inline fun reportSubtask(reporter: DefaultInitialSyncProgressService? } -public inline fun Map.mapWithProgress(reporter: DefaultInitialSyncProgressService?, taskId: Int, weight: Float, transform: (Map.Entry) -> R): List { - val total = this.count() +inline fun Map.mapWithProgress(reporter: DefaultInitialSyncProgressService?, taskId: Int, weight: Float, transform: (Map.Entry) -> R): List { + val total = count() var current = 0 reporter?.startTask(taskId, 100, weight) return this.map { diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/SyncResponseHandler.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/SyncResponseHandler.kt index 8d018d6175..f918e78448 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/SyncResponseHandler.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/SyncResponseHandler.kt @@ -36,7 +36,7 @@ internal class SyncResponseHandler @Inject constructor(private val roomSyncHandl fun handleResponse(syncResponse: SyncResponse, fromToken: String?, isCatchingUp: Boolean): Try { return Try { val isInitialSync = fromToken == null - Timber.v("Start handling sync, is InitialSync: ${isInitialSync}") + Timber.v("Start handling sync, is InitialSync: $isInitialSync") val reporter = initialSyncProgressService.takeIf { isInitialSync } if (!cryptoManager.isStarted()) { @@ -68,7 +68,7 @@ internal class SyncResponseHandler @Inject constructor(private val roomSyncHandl } reportSubtask(reporter, R.string.initial_sync_start_importing_account_data, 100, 0.1f) { - Timber.v("Handle accoundData") + Timber.v("Handle accountData") if (syncResponse.accountData != null) { userAccountDataSyncHandler.handle(syncResponse.accountData) } diff --git a/vector/src/main/java/im/vector/riotx/features/rageshake/BugReporter.kt b/vector/src/main/java/im/vector/riotx/features/rageshake/BugReporter.kt index e06bcaa2cd..774bdfb9d9 100755 --- a/vector/src/main/java/im/vector/riotx/features/rageshake/BugReporter.kt +++ b/vector/src/main/java/im/vector/riotx/features/rageshake/BugReporter.kt @@ -51,7 +51,7 @@ import javax.inject.Singleton * BugReporter creates and sends the bug reports. */ @Singleton -class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSessionHolder){ +class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSessionHolder) { var inMultiWindowMode = false companion object { @@ -72,7 +72,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes private var mBugReportCall: Call? = null - // boolean to cancel the bug reportSubtask + // boolean to cancel the bug report private val mIsCancelled = false /**