Add support for attachment file names
Send, receive, and save attachment filenames. Use them as suggested names when saving files. // FREEBIE
This commit is contained in:
parent
a256f17e19
commit
fc514aa96f
5 changed files with 18 additions and 2 deletions
|
@ -39049,6 +39049,9 @@ MessageSender.prototype = {
|
||||||
proto.id = id;
|
proto.id = id;
|
||||||
proto.contentType = attachment.contentType;
|
proto.contentType = attachment.contentType;
|
||||||
proto.digest = result.digest;
|
proto.digest = result.digest;
|
||||||
|
if (attachment.fileName) {
|
||||||
|
proto.fileName = attachment.fileName;
|
||||||
|
}
|
||||||
return proto;
|
return proto;
|
||||||
});
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
|
@ -91,6 +91,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
suggestedName: function() {
|
suggestedName: function() {
|
||||||
|
if (this.model.fileName) {
|
||||||
|
return this.model.fileName;
|
||||||
|
}
|
||||||
|
|
||||||
var suggestion = 'signal';
|
var suggestion = 'signal';
|
||||||
if (this.timestamp) {
|
if (this.timestamp) {
|
||||||
suggestion += moment(this.timestamp).format('-YYYY-MM-DD-HHmmss');
|
suggestion += moment(this.timestamp).format('-YYYY-MM-DD-HHmmss');
|
||||||
|
|
|
@ -223,12 +223,17 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
readFile: function(file) {
|
readFile: function(file) {
|
||||||
var contentType = file.type;
|
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var FR = new FileReader();
|
var FR = new FileReader();
|
||||||
FR.onload = function(e) {
|
FR.onload = function(e) {
|
||||||
resolve({data: e.target.result, contentType: contentType});
|
resolve({
|
||||||
|
data: e.target.result,
|
||||||
|
contentType: file.type,
|
||||||
|
fileName: file.name
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
FR.onerror = reject;
|
||||||
|
FR.onabort = reject;
|
||||||
FR.readAsArrayBuffer(file);
|
FR.readAsArrayBuffer(file);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -124,6 +124,9 @@ MessageSender.prototype = {
|
||||||
proto.id = id;
|
proto.id = id;
|
||||||
proto.contentType = attachment.contentType;
|
proto.contentType = attachment.contentType;
|
||||||
proto.digest = result.digest;
|
proto.digest = result.digest;
|
||||||
|
if (attachment.fileName) {
|
||||||
|
proto.fileName = attachment.fileName;
|
||||||
|
}
|
||||||
return proto;
|
return proto;
|
||||||
});
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
|
@ -123,6 +123,7 @@ message AttachmentPointer {
|
||||||
optional uint32 size = 4;
|
optional uint32 size = 4;
|
||||||
optional bytes thumbnail = 5;
|
optional bytes thumbnail = 5;
|
||||||
optional bytes digest = 6;
|
optional bytes digest = 6;
|
||||||
|
optional string fileName = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GroupContext {
|
message GroupContext {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue