Skip to content

Commit

Permalink
Timeline: Handle height change due to pending voice note
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Sep 4, 2019
1 parent 1d3fe4b commit cbde0bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ts/shims/Whisper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 3 additions & 1 deletion ts/state/ducks/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
without,
} from 'lodash';
import { trigger } from '../../shims/events';
import { isVoiceFlag } from '../../shims/Whisper';
import { NoopActionType } from './noop';
import {
AttachmentType,
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions ts/types/Attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface AttachmentType {
url: string;
contentType: MIME.MIMEType;
};
flags?: number;
thumbnail?: {
height: number;
width: number;
Expand Down

0 comments on commit cbde0bb

Please sign in to comment.