Fix sticker-creator preload error
This commit is contained in:
parent
38b921fad7
commit
9582f7508a
4 changed files with 11 additions and 11 deletions
|
@ -13,7 +13,6 @@ import type { Props as DropZoneProps } from '../elements/DropZone';
|
|||
import { DropZone } from '../elements/DropZone';
|
||||
import { processStickerImage } from '../util/preload';
|
||||
import { useI18n } from '../util/i18n';
|
||||
import { ProcessStickerImageError } from '../errors';
|
||||
import { MINUTE } from '../../ts/util/durations';
|
||||
import * as Errors from '../../ts/types/errors';
|
||||
|
||||
|
@ -71,7 +70,7 @@ const InnerGrid = SortableContainer(
|
|||
actions.removeSticker(path);
|
||||
|
||||
const key =
|
||||
e instanceof ProcessStickerImageError
|
||||
e instanceof window.ProcessStickerImageError
|
||||
? e.errorMessageI18nKey
|
||||
: 'StickerCreator--Toasts--errorProcessing';
|
||||
actions.addToast({
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export class ProcessStickerImageError extends Error {
|
||||
constructor(message: string, public readonly errorMessageI18nKey: string) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Metadata } from 'sharp';
|
||||
import type { ProcessStickerImageErrorType } from '../window/phase3-sticker-functions';
|
||||
|
||||
declare global {
|
||||
// We want to extend `window`'s properties, so we need an interface.
|
||||
|
@ -9,6 +10,7 @@ declare global {
|
|||
interface Window {
|
||||
processStickerImage: ProcessStickerImageFn;
|
||||
encryptAndUpload: EncryptAndUploadFn;
|
||||
ProcessStickerImageError: ProcessStickerImageErrorType;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,14 @@ import { initialize as initializeWebAPI } from '../../ts/textsecure/WebAPI';
|
|||
|
||||
import { SignalContext } from '../../ts/windows/context';
|
||||
import { getAnimatedPngDataIfExists } from '../../ts/util/getAnimatedPngDataIfExists';
|
||||
import { ProcessStickerImageError } from '../errors';
|
||||
|
||||
class ProcessStickerImageError extends Error {
|
||||
constructor(message: string, public readonly errorMessageI18nKey: string) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
export type ProcessStickerImageErrorType = typeof ProcessStickerImageError;
|
||||
window.ProcessStickerImageError = ProcessStickerImageError;
|
||||
|
||||
const STICKER_SIZE = 512;
|
||||
const MIN_STICKER_DIMENSION = 10;
|
||||
|
|
Loading…
Reference in a new issue