Move writeAttachmentData
into Attachments
Encapsulates all attachment operations that require Node.js / Electron APIs, e.g. file system access.
This commit is contained in:
parent
19a70ad8b8
commit
1c8123ff1a
5 changed files with 143 additions and 98 deletions
|
@ -108,6 +108,10 @@
|
|||
window.autoOrientImage = autoOrientImage;
|
||||
|
||||
// ES2015+ modules
|
||||
const attachmentsPath = Attachments.getPath(app.getPath('userData'));
|
||||
const readAttachmentData = Attachments.readData(attachmentsPath);
|
||||
const writeAttachmentData = Attachments.writeData(attachmentsPath);
|
||||
|
||||
window.Signal = window.Signal || {};
|
||||
window.Signal.Logs = require('./js/modules/logs');
|
||||
window.Signal.OS = require('./js/modules/os');
|
||||
|
@ -115,11 +119,10 @@
|
|||
window.Signal.Crypto = require('./js/modules/crypto');
|
||||
|
||||
window.Signal.Migrations = window.Signal.Migrations || {};
|
||||
const attachmentsPath = Attachments.getPath(app.getPath('userData'));
|
||||
const { writeAttachmentData } = require('./app/types/attachment/write_attachment_data');
|
||||
// Injected context functions to keep `Message` agnostic from Electron:
|
||||
window.Signal.Migrations.context = {
|
||||
writeAttachmentData: writeAttachmentData(attachmentsPath),
|
||||
readAttachmentData,
|
||||
writeAttachmentData,
|
||||
};
|
||||
window.Signal.Migrations.V17 = require('./js/modules/migrations/17');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue