Sync my stories with primary device
This commit is contained in:
parent
7554d8326a
commit
9155784d56
67 changed files with 2954 additions and 1238 deletions
32
ts/util/saveAttachment.ts
Normal file
32
ts/util/saveAttachment.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { AttachmentType } from '../types/Attachment';
|
||||
import * as Attachment from '../types/Attachment';
|
||||
import { showToast } from './showToast';
|
||||
import { ToastFileSaved } from '../components/ToastFileSaved';
|
||||
|
||||
export async function saveAttachment(
|
||||
attachment: AttachmentType,
|
||||
timestamp = Date.now(),
|
||||
index = 0
|
||||
): Promise<void> {
|
||||
const { openFileInFolder, readAttachmentData, saveAttachmentToDisk } =
|
||||
window.Signal.Migrations;
|
||||
|
||||
const fullPath = await Attachment.save({
|
||||
attachment,
|
||||
index: index + 1,
|
||||
readAttachmentData,
|
||||
saveAttachmentToDisk,
|
||||
timestamp,
|
||||
});
|
||||
|
||||
if (fullPath) {
|
||||
showToast(ToastFileSaved, {
|
||||
onOpenFile: () => {
|
||||
openFileInFolder(fullPath);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue