Allow stage and send of video, even if we can't get screenshot
This commit is contained in:
parent
117cb074c7
commit
a024ee4b96
21 changed files with 224 additions and 143 deletions
|
@ -2,28 +2,32 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { omit } from 'lodash';
|
||||
import type { AttachmentType } from '../types/Attachment';
|
||||
import type {
|
||||
InMemoryAttachmentDraftType,
|
||||
AttachmentDraftType,
|
||||
} from '../types/Attachment';
|
||||
|
||||
export async function writeDraftAttachment(
|
||||
attachment: AttachmentType
|
||||
): Promise<AttachmentType> {
|
||||
attachment: InMemoryAttachmentDraftType
|
||||
): Promise<AttachmentDraftType> {
|
||||
if (attachment.pending) {
|
||||
throw new Error('writeDraftAttachment: Cannot write pending attachment');
|
||||
}
|
||||
|
||||
const result: AttachmentType = {
|
||||
const path = await window.Signal.Migrations.writeNewDraftData(
|
||||
attachment.data
|
||||
);
|
||||
|
||||
const screenshotPath = attachment.screenshotData
|
||||
? await window.Signal.Migrations.writeNewDraftData(
|
||||
attachment.screenshotData
|
||||
)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
...omit(attachment, ['data', 'screenshotData']),
|
||||
path,
|
||||
screenshotPath,
|
||||
pending: false,
|
||||
};
|
||||
if (attachment.data) {
|
||||
result.path = await window.Signal.Migrations.writeNewDraftData(
|
||||
attachment.data
|
||||
);
|
||||
}
|
||||
if (attachment.screenshotData) {
|
||||
result.screenshotPath = await window.Signal.Migrations.writeNewDraftData(
|
||||
attachment.screenshotData
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue