Merge pull request #254 from gavine99/mms-attachment-share-242

fixes for mms attachment view/share is suboptimal (#242) and other small fixups
This commit is contained in:
octoshrimpy
2025-02-06 17:00:37 -07:00
committed by GitHub
14 changed files with 285 additions and 93 deletions
@@ -21,14 +21,14 @@ package dev.octoshrimpy.quik.extensions
import com.google.android.mms.ContentType
import dev.octoshrimpy.quik.model.MmsPart
fun MmsPart.isSmil() = ContentType.APP_SMIL == type
fun MmsPart.isSmil() = ContentType.APP_SMIL.lowercase() == type.lowercase()
fun MmsPart.isImage() = ContentType.isImageType(type)
fun MmsPart.isImage() = ContentType.isImageType(type.lowercase())
fun MmsPart.isVideo() = ContentType.isVideoType(type)
fun MmsPart.isVideo() = ContentType.isVideoType(type.lowercase())
fun MmsPart.isAudio() = ContentType.isAudioType(type)
fun MmsPart.isAudio() = ContentType.isAudioType(type.lowercase())
fun MmsPart.isText() = ContentType.TEXT_PLAIN == type
fun MmsPart.isText() = ContentType.TEXT_PLAIN.lowercase() == type.lowercase()
fun MmsPart.isVCard() = ContentType.TEXT_VCARD == type
fun MmsPart.isVCard() = ContentType.TEXT_VCARD.lowercase() == type.lowercase()
@@ -443,8 +443,8 @@ class MessageRepositoryImpl @Inject constructor(
imageBytesByAttachment.forEach { (attachment, bytes) ->
parts += when (attachment.getType(context) == "image/gif") {
true -> MMSPart("image", ContentType.IMAGE_GIF, bytes)
false -> MMSPart("image", ContentType.IMAGE_JPEG, bytes)
true -> MMSPart(attachment.getName(context), ContentType.IMAGE_GIF, bytes)
false -> MMSPart(attachment.getName(context), ContentType.IMAGE_JPEG, bytes)
}
}