Support for receiving View Once Video

This commit is contained in:
Scott Nonnenberg 2019-10-03 12:03:46 -07:00
parent 9229824c24
commit 5c00b89600
9 changed files with 156 additions and 48 deletions

View file

@ -36,6 +36,8 @@
savePackMetadata,
getStickerPackStatus,
} = window.Signal.Stickers;
const { GoogleChrome } = window.Signal.Util;
const { addStickerPackReference } = window.Signal.Data;
const { bytesFromString } = window.Signal.Crypto;
@ -726,7 +728,23 @@
return i18n('message--getDescription--unsupported-message');
}
if (this.isTapToView()) {
return i18n('message--getDescription--disappearing-photo');
if (this.isErased()) {
return i18n('mediaMessage');
}
const attachments = this.get('attachments');
if (!attachments || !attachments[0]) {
return i18n('mediaMessage');
}
const { contentType } = attachments[0];
if (GoogleChrome.isImageTypeSupported(contentType)) {
return i18n('message--getDescription--disappearing-photo');
} else if (GoogleChrome.isVideoTypeSupported(contentType)) {
return i18n('message--getDescription--disappearing-video');
}
return i18n('mediaMessage');
}
if (this.isGroupUpdate()) {
const groupUpdate = this.get('group_update');
@ -874,11 +892,7 @@
}
const firstAttachment = attachments[0];
if (
!window.Signal.Util.GoogleChrome.isImageTypeSupported(
firstAttachment.contentType
)
) {
if (!GoogleChrome.isImageTypeSupported(firstAttachment.contentType)) {
return false;
}
@ -1722,12 +1736,8 @@
if (
!firstAttachment ||
(!window.Signal.Util.GoogleChrome.isImageTypeSupported(
firstAttachment.contentType
) &&
!window.Signal.Util.GoogleChrome.isVideoTypeSupported(
firstAttachment.contentType
))
(!GoogleChrome.isImageTypeSupported(firstAttachment.contentType) &&
!GoogleChrome.isVideoTypeSupported(firstAttachment.contentType))
) {
return message;
}