diff --git a/ts/shims/Whisper.ts b/ts/shims/Whisper.ts index 4d4a45f402..4250180b76 100644 --- a/ts/shims/Whisper.ts +++ b/ts/shims/Whisper.ts @@ -11,3 +11,12 @@ export function getBubbleProps(attributes: any) { return model.getPropsForBubble(); } + +export function isVoiceFlag(flags: any): boolean { + // @ts-ignore + const protoFlags = window.textsecure.protobuf.AttachmentPointer.Flags; + const VOICE_MESSAGE_FLAG = protoFlags.VOICE_MESSAGE; + + // tslint:disable-next-line no-bitwise + return Boolean(flags && flags & VOICE_MESSAGE_FLAG); +} diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index 6a672551e5..0259f0a2e5 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -10,6 +10,7 @@ import { without, } from 'lodash'; import { trigger } from '../../shims/events'; +import { isVoiceFlag } from '../../shims/Whisper'; import { NoopActionType } from './noop'; import { AttachmentType, @@ -541,7 +542,8 @@ function hasMessageHeightChanged( previousAttachments[0].pending && messageAttachments[0] && (isImageAttachment(messageAttachments[0]) || - isVideoAttachment(messageAttachments[0])) && + isVideoAttachment(messageAttachments[0]) || + isVoiceFlag(messageAttachments[0].flags)) && !messageAttachments[0].pending; if (singleVisualAttachmentNoLongerPending) { return true; diff --git a/ts/types/Attachment.ts b/ts/types/Attachment.ts index cffe1a7391..b8eb2c5476 100644 --- a/ts/types/Attachment.ts +++ b/ts/types/Attachment.ts @@ -38,6 +38,7 @@ export interface AttachmentType { url: string; contentType: MIME.MIMEType; }; + flags?: number; thumbnail?: { height: number; width: number;