From a23be05cbf2f9fea52470f843f1ab4e0d57bceeb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 5 Sep 2019 15:38:14 +0200 Subject: [PATCH] Better type --- .../android/internal/crypto/keysbackup/KeysBackup.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt index edd2e190..786923da 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt @@ -67,7 +67,6 @@ import org.matrix.olm.OlmPkMessage import timber.log.Timber import java.security.InvalidParameterException import javax.inject.Inject -import kotlin.collections.HashMap import kotlin.random.Random /** @@ -846,7 +845,7 @@ internal class KeysBackup @Inject constructor( // Wait between 0 and 10 seconds, to avoid backup requests from // different clients hitting the server all at the same time when a // new key is sent - val delayInMs = Random.nextInt(KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS).toLong() + val delayInMs = Random.nextLong(KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS) uiHandler.postDelayed({ backupKeys() }, delayInMs) } @@ -1305,7 +1304,7 @@ internal class KeysBackup @Inject constructor( // Make the request storeSessionDataTask - .configureWith(StoreSessionsDataTask.Params(keysBackupVersion!!.version!!, keysBackupData)){ + .configureWith(StoreSessionsDataTask.Params(keysBackupVersion!!.version!!, keysBackupData)) { this.callback = sendingRequestCallback } .executeBy(taskExecutor) @@ -1403,7 +1402,7 @@ internal class KeysBackup @Inject constructor( companion object { // Maximum delay in ms in {@link maybeBackupKeys} - private const val KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS = 10000 + private const val KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS = 10_000L // Maximum number of keys to send at a time to the homeserver. private const val KEY_BACKUP_SEND_KEYS_MAX_COUNT = 100