decord/source/actions/UploadAttachmentActionCreators.tsx

85 lines
3.4 KiB
TypeScript
Raw Normal View History

// Module ID: 9436
// Function ID: 9437
// Name: UploadAttachmentActionCreators
// Dependencies: [573, 9437, 2]
2026-07-20 16:05:17 +00:00
// Module 9436 (UploadAttachmentActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
let result = size.fileFinishedImporting("actions/UploadAttachmentActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default {
popFirstFile(channelId) {
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_POP_FILE", channelId });
2026-07-20 16:05:17 +00:00
},
2026-08-25 06:04:03 +00:00
addFiles(draftType) {
({ files, channelId } = draftType);
draftType = draftType.draftType;
if (files.some(channelId(9437).itemNeedsImagePreConversion)) {
2026-08-25 06:04:03 +00:00
function dispatch(files) {
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_ADD_FILES", channelId, files, draftType });
2026-08-25 06:04:03 +00:00
}
Promise.all(files.map(channelId(9437).maybePreConvertImageItem)).then(dispatch);
const allPromises = Promise.all(files.map(channelId(9437).maybePreConvertImageItem));
2026-08-25 06:04:03 +00:00
} else {
const obj2 = { type: "UPLOAD_ATTACHMENT_ADD_FILES", channelId, files, draftType };
draftType(573).dispatch(obj2);
const obj = draftType(573);
2026-08-25 06:04:03 +00:00
}
2026-07-20 16:05:17 +00:00
},
2026-08-25 06:04:03 +00:00
addFile(draftType) {
({ file, channelId } = draftType);
draftType = draftType.draftType;
const allowOptimization = draftType.allowOptimization;
if (obj.itemNeedsImagePreConversion(file)) {
function dispatch(result) {
const obj2 = { type: "UPLOAD_ATTACHMENT_ADD_FILES", channelId, files: null, draftType, allowOptimization };
const items = [result];
obj2.files = items;
DispatcherDefault.dispatch(obj2);
2026-08-25 06:04:03 +00:00
}
const result = channelId(tmp2[1]).maybePreConvertImageItem(file);
2026-08-25 06:04:03 +00:00
result.then(dispatch);
const tmpResult = channelId(tmp2[1]);
} else {
const obj3 = { type: "UPLOAD_ATTACHMENT_ADD_FILES", channelId, files: null, draftType: null, allowOptimization: null };
2026-08-25 06:04:03 +00:00
let items = [file];
obj3.files = items;
obj3.draftType = draftType;
obj3.allowOptimization = allowOptimization;
draftType(tmp2[0]).dispatch(obj3);
let obj2 = draftType(tmp2[0]);
2026-08-25 06:04:03 +00:00
}
2026-07-20 16:05:17 +00:00
},
remove(channelId, id, draftType) {
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_REMOVE_FILE", channelId, id, draftType });
2026-07-20 16:05:17 +00:00
},
removeFiles(channelId, items3, InteractionModal) {
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_REMOVE_FILES", channelId, attachmentIds: items3, draftType: InteractionModal });
2026-07-20 16:05:17 +00:00
},
clearAll(channelId, draftType) {
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_CLEAR_ALL_FILES", channelId, draftType });
2026-07-20 16:05:17 +00:00
},
update(channelId, id, draftType, arg3) {
2026-07-20 16:05:17 +00:00
({ description, filename, spoiler, thumbnail } = arg3);
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_UPDATE_FILE", channelId, id, filename, description, thumbnail, spoiler, draftType });
2026-07-20 16:05:17 +00:00
},
setUploads(uploads) {
uploads = uploads.uploads;
({ channelId, draftType, resetState } = uploads);
const obj2 = { type: "UPLOAD_ATTACHMENT_SET_UPLOADS", channelId, uploads: null, draftType: null };
2026-07-20 16:05:17 +00:00
let mapped = uploads;
if (resetState) {
mapped = uploads.map((resetState) => resetState.resetState());
}
obj2.uploads = mapped;
obj2.draftType = draftType;
DispatcherDefault.dispatch(obj2);
2026-07-20 16:05:17 +00:00
},
setFile(arg0) {
({ file, channelId, id, draftType, allowOptimization } = arg0);
DispatcherDefault.dispatch({ type: "UPLOAD_ATTACHMENT_SET_FILE", channelId, id, file, draftType, allowOptimization });
2026-07-20 16:05:17 +00:00
}
};