decord/source/modules/media_channel/native/useSetMediaPostThumbnail.tsx

82 lines
2.4 KiB
TypeScript
Raw Normal View History

// Module ID: 11382
// Function ID: 11383
2026-07-20 16:05:17 +00:00
// Name: useSetMediaPostThumbnail
// Dependencies: [19, 4979, 4978, 563, 5213, 9450, 4605, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 11382 (useSetMediaPostThumbnail)
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4605 */;
import UploadAttachmentActionCreatorsDefault from "UploadAttachmentActionCreators" /* 9450 */;
import noop from "module_19" /* 19 */;
import UploadAttachmentStore from "UploadAttachmentStore" /* 4978 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const require = fn;
const DraftType = fn(4979).DraftType;
const size = fn(2);
const result = size.fileFinishedImporting("modules/media_channel/native/useSetMediaPostThumbnail.tsx");
2026-07-20 16:05:17 +00:00
export default function useSetMediaPostThumbnail(arg0, arg1) {
_require = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
const items = [UploadAttachmentStore];
stateFromStores = require("useStateFromStores").useStateFromStores(items, () => {
const uploads = UploadAttachmentStore.getUploads(closure_0, DraftType.ChannelMessage);
2026-07-29 08:29:29 +00:00
let found = uploads.find((item) => {
2026-07-20 16:05:17 +00:00
let platform;
2026-07-29 08:29:29 +00:00
if (item != null) {
2026-07-20 16:05:17 +00:00
item = item.item;
2026-07-29 08:29:29 +00:00
if (item != null) {
2026-07-20 16:05:17 +00:00
platform = item.platform;
}
}
let tmp2 = platform === closure_1_0(stateFromStores[4]).UploadPlatform.REACT_NATIVE;
2026-07-20 16:05:17 +00:00
if (tmp2) {
tmp2 = true === item.isThumbnail;
}
return tmp2;
});
2026-07-29 08:29:29 +00:00
if (found == null) {
found = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return found;
2026-07-20 16:05:17 +00:00
});
const items1 = [stateFromStores, arg0, arg1];
return noop.useCallback(() => {
2026-07-20 16:05:17 +00:00
let id;
if (closure_1 != null) {
2026-07-29 08:29:29 +00:00
id = tmp.id;
2026-07-20 16:05:17 +00:00
}
if (null != id) {
2026-07-29 08:29:29 +00:00
let tmp4 = null != stateFromStores;
if (tmp4) {
2026-07-20 16:05:17 +00:00
let id1;
2026-07-29 08:29:29 +00:00
if (tmp != null) {
id1 = tmp.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = tmp24.id !== id1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp4) {
const obj = UploadAttachmentActionCreatorsDefault;
obj.update(closure_0, tmp24.id, DraftType.ChannelMessage, { thumbnail: false });
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let flag;
if (tmp != null) {
flag = tmp.isThumbnail;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag == null) {
flag = false;
}
const obj2 = UploadAttachmentActionCreatorsDefault;
2026-07-20 16:05:17 +00:00
let id2;
2026-07-29 08:29:29 +00:00
if (tmp != null) {
id2 = tmp.id;
2026-07-20 16:05:17 +00:00
}
const obj3 = { thumbnail: !flag, spoiler: false };
obj2.update(closure_0, id2, DraftType.ChannelMessage, obj3);
ActionSheetActionCreatorsDefault.hideActionSheet();
2026-07-20 16:05:17 +00:00
}
}, items1);
};