decord/source/modules/forwarding/getInlineForwardOptions.tsx

63 lines
1.9 KiB
TypeScript
Raw Normal View History

// Module ID: 12066
// Function ID: 12067
2026-07-20 16:05:17 +00:00
// Name: getInlineForwardOptions
// Dependencies: [1074, 4789, 2]
2026-07-20 16:05:17 +00:00
// Exports: getInlineForwardOptions
// Module 12066 (getInlineForwardOptions)
import Constants from "Constants" /* 1074 */;
import MediaFormatTesters from "MediaFormatTesters" /* 4789 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const MessageReferenceTypes = Constants.MessageReferenceTypes;
const result = size.fileFinishedImporting("modules/forwarding/getInlineForwardOptions.tsx");
2026-07-20 16:05:17 +00:00
export const getInlineForwardOptions = function getInlineForwardOptions(message, nativeSyntheticEventData) {
({ targetKind, embedIndex } = nativeSyntheticEventData);
if ("media" === targetKind) {
const messageReference = message.messageReference;
let type;
2026-07-29 08:29:29 +00:00
if (messageReference != null) {
2026-07-20 16:05:17 +00:00
type = messageReference.type;
}
2026-07-29 08:29:29 +00:00
let tmp6 = message;
2026-07-20 16:05:17 +00:00
if (type === MessageReferenceTypes.FORWARD) {
const first = message.messageSnapshots[0];
message = undefined;
2026-07-29 08:29:29 +00:00
if (first != null) {
2026-07-20 16:05:17 +00:00
message = first.message;
}
2026-07-29 08:29:29 +00:00
tmp6 = message;
2026-07-20 16:05:17 +00:00
}
let mapped;
2026-07-29 08:29:29 +00:00
if (tmp6 != null) {
const attachments = tmp6.attachments;
2026-07-20 16:05:17 +00:00
const found = attachments.filter((filename) => {
filename = filename.filename;
let isImageFileResult = MediaFormatTesters.isImageFile(filename);
2026-07-20 16:05:17 +00:00
if (!isImageFileResult) {
isImageFileResult = MediaFormatTesters.isVideoFile(filename);
const tmpResult = MediaFormatTesters;
2026-07-20 16:05:17 +00:00
}
return isImageFileResult;
});
mapped = found.map((id) => id.id);
}
const obj2 = { onlyAttachmentIds: mapped };
return obj2;
2026-07-20 16:05:17 +00:00
} else {
if ("embed" === targetKind) {
if (null != embedIndex) {
const obj3 = { onlyEmbedIndices: null };
2026-07-20 16:05:17 +00:00
const items = [embedIndex];
obj3.onlyEmbedIndices = items;
let obj = obj3;
2026-07-20 16:05:17 +00:00
}
return obj;
}
if ("shortcut" === targetKind) {
obj = {};
}
}
};