diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 497ee311f..2613b6352 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -39055,6 +39055,9 @@ MessageSender.prototype = { if (attachment.size) { proto.size = attachment.size; } + if (attachment.flags) { + proto.flags = attachment.flags; + } return proto; }); }.bind(this)); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index b19c9a0c2..69919a3b3 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -180,6 +180,7 @@ }, handleAudioCapture: function(blob) { this.fileInput.file = blob; + this.fileInput.isVoiceNote = true; this.fileInput.previewImages(); this.$('.bottom-bar form').submit(); }, diff --git a/js/views/file_input_view.js b/js/views/file_input_view.js index 881193133..52db8367a 100644 --- a/js/views/file_input_view.js +++ b/js/views/file_input_view.js @@ -180,7 +180,16 @@ getFile: function(file) { file = file || this.file || this.$input.prop('files')[0]; 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() { @@ -252,6 +261,7 @@ this.$input.unwrap(); this.file = null; this.$input.trigger('change'); + this.isVoiceNote = false; }, openDropped: function(e) { diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index 956c6b454..9e85c9ba0 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -130,6 +130,9 @@ MessageSender.prototype = { if (attachment.size) { proto.size = attachment.size; } + if (attachment.flags) { + proto.flags = attachment.flags; + } return proto; }); }.bind(this));