From ad984b26fbc26f284dcc344b5ab8faca29665f09 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 4 Sep 2020 12:22:38 +0200 Subject: [PATCH] Move variable declaration --- .../sdk/internal/session/content/UploadContentWorker.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt index 4d23649519..e4dcc8cf23 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt @@ -100,10 +100,6 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter val sessionComponent = getSessionComponent(params.sessionId) ?: return Result.success() sessionComponent.inject(this) - val attachment = params.attachment - - var newImageAttributes: NewImageAttributes? = null - val allCancelled = params.events.all { cancelSendTracker.isCancelRequestedFor(it.eventId, it.roomId) } if (allCancelled) { // there is no point in uploading the image! @@ -111,6 +107,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter .also { Timber.e("## Send: Work cancelled by user") } } + val attachment = params.attachment val filesToDelete = mutableListOf() try { @@ -181,6 +178,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter return try { val fileToUpload: File + var newImageAttributes: NewImageAttributes? = null if (attachment.type == ContentAttachmentData.Type.IMAGE && params.compressBeforeSending) { fileToUpload = imageCompressor.compress(context, workingFile, MAX_IMAGE_SIZE, MAX_IMAGE_SIZE)