Allow saving of attachments from media gallery lightbox
This commit is contained in:
parent
b74b761255
commit
b86f9c0be8
1 changed files with 9 additions and 4 deletions
|
@ -592,13 +592,17 @@
|
||||||
.loadWithObjectURL(Signal.Migrations.loadMessage);
|
.loadWithObjectURL(Signal.Migrations.loadMessage);
|
||||||
const media = await loadMessages(rawMedia);
|
const media = await loadMessages(rawMedia);
|
||||||
|
|
||||||
|
const saveAttachment = async ({ message } = {}) => {
|
||||||
|
const loadedMessage = await Signal.Migrations.loadMessage(message);
|
||||||
|
const attachment = loadedMessage.attachments[0];
|
||||||
|
const timestamp = loadedMessage.received_at;
|
||||||
|
Signal.Types.AttachmentTS.save({ attachment, timestamp });
|
||||||
|
};
|
||||||
|
|
||||||
const onItemClick = async ({ message, type }) => {
|
const onItemClick = async ({ message, type }) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'documents': {
|
case 'documents': {
|
||||||
const loadedMessage = await Signal.Migrations.loadMessage(message);
|
saveAttachment({ message });
|
||||||
const attachment = loadedMessage.attachments[0];
|
|
||||||
const timestamp = loadedMessage.received_at;
|
|
||||||
Signal.Types.AttachmentTS.save({ attachment, timestamp });
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,6 +611,7 @@
|
||||||
Component: Signal.Components.Lightbox,
|
Component: Signal.Components.Lightbox,
|
||||||
props: {
|
props: {
|
||||||
imageURL: message.objectURL,
|
imageURL: message.objectURL,
|
||||||
|
onSave: () => saveAttachment({ message }),
|
||||||
},
|
},
|
||||||
onClose: () => Signal.Backbone.Views.Lightbox.hide(),
|
onClose: () => Signal.Backbone.Views.Lightbox.hide(),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue