Flag voice note attachment protos as such

// FREEBIE
pull/749/head
lilia 8 years ago committed by Lilia
parent 6055e9ce55
commit 6c53605dfd

@ -39055,6 +39055,9 @@ MessageSender.prototype = {
if (attachment.size) { if (attachment.size) {
proto.size = attachment.size; proto.size = attachment.size;
} }
if (attachment.flags) {
proto.flags = attachment.flags;
}
return proto; return proto;
}); });
}.bind(this)); }.bind(this));

@ -180,6 +180,7 @@
}, },
handleAudioCapture: function(blob) { handleAudioCapture: function(blob) {
this.fileInput.file = blob; this.fileInput.file = blob;
this.fileInput.isVoiceNote = true;
this.fileInput.previewImages(); this.fileInput.previewImages();
this.$('.bottom-bar form').submit(); this.$('.bottom-bar form').submit();
}, },

@ -180,7 +180,16 @@
getFile: function(file) { getFile: function(file) {
file = file || this.file || this.$input.prop('files')[0]; file = file || this.file || this.$input.prop('files')[0];
if (file === undefined) { return Promise.resolve(); } if (file === undefined) { return Promise.resolve(); }
return this.autoScale(file).then(this.readFile); var flags;
if (this.isVoiceNote) {
flags = textsecure.protobuf.AttachmentPointer.Flags.VOICE_MESSAGE;
}
return this.autoScale(file).then(this.readFile).then(function(attachment) {
if (flags) {
attachment.flags = flags;
}
return attachment;
}.bind(this));
}, },
getThumbnail: function() { getThumbnail: function() {
@ -252,6 +261,7 @@
this.$input.unwrap(); this.$input.unwrap();
this.file = null; this.file = null;
this.$input.trigger('change'); this.$input.trigger('change');
this.isVoiceNote = false;
}, },
openDropped: function(e) { openDropped: function(e) {

@ -130,6 +130,9 @@ MessageSender.prototype = {
if (attachment.size) { if (attachment.size) {
proto.size = attachment.size; proto.size = attachment.size;
} }
if (attachment.flags) {
proto.flags = attachment.flags;
}
return proto; return proto;
}); });
}.bind(this)); }.bind(this));

Loading…
Cancel
Save