diff --git a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java index d614b412f7..41903ae23e 100644 --- a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -620,13 +620,18 @@ public class ThreadDatabase extends Database { private @NonNull String getFormattedBodyFor(@NonNull MessageRecord messageRecord) { if (messageRecord.isMms()) { MmsMessageRecord record = (MmsMessageRecord) messageRecord; - if (record.getSlideDeck().getBody()) if (record.getSharedContacts().size() > 0) { Contact contact = ((MmsMessageRecord) messageRecord).getSharedContacts().get(0); return ContactUtil.getStringSummary(context, contact).toString(); } + String attachmentString = record.getSlideDeck().getBody(); + if (!attachmentString.isEmpty()) { + if (!messageRecord.getBody().isEmpty()) { + attachmentString = attachmentString + ": " + messageRecord.getBody(); + } + return attachmentString; + } } - return messageRecord.getBody(); } diff --git a/src/org/thoughtcrime/securesms/mms/OutgoingMediaMessage.java b/src/org/thoughtcrime/securesms/mms/OutgoingMediaMessage.java index 6a73726448..cb5252a657 100644 --- a/src/org/thoughtcrime/securesms/mms/OutgoingMediaMessage.java +++ b/src/org/thoughtcrime/securesms/mms/OutgoingMediaMessage.java @@ -146,13 +146,10 @@ public class OutgoingMediaMessage { } private static String buildMessage(SlideDeck slideDeck, String message) { - if (!TextUtils.isEmpty(message) && !TextUtils.isEmpty(slideDeck.getBody())) { - return slideDeck.getBody() + "\n\n" + message; - } else if (!TextUtils.isEmpty(message)) { + if (!TextUtils.isEmpty(message)) { return message; - } else { - return slideDeck.getBody(); } + return ""; } } diff --git a/src/org/thoughtcrime/securesms/mms/Slide.java b/src/org/thoughtcrime/securesms/mms/Slide.java index bd3838c4aa..fe9a7a9b77 100644 --- a/src/org/thoughtcrime/securesms/mms/Slide.java +++ b/src/org/thoughtcrime/securesms/mms/Slide.java @@ -22,8 +22,6 @@ import android.net.Uri; import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.google.android.exoplayer2.util.MimeTypes; - import org.thoughtcrime.securesms.attachments.Attachment; import org.thoughtcrime.securesms.attachments.UriAttachment; import org.thoughtcrime.securesms.database.AttachmentDatabase; @@ -64,7 +62,7 @@ public abstract class Slide { public Optional getBody() { String attachmentString = context.getString(R.string.attachment); - if (MimeTypes.isAudio(attachment.getContentType())) { + if (MediaUtil.isAudio(attachment)) { // a missing filename is the legacy way to determine if an audio attachment is // a voice note vs. other arbitrary audio attachments. if (attachment.isVoiceNote() || !attachment.getFileName().isEmpty()) { @@ -72,20 +70,20 @@ public abstract class Slide { return Optional.fromNullable("🎤 " + attachmentString); } } - return Optional.fromNullable(emojiForMimeType(attachment.getContentType()) + attachmentString); + return Optional.fromNullable(emojiForMimeType() + attachmentString); } - private String emojiForMimeType(String contentType) { - if (MimeTypes.isVideo(contentType)) { + private String emojiForMimeType() { + if (MediaUtil.isImage(attachment)) { return "📷 "; - } else if (MimeTypes.isVideo(contentType)) { + } else if (MediaUtil.isVideo(attachment)) { return "🎥 "; - } else if (MimeTypes.isAudio(contentType)) { + } else if (MediaUtil.isAudio(attachment)) { return "🎧 "; - } else if (MimeTypes.is) { - return "🎡 "; - } else { + } else if (MediaUtil.isFile(attachment)) { return "📎 "; + } else { + return "🎡 "; } }