mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Media: keep the name of the file when possible
This commit is contained in:
+2
-1
@@ -27,7 +27,8 @@ interface MediaPreProcessor {
|
||||
suspend fun process(
|
||||
uri: Uri,
|
||||
mimeType: String,
|
||||
deleteOriginal: Boolean = false
|
||||
deleteOriginal: Boolean = false,
|
||||
compressIfPossible: Boolean
|
||||
): Result<MediaUploadInfo>
|
||||
|
||||
data class Failure(override val cause: Throwable?) : RuntimeException(cause)
|
||||
|
||||
+7
-2
@@ -26,9 +26,14 @@ class MediaSender @Inject constructor(
|
||||
private val room: MatrixRoom,
|
||||
) {
|
||||
|
||||
suspend fun sendMedia(uri: Uri, mimeType: String): Result<Unit> {
|
||||
suspend fun sendMedia(uri: Uri, mimeType: String, compressIfPossible: Boolean): Result<Unit> {
|
||||
return preProcessor
|
||||
.process(uri, mimeType, deleteOriginal = true)
|
||||
.process(
|
||||
uri = uri,
|
||||
mimeType = mimeType,
|
||||
deleteOriginal = true,
|
||||
compressIfPossible = compressIfPossible
|
||||
)
|
||||
.flatMap { info ->
|
||||
room.sendMedia(info)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user