snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
77
react/features/file-sharing/actions.ts
Normal file
77
react/features/file-sharing/actions.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import {
|
||||
ADD_FILE,
|
||||
DOWNLOAD_FILE,
|
||||
REMOVE_FILE,
|
||||
UPDATE_FILE_UPLOAD_PROGRESS,
|
||||
UPLOAD_FILES
|
||||
} from './actionTypes';
|
||||
import { IFileMetadata } from './types';
|
||||
|
||||
/**
|
||||
* Upload files.
|
||||
*
|
||||
* @param {File[]} files - The files to upload.
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function uploadFiles(files: File[]) {
|
||||
return {
|
||||
type: UPLOAD_FILES,
|
||||
files
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a file's upload progress.
|
||||
*
|
||||
* @param {string} fileId - The ID of the file to update.
|
||||
* @param {number} progress - The new progress value.
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function updateFileProgress(fileId: string, progress: number) {
|
||||
return {
|
||||
type: UPDATE_FILE_UPLOAD_PROGRESS,
|
||||
fileId,
|
||||
progress
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file.
|
||||
*
|
||||
* @param {IFileMetadata} file - The file to add to the state.
|
||||
* @param {boolean} shouldIncrementUnread - Whether to increment the unread count.
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function addFile(file: IFileMetadata, shouldIncrementUnread = false) {
|
||||
return {
|
||||
type: ADD_FILE,
|
||||
file,
|
||||
shouldIncrementUnread
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a file from the backend.
|
||||
*
|
||||
* @param {string} fileId - The ID of the file to remove.
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function removeFile(fileId: string) {
|
||||
return {
|
||||
type: REMOVE_FILE,
|
||||
fileId
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a file.
|
||||
*
|
||||
* @param {string} fileId - The ID of the file to download.
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function downloadFile(fileId: string) {
|
||||
return {
|
||||
type: DOWNLOAD_FILE,
|
||||
fileId
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user