forked from upstream-mirrors/quik
Add vcard to message
This commit is contained in:
@@ -23,22 +23,32 @@ import android.net.Uri
|
||||
import android.os.Build
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat
|
||||
|
||||
data class Attachment(private val uri: Uri? = null, private val inputContent: InputContentInfoCompat? = null) {
|
||||
sealed class Attachment {
|
||||
|
||||
fun getUri(): Uri? {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
inputContent?.contentUri ?: uri
|
||||
} else {
|
||||
uri
|
||||
data class Image(
|
||||
private val uri: Uri? = null,
|
||||
private val inputContent: InputContentInfoCompat? = null
|
||||
) : Attachment() {
|
||||
|
||||
fun getUri(): Uri? {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
inputContent?.contentUri ?: uri
|
||||
} else {
|
||||
uri
|
||||
}
|
||||
}
|
||||
|
||||
fun isGif(context: Context): Boolean {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && inputContent != null) {
|
||||
inputContent.description.hasMimeType("image/gif")
|
||||
} else {
|
||||
context.contentResolver.getType(uri) == "image/gif"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun isGif(context: Context): Boolean {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && inputContent != null) {
|
||||
inputContent.description.hasMimeType("image/gif")
|
||||
} else {
|
||||
context.contentResolver.getType(uri) == "image/gif"
|
||||
}
|
||||
}
|
||||
data class Contact(val vCard: String) : Attachment()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Attachments(attachments: List<Attachment>): List<Attachment> by attachments
|
||||
|
||||
Reference in New Issue
Block a user