From a698c7673ceeb80c305c5da377288aba3fa950bf Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 26 Nov 2024 15:07:22 +0100 Subject: [PATCH] No need to keep the Job instance. --- .../impl/attachments/preview/AttachmentsPreviewPresenter.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewPresenter.kt index 1ca48848a2..4ac8eecc5c 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/attachments/preview/AttachmentsPreviewPresenter.kt @@ -74,9 +74,8 @@ class AttachmentsPreviewPresenter @AssistedInject constructor( val userSentAttachment = remember { mutableStateOf(false) } val mediaUploadInfoState = remember { mutableStateOf>(AsyncData.Uninitialized) } - var prePropressingJob: Job? = null LaunchedEffect(Unit) { - prePropressingJob = preProcessAttachment( + preProcessAttachment( attachment, mediaUploadInfoState, ) @@ -116,7 +115,6 @@ class AttachmentsPreviewPresenter @AssistedInject constructor( AttachmentsPreviewEvents.Cancel -> { coroutineScope.cancel( attachment, - prePropressingJob, mediaUploadInfoState.value, sendActionState, ) @@ -178,7 +176,6 @@ class AttachmentsPreviewPresenter @AssistedInject constructor( private fun CoroutineScope.cancel( attachment: Attachment, - preProcessingJob: Job?, mediaUploadInfo: AsyncData, sendActionState: MutableState, ) = launch { @@ -186,7 +183,6 @@ class AttachmentsPreviewPresenter @AssistedInject constructor( when (attachment) { is Attachment.Media -> { temporaryUriDeleter.delete(attachment.localMedia.uri) - preProcessingJob?.cancel() mediaUploadInfo.dataOrNull()?.let { data -> cleanUp(data) }