mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Revert "Send SVG images as files (#4595)"
This commit is contained in:
@@ -26,7 +26,6 @@ object MimeTypes {
|
|||||||
const val Jpeg = "image/jpeg"
|
const val Jpeg = "image/jpeg"
|
||||||
const val Gif = "image/gif"
|
const val Gif = "image/gif"
|
||||||
const val WebP = "image/webp"
|
const val WebP = "image/webp"
|
||||||
const val Svg = "image/svg+xml"
|
|
||||||
|
|
||||||
const val Videos = "video/*"
|
const val Videos = "video/*"
|
||||||
const val Mp4 = "video/mp4"
|
const val Mp4 = "video/mp4"
|
||||||
|
|||||||
+1
-5
@@ -67,7 +67,7 @@ class AndroidMediaPreProcessor(
|
|||||||
*/
|
*/
|
||||||
private const val IMAGE_SCALE_REF_SIZE = 640
|
private const val IMAGE_SCALE_REF_SIZE = 640
|
||||||
|
|
||||||
private val notCompressibleImageTypes = listOf(MimeTypes.Gif, MimeTypes.WebP, MimeTypes.Svg)
|
private val notCompressibleImageTypes = listOf(MimeTypes.Gif, MimeTypes.WebP)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val contentResolver = context.contentResolver
|
private val contentResolver = context.contentResolver
|
||||||
@@ -83,10 +83,6 @@ class AndroidMediaPreProcessor(
|
|||||||
): Result<MediaUploadInfo> = withContext(coroutineDispatchers.computation) {
|
): Result<MediaUploadInfo> = withContext(coroutineDispatchers.computation) {
|
||||||
runCatchingExceptions {
|
runCatchingExceptions {
|
||||||
val result = when {
|
val result = when {
|
||||||
// Special case for SVG, since Android can't read its metadata or create a thumbnail, it must be sent as a file
|
|
||||||
mimeType == MimeTypes.Svg -> {
|
|
||||||
processFile(uri, mimeType)
|
|
||||||
}
|
|
||||||
mimeType.isMimeTypeImage() -> {
|
mimeType.isMimeTypeImage() -> {
|
||||||
val shouldBeCompressed = mediaOptimizationConfig.compressImages && mimeType !in notCompressibleImageTypes
|
val shouldBeCompressed = mediaOptimizationConfig.compressImages && mimeType !in notCompressibleImageTypes
|
||||||
processImage(uri, mimeType, shouldBeCompressed)
|
processImage(uri, mimeType, shouldBeCompressed)
|
||||||
|
|||||||
Reference in New Issue
Block a user