From 3cc982e65b3b6de7ef907540b065bb35163c1c51 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 12 May 2017 16:05:28 -0400 Subject: [PATCH] use mic for voice message snippet // FREEBIE --- src/Messages/Attachments/TSAttachment.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Messages/Attachments/TSAttachment.m b/src/Messages/Attachments/TSAttachment.m index dfcbccbe9..2cd0510fd 100644 --- a/src/Messages/Attachments/TSAttachment.m +++ b/src/Messages/Attachments/TSAttachment.m @@ -106,7 +106,16 @@ NSUInteger const TSAttachmentSchemaVersion = 3; } else if ([MIMETypeUtil isVideo:self.contentType]) { return [NSString stringWithFormat:@"📽 %@", attachmentString]; } else if ([MIMETypeUtil isAudio:self.contentType]) { - return [NSString stringWithFormat:@"📻 %@", attachmentString]; + + // a missing filename is the legacy way to determin if an audio attachment is a voice note vs. other arbitrary + // audio attachments. + if (self.isVoiceMessage || !self.filename || self.filename.length == 0) { + attachmentString = NSLocalizedString(@"ATTACHMENT_TYPE_VOICE_MESSAGE", + @"Short text label for a voice message attachment, used for thread preview and on lockscreen"); + return [NSString stringWithFormat:@"🎤 %@", attachmentString]; + } else { + return [NSString stringWithFormat:@"📻 %@", attachmentString]; + } } else if ([MIMETypeUtil isAnimated:self.contentType]) { return [NSString stringWithFormat:@"🎡 %@", attachmentString]; }