Timeline: Handle height change due to pending voice note

This commit is contained in:
Scott Nonnenberg 2019-09-04 11:32:08 -07:00
parent 1d3fe4bbf3
commit cbde0bb3d1
3 changed files with 13 additions and 1 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -38,6 +38,7 @@ export interface AttachmentType {
url: string;
contentType: MIME.MIMEType;
};
flags?: number;
thumbnail?: {
height: number;
width: number;