decord/beta/source/modules/share/native/ShareScreenModal.tsx

261 lines
7.8 KiB
TypeScript
Raw Normal View History

// Module ID: 13443
// Function ID: 13444
// Name: ShareScreenModal
// Dependencies: [5, 32, 19, 2045, 13396, 21, 3, 5039, 7810, 504, 4849, 1095, 13444, 2]
// Exports: default
// Module 13443 (ShareScreenModal)
import LoggerDefault from "Logger" /* 3 */;
2026-10-01 14:13:23 +00:00
import Fragment from "Fragment" /* 21 */;
import ChannelTypes from "ChannelTypes" /* 1095 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 5039 */;
2026-10-01 14:13:23 +00:00
import ShareScreenConstants from "ShareScreenConstants" /* 13396 */;
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
import _slicedToArray from "_slicedToArray" /* 32 */;
import react_mod from "react" /* 19 */;
import ChannelStore from "ChannelStore" /* 2045 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
let c4, c5, closure_2;
function onClose() {
2026-10-01 14:13:23 +00:00
const obj = ModalActionCreatorsDefault;
obj.popWithKey(SHARE_SCREEN_MODAL_KEY);
}
2026-10-01 14:13:23 +00:00
let react = react_mod;
const SHARE_SCREEN_MODAL_KEY = ShareScreenConstants.SHARE_SCREEN_MODAL_KEY;
const jsx = Fragment.jsx;
let closure_9 = new LoggerDefault("ShareScreenModal");
2026-10-01 14:13:23 +00:00
const tmp2 = new LoggerDefault("ShareScreenModal");
const result = size.fileFinishedImporting("modules/share/native/ShareScreenModal.tsx");
export default function ShareScreenModal(text) {
2026-10-01 14:13:23 +00:00
let closure_5;
text = text.text;
require = text;
const channelId = text.channelId;
const shareId = text.shareId;
const attachmentManifest = text.attachmentManifest;
let first;
2026-10-01 14:13:23 +00:00
react = undefined;
let stateFromStores;
2026-10-01 14:13:23 +00:00
let obj = react;
let tmp = first(react.useState(null), 2);
first = tmp[0];
2026-10-01 14:13:23 +00:00
react = tmp[1];
let items = [shareId, attachmentManifest];
2026-10-01 14:13:23 +00:00
const effect = react.useEffect(() => {
function fetchAttachments() {
return obj(...arguments);
}
let obj = function _fetchAttachments() {
let logger;
obj = _asyncToGenerator(async (arg0, value) => {
let obj2;
let v3;
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj3 = { value, done: true };
return obj3;
} else {
return { value: "HermesInternal", done: null };
}
} else {
2026-10-01 14:13:23 +00:00
try {
let closure_1;
let closure_0;
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
closure_1 = tmp;
closure_0 = undefined;
if (undefined !== closure_2) {
if (undefined !== c3) {
c3 = 1;
c4 = 2;
c5 = 1;
const obj5 = { value: obj2.sharedAttachments(tmp17, tmp18), done: false };
obj2 = channelId(shareId[8]);
return obj5;
}
}
}
2026-10-01 14:13:23 +00:00
} else if (1 === c4) {
c3 = 0;
2026-10-01 14:13:23 +00:00
closure_1 = closure_2;
logger.error("Error fetching attachments:", closure_1);
} else if (arg0 === 1) {
2026-10-01 14:13:23 +00:00
c5 = 3;
throw value;
2026-10-01 14:13:23 +00:00
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
obj = { value, done: true };
return obj;
} else {
closure_0 = value;
c5(closure_0);
c3 = 0;
}
2026-10-01 14:13:23 +00:00
c5 = 3;
return { value: "HermesInternal", done: null };
} catch (tmp21) {
closure_2 = tmp21;
if (0 === c3) {
c5 = 3;
throw tmp21;
} else {
c4 = 1;
}
}
}
2026-10-01 14:13:23 +00:00
});
return obj(...arguments);
};
2026-10-01 14:13:23 +00:00
const tmp = !fetchAttachments();
}, items);
2026-10-01 14:13:23 +00:00
let tmp4 = shareId;
let obj2 = require("get initialized");
const items1 = [stateFromStores];
2026-10-01 14:13:23 +00:00
stateFromStores = obj2.useStateFromStores(items1, () => ChannelStore.getChannel(channelId));
const tmp6 = first(react.useState(null), 2);
let closure_7 = tmp6[1];
const items2 = [channelId, stateFromStores];
2026-10-01 14:13:23 +00:00
let first1 = tmp6[0];
const effect1 = react.useEffect(() => {
function fetchChannel() {
return obj(...arguments);
}
let obj = function _fetchChannel() {
let logger;
obj = _asyncToGenerator(async (arg0, value) => {
let obj2;
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj3 = { value, done: true };
return obj3;
} else {
return { value: "HermesInternal", done: null };
}
} else {
2026-10-01 14:13:23 +00:00
let c3;
try {
let closure_1;
let closure_0;
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
closure_1 = tmp;
closure_0 = undefined;
if (null != closure_1) {
if (null == closure_1_6) {
c3 = 1;
c4 = 2;
c5 = 1;
const obj5 = { value: obj2.fetchChannel(tmp17), done: false };
obj2 = channelId(shareId[10]);
return obj5;
}
}
}
2026-10-01 14:13:23 +00:00
} else if (1 === c4) {
c3 = 0;
2026-10-01 14:13:23 +00:00
closure_1 = closure_2;
logger.error("Error fetching channel:", closure_1);
} else if (arg0 === 1) {
c5 = 3;
throw value;
2026-10-01 14:13:23 +00:00
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
obj = { value, done: true };
return obj;
} else {
closure_0 = value;
closure_1_7(closure_0);
c3 = 0;
}
c5 = 3;
2026-10-01 14:13:23 +00:00
return { value: "HermesInternal", done: null };
} catch (tmp21) {
closure_2 = tmp21;
if (0 === c3) {
c5 = 3;
throw tmp21;
} else {
c4 = 1;
}
}
}
2026-10-01 14:13:23 +00:00
});
return obj(...arguments);
};
2026-10-01 14:13:23 +00:00
const tmp = !fetchChannel();
}, items2);
2026-10-01 14:13:23 +00:00
let tmp9 = stateFromStores;
if (stateFromStores == null) {
2026-10-01 14:13:23 +00:00
tmp9 = first1;
}
2026-10-01 14:13:23 +00:00
first1 = tmp9;
const items3 = [text, first, channelId, tmp9];
const memo = obj.useMemo(() => {
let items;
const obj = { text: require, attachments: items };
items = first;
if (first == null) {
items = [];
}
if (null != first1) {
2026-10-01 14:13:23 +00:00
if (first1.type !== ChannelTypes.ChannelTypes.DM) {
obj.targetChannelId = channelId;
} else {
2026-10-01 14:13:23 +00:00
let isArray = tmp && "recipients" in tmp;
if (isArray) {
const _Array = Array;
isArray = Array.isArray(tmp.recipients);
}
if (isArray) {
2026-10-01 14:13:23 +00:00
obj.targetUserId = first1.recipients[0];
} else {
2026-10-01 14:13:23 +00:00
const tmp4 = tmp && "recipient" in tmp && "id" in tmp.recipient;
if (tmp4) {
const recipient = tmp.recipient;
let id;
if (recipient != null) {
id = recipient.id;
}
obj.targetUserId = id;
}
}
}
}
return obj;
}, items3);
2026-10-01 14:13:23 +00:00
let obj3 = { sharedContent: memo, onClose };
return first1(channelId(tmp4[12]), obj3);
};