No need to keep the Job instance.
This commit is contained in:
parent
5f27c7107a
commit
a698c7673c
1 changed files with 1 additions and 5 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue