From f22badd13ecebcd681d07476a988e901d1df8896 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 2 Dec 2021 13:47:02 +0100 Subject: [PATCH] Format --- .../internal/session/sync/job/SyncWorker.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt index f531c94ce1..23bc862141 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt @@ -75,10 +75,20 @@ internal class SyncWorker(context: Context, Result.success().also { if (params.periodic) { // we want to schedule another one after a delay, or immediately if hasToDeviceEvents - automaticallyBackgroundSync(workManagerProvider, params.sessionId, params.timeout, params.delay, forceImmediate = hasToDeviceEvents) + automaticallyBackgroundSync( + workManagerProvider = workManagerProvider, + sessionId = params.sessionId, + serverTimeout = params.timeout, + delayInSeconds = params.delay, + forceImmediate = hasToDeviceEvents + ) } else if (hasToDeviceEvents) { // Previous response has toDevice events, request an immediate sync request - requireBackgroundSync(workManagerProvider, params.sessionId, 0) + requireBackgroundSync( + workManagerProvider = workManagerProvider, + sessionId = params.sessionId, + serverTimeout = 0 + ) } } }, @@ -111,7 +121,9 @@ internal class SyncWorker(context: Context, companion object { private const val BG_SYNC_WORK_NAME = "BG_SYNCP" - fun requireBackgroundSync(workManagerProvider: WorkManagerProvider, sessionId: String, serverTimeout: Long = 0) { + fun requireBackgroundSync(workManagerProvider: WorkManagerProvider, + sessionId: String, + serverTimeout: Long = 0) { val data = WorkerParamsFactory.toData(Params(sessionId, serverTimeout, 0L, false)) val workRequest = workManagerProvider.matrixOneTimeWorkRequestBuilder() .setConstraints(WorkManagerProvider.workConstraints)