Skip to content

Commit cbde0bb

Browse files
Timeline: Handle height change due to pending voice note
1 parent 1d3fe4b commit cbde0bb

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

ts/shims/Whisper.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ export function getBubbleProps(attributes: any) {
1111

1212
return model.getPropsForBubble();
1313
}
14+
15+
export function isVoiceFlag(flags: any): boolean {
16+
// @ts-ignore
17+
const protoFlags = window.textsecure.protobuf.AttachmentPointer.Flags;
18+
const VOICE_MESSAGE_FLAG = protoFlags.VOICE_MESSAGE;
19+
20+
// tslint:disable-next-line no-bitwise
21+
return Boolean(flags && flags & VOICE_MESSAGE_FLAG);
22+
}

ts/state/ducks/conversations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
without,
1111
} from 'lodash';
1212
import { trigger } from '../../shims/events';
13+
import { isVoiceFlag } from '../../shims/Whisper';
1314
import { NoopActionType } from './noop';
1415
import {
1516
AttachmentType,
@@ -541,7 +542,8 @@ function hasMessageHeightChanged(
541542
previousAttachments[0].pending &&
542543
messageAttachments[0] &&
543544
(isImageAttachment(messageAttachments[0]) ||
544-
isVideoAttachment(messageAttachments[0])) &&
545+
isVideoAttachment(messageAttachments[0]) ||
546+
isVoiceFlag(messageAttachments[0].flags)) &&
545547
!messageAttachments[0].pending;
546548
if (singleVisualAttachmentNoLongerPending) {
547549
return true;

ts/types/Attachment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface AttachmentType {
3838
url: string;
3939
contentType: MIME.MIMEType;
4040
};
41+
flags?: number;
4142
thumbnail?: {
4243
height: number;
4344
width: number;

0 commit comments

Comments
 (0)