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:
committed by
GitHub
parent
746699b468
commit
b219c05d06
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user