Make sure we clean up the pre-processed and uploaded media (#5039)
* Add `MediaSender.cleanUp()` and `MediaPreProcessor.cleanUp()` methods: this will remove the temporary files created when pre-processing media before sending them. * Make sure we clean up also the previous temporary media. * Fix the condition for the custom back handler in the attachments preview screen * Tests: check the clean up is performed when needed
This commit is contained in:
parent
9f11884ddd
commit
d53457ec66
7 changed files with 65 additions and 8 deletions
|
|
@ -22,5 +22,10 @@ interface MediaPreProcessor {
|
|||
compressIfPossible: Boolean,
|
||||
): Result<MediaUploadInfo>
|
||||
|
||||
/**
|
||||
* Clean up any temporary files or resources used during the media processing.
|
||||
*/
|
||||
fun cleanUp()
|
||||
|
||||
data class Failure(override val cause: Throwable?) : Exception(cause)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,4 +200,9 @@ class MediaSender @Inject constructor(
|
|||
uploadHandler.await()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up any temporary files or resources used during the media processing.
|
||||
*/
|
||||
fun cleanUp() = preProcessor.cleanUp()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue