Skip to content

Commit

Permalink
Flag voice note attachment protos as such
Browse files Browse the repository at this point in the history
// FREEBIE
  • Loading branch information
liliakai committed May 12, 2017
1 parent 6055e9c commit 6c53605
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions js/libtextsecure.js
Expand Up @@ -39055,6 +39055,9 @@ MessageSender.prototype = {
if (attachment.size) {
proto.size = attachment.size;
}
if (attachment.flags) {
proto.flags = attachment.flags;
}
return proto;
});
}.bind(this));
Expand Down
1 change: 1 addition & 0 deletions js/views/conversation_view.js
Expand Up @@ -180,6 +180,7 @@
},
handleAudioCapture: function(blob) {
this.fileInput.file = blob;
this.fileInput.isVoiceNote = true;
this.fileInput.previewImages();
this.$('.bottom-bar form').submit();
},
Expand Down
12 changes: 11 additions & 1 deletion js/views/file_input_view.js
Expand Up @@ -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() {
Expand Down Expand Up @@ -252,6 +261,7 @@
this.$input.unwrap();
this.file = null;
this.$input.trigger('change');
this.isVoiceNote = false;
},

openDropped: function(e) {
Expand Down
3 changes: 3 additions & 0 deletions libtextsecure/sendmessage.js
Expand Up @@ -130,6 +130,9 @@ MessageSender.prototype = {
if (attachment.size) {
proto.size = attachment.size;
}
if (attachment.flags) {
proto.flags = attachment.flags;
}
return proto;
});
}.bind(this));
Expand Down

0 comments on commit 6c53605

Please sign in to comment.