Add AttachmentBatch for future removal of sendAttachmentsMixin

This commit is contained in:
N-Pex 2025-06-11 14:59:34 +02:00
parent 1d30d0633d
commit fd82fd8840
5 changed files with 377 additions and 231 deletions

View file

@ -1,3 +1,5 @@
import { ComputedRef, Ref } from "vue";
export class UploadPromise<Type> {
wrappedPromise: Promise<Type>;
aborted: boolean = false;
@ -49,3 +51,19 @@ export type Attachment = {
proof?: any;
sendInfo?: AttachmentSendInfo;
};
export type AttachmentBatch = {
sendingStatus: Ref<"initial" | "sending" | "sent" | "canceled" | "failed">;
sendingRootEventId: Ref<string | undefined>;
sendingPromise: Ref<Promise<any> | undefined>;
attachments: Ref<Attachment[]>;
attachmentsSentCount: ComputedRef<number>;
attachmentsSending: ComputedRef<Attachment[]>;
attachmentsSent: ComputedRef<Attachment[]>;
addAttachment: (attachment: Attachment) => void;
removeAttachment: (attachment: Attachment) => void;
send: (message: string) => Promise<any>;
cancel: () => void;
cancelSendAttachment: (attachment: Attachment) => void;
};