Convert vCard attachments to Shared Contacts.

When you share a vCard from an external app (like the Contacts app) into
Signal, we'll now convert it to a pretty Shared Contact message and
allow you to choose which fields of the contact you wish to send.
This commit is contained in:
Greyson Parrelli
2018-05-16 23:40:14 -07:00
parent e6c16cf28d
commit ca260a92e3
8 changed files with 161 additions and 27 deletions

View File

@@ -44,6 +44,7 @@ public class MediaUtil {
public static final String AUDIO_AAC = "audio/aac";
public static final String AUDIO_UNSPECIFIED = "audio/*";
public static final String VIDEO_UNSPECIFIED = "video/*";
public static final String VCARD = "text/x-vcard";
public static Slide getSlideForAttachment(Context context, Attachment attachment) {
@@ -196,6 +197,10 @@ public class MediaUtil {
return !TextUtils.isEmpty(contentType) && contentType.trim().startsWith("video/");
}
public static boolean isVcard(String contentType) {
return !TextUtils.isEmpty(contentType) && contentType.trim().equals(VCARD);
}
public static boolean isGif(String contentType) {
return !TextUtils.isEmpty(contentType) && contentType.trim().equals("image/gif");
}