Receive support for View Once photos

This commit is contained in:
Scott Nonnenberg
2019-06-26 12:33:13 -07:00
parent fccf1eec30
commit e62a1a7812
38 changed files with 1937 additions and 102 deletions

View File

@@ -1110,11 +1110,19 @@ MessageReceiver.prototype.extend({
return this.handleVerified(envelope, syncMessage.verified);
} else if (syncMessage.configuration) {
return this.handleConfiguration(envelope, syncMessage.configuration);
} else if (syncMessage.stickerPackOperation) {
} else if (
syncMessage.stickerPackOperation &&
syncMessage.stickerPackOperation.length > 0
) {
return this.handleStickerPackOperation(
envelope,
syncMessage.stickerPackOperation
);
} else if (syncMessage.messageTimerRead) {
return this.handleMessageTimerRead(
envelope,
syncMessage.messageTimerRead
);
}
throw new Error('Got empty SyncMessage');
},
@@ -1125,6 +1133,17 @@ MessageReceiver.prototype.extend({
ev.configuration = configuration;
return this.dispatchAndWait(ev);
},
handleMessageTimerRead(envelope, sync) {
window.log.info('got message timer read sync message');
const ev = new Event('viewSync');
ev.confirm = this.removeFromCache.bind(this, envelope);
ev.source = sync.sender;
ev.timestamp = sync.timestamp ? sync.timestamp.toNumber() : null;
ev.viewedAt = envelope.timestamp;
return this.dispatchAndWait(ev);
},
handleStickerPackOperation(envelope, operations) {
const ENUM = textsecure.protobuf.SyncMessage.StickerPackOperation.Type;
window.log.info('got sticker pack operation sync message');