mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
No need to keep the Job instance.
This commit is contained in:
+1
-5
@@ -74,9 +74,8 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
|
|||||||
val userSentAttachment = remember { mutableStateOf(false) }
|
val userSentAttachment = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val mediaUploadInfoState = remember { mutableStateOf<AsyncData<MediaUploadInfo>>(AsyncData.Uninitialized) }
|
val mediaUploadInfoState = remember { mutableStateOf<AsyncData<MediaUploadInfo>>(AsyncData.Uninitialized) }
|
||||||
var prePropressingJob: Job? = null
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
prePropressingJob = preProcessAttachment(
|
preProcessAttachment(
|
||||||
attachment,
|
attachment,
|
||||||
mediaUploadInfoState,
|
mediaUploadInfoState,
|
||||||
)
|
)
|
||||||
@@ -116,7 +115,6 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
|
|||||||
AttachmentsPreviewEvents.Cancel -> {
|
AttachmentsPreviewEvents.Cancel -> {
|
||||||
coroutineScope.cancel(
|
coroutineScope.cancel(
|
||||||
attachment,
|
attachment,
|
||||||
prePropressingJob,
|
|
||||||
mediaUploadInfoState.value,
|
mediaUploadInfoState.value,
|
||||||
sendActionState,
|
sendActionState,
|
||||||
)
|
)
|
||||||
@@ -178,7 +176,6 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
|
|||||||
|
|
||||||
private fun CoroutineScope.cancel(
|
private fun CoroutineScope.cancel(
|
||||||
attachment: Attachment,
|
attachment: Attachment,
|
||||||
preProcessingJob: Job?,
|
|
||||||
mediaUploadInfo: AsyncData<MediaUploadInfo>,
|
mediaUploadInfo: AsyncData<MediaUploadInfo>,
|
||||||
sendActionState: MutableState<SendActionState>,
|
sendActionState: MutableState<SendActionState>,
|
||||||
) = launch {
|
) = launch {
|
||||||
@@ -186,7 +183,6 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(
|
|||||||
when (attachment) {
|
when (attachment) {
|
||||||
is Attachment.Media -> {
|
is Attachment.Media -> {
|
||||||
temporaryUriDeleter.delete(attachment.localMedia.uri)
|
temporaryUriDeleter.delete(attachment.localMedia.uri)
|
||||||
preProcessingJob?.cancel()
|
|
||||||
mediaUploadInfo.dataOrNull()?.let { data ->
|
mediaUploadInfo.dataOrNull()?.let { data ->
|
||||||
cleanUp(data)
|
cleanUp(data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user