signal-desktop/sticker-creator/util/preload.ts

36 lines
1 KiB
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2019 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import type {
ProcessStickerImageErrorType,
StickerImageData,
} from '../window/phase3-sticker-functions';
declare global {
// We want to extend `window`'s properties, so we need an interface.
// eslint-disable-next-line no-restricted-syntax
interface Window {
2020-09-28 18:40:26 +00:00
processStickerImage: ProcessStickerImageFn;
encryptAndUpload: EncryptAndUploadFn;
2022-12-01 01:44:17 +00:00
ProcessStickerImageError: ProcessStickerImageErrorType;
}
}
export { StickerImageData };
2019-12-17 20:25:57 +00:00
type ProcessStickerImageFn = (
path: string | undefined
) => Promise<StickerImageData>;
2019-12-17 20:25:57 +00:00
2020-09-28 18:40:26 +00:00
export type StickerData = { imageData?: StickerImageData; emoji?: string };
2019-12-17 20:25:57 +00:00
export type PackMetaData = { packId: string; key: string };
export type EncryptAndUploadFn = (
manifest: { title: string; author: string },
stickers: Array<StickerData>,
cover: StickerImageData,
2019-12-17 20:25:57 +00:00
onProgress?: () => unknown
) => Promise<PackMetaData>;
2020-09-28 18:40:26 +00:00
export const { encryptAndUpload, processStickerImage } = window;