From ae64189aa4805dcead5ad9c17cd7672f474042b5 Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Mon, 9 Sep 2024 11:09:17 +1000 Subject: [PATCH] Differentiating between voice notes and regular audio --- .../securesms/conversation/v2/messages/QuoteView.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt index db6962151c..dc6b05b444 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt @@ -106,7 +106,16 @@ class QuoteView @JvmOverloads constructor(context: Context, attrs: AttributeSet? attachments.audioSlide != null -> { binding.quoteViewAttachmentPreviewImageView.setImageResource(R.drawable.ic_microphone) binding.quoteViewAttachmentPreviewImageView.isVisible = true - binding.quoteViewBodyTextView.text = resources.getString(R.string.messageVoice) + // A missing file name is the legacy way to determine if an audio attachment is + // a voice note vs. other arbitrary audio attachments. + val attachment = attachments.asAttachments().firstOrNull() + val isVoiceNote = attachment?.isVoiceNote == true || + attachment != null && attachment.fileName.isNullOrEmpty() + binding.quoteViewBodyTextView.text = if (isVoiceNote) { + resources.getString(R.string.messageVoice) + } else { + resources.getString(R.string.audio) + } } attachments.documentSlide != null -> { binding.quoteViewAttachmentPreviewImageView.setImageResource(R.drawable.ic_document_large_light)