mattermost-mobile/types/api/files.d.ts
Felipe Martin 9793383832
feat: support fillewillbedownloaded and sendtoastmessage pluginapi (#9416)
* Handle FileWillBeDownloaded plugin hook rejections

- Add WebSocket handler for file_download_rejected events
- Show rejected files as file cards instead of broken thumbnails
- Display plugin rejection message in snackbar
- Store rejection reason in EphemeralStore for later retrieval
- Re-render file components when rejection events arrive
- Remove blurred preview to prevent visual blink on rejection

* chore: lint

* chore: lint and test

* fix: removed event from useEffect
2026-02-16 17:10:25 +01:00

53 lines
1.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
type FileDownloadType = 'file' | 'thumbnail' | 'preview' | 'public';
type FileDownloadRejectedEvent = {
file_id: string;
file_name: string;
rejection_reason: string;
channel_id: string;
post_id: string;
download_type: FileDownloadType;
};
type FileInfo = {
id?: string;
bytesRead?: number;
channel_id?: string;
clientId?: string;
create_at?: number;
delete_at?: number;
extension: string;
failed?: boolean;
has_preview_image: boolean;
height: number;
localPath?: string;
mime_type: string;
mini_preview?: string;
name: string;
post_id?: string;
size: number;
update_at?: number;
uri?: string;
user_id: string;
width: number;
postProps?: Record<string, unknown>;
};
type FilesState = {
files: Dictionary<FileInfo>;
fileIdsByPostId: Dictionary<string[]>;
filePublicLink?: string;
};
type FileUploadResponse = {
file_infos: FileInfo[];
client_ids: string[];
};
type FileSearchParams = {
terms: string;
is_or_search: boolean;
};