decord/source/modules/messages/native/renderer/ExplicitMediaUtils.tsx

159 lines
6.4 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 7845
2026-07-27 11:26:19 +00:00
// Function ID: 62592
2026-07-20 16:05:17 +00:00
// Name: getContentScanVersionFromMedia
2026-07-25 08:10:48 +00:00
// Dependencies: [653, 1360, 5849, 5852, 4348, 1212, 2]
2026-07-20 16:05:17 +00:00
// Exports: getAttachmentObscurityDefaults, getAttachmentObscurityProps, getUnfurledMediaItemObscurityProps
2026-07-25 08:10:48 +00:00
// Module 7845 (getContentScanVersionFromMedia)
2026-07-23 10:11:24 +00:00
import { MessageAttachmentFlags } from "ME";
2026-07-20 16:05:17 +00:00
function getContentScanVersionFromMedia(attachment) {
if (undefined !== attachment.content_scan_version) {
return attachment.content_scan_version;
} else {
let contentScanVersion;
if (undefined !== attachment.contentScanVersion) {
contentScanVersion = attachment.contentScanVersion;
}
return contentScanVersion;
}
}
function getSpoilerDescriptionForType(type) {
if ("image" === type) {
2026-07-23 10:11:24 +00:00
const intl4 = require(1212) /* getSystemLocale */.intl;
return intl4.string(require(1212) /* getSystemLocale */.t.sb2W2J);
2026-07-20 16:05:17 +00:00
} else if ("video" === type) {
2026-07-23 10:11:24 +00:00
const intl3 = require(1212) /* getSystemLocale */.intl;
return intl3.string(require(1212) /* getSystemLocale */.t.ehBaMc);
2026-07-20 16:05:17 +00:00
} else if ("file" === type) {
2026-07-23 10:11:24 +00:00
const intl2 = require(1212) /* getSystemLocale */.intl;
return intl2.string(require(1212) /* getSystemLocale */.t["3Gc2XP"]);
2026-07-20 16:05:17 +00:00
} else if ("generic" === type) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
return intl.string(require(1212) /* getSystemLocale */.t.G71b77);
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
const result = require("_createForOfIteratorHelperLoose").fileFinishedImporting("modules/messages/native/renderer/ExplicitMediaUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getAttachmentObscurityProps = function getAttachmentObscurityProps(shouldAgeVerify) {
let attachment;
let enabledContentHarmTypeFlags;
let shouldObscureSpoiler;
({ attachment, shouldObscureSpoiler, enabledContentHarmTypeFlags } = shouldAgeVerify);
2026-07-23 10:11:24 +00:00
let obj = require(1360) /* hasFlag */;
2026-07-20 16:05:17 +00:00
const flags = attachment.flags;
let num = 0;
if (null != flags) {
num = flags;
}
const hasFlagResult = obj.hasFlag(num, MessageAttachmentFlags.IS_SPOILER);
obj = {};
const tmp2 = getContentScanVersionFromMedia(attachment);
let num2 = 0;
if (null != tmp2) {
num2 = tmp2;
}
obj.contentScanVersion = num2;
const flags2 = attachment.flags;
let num3 = 0;
if (null != flags2) {
num3 = flags2;
}
obj.flags = num3;
2026-07-25 08:10:48 +00:00
let obj2 = require(5849) /* _createForOfIteratorHelperLoose */;
obj = { type: require(5852) /* ContentHarmTypeChannel */.ObscuredMediaTypes.Attachment, media: obj };
2026-07-20 16:05:17 +00:00
const mediaObscuredReasonFromBitmask = obj2.getMediaObscuredReasonFromBitmask(obj, enabledContentHarmTypeFlags);
2026-07-25 08:10:48 +00:00
const obj5 = require(5849) /* _createForOfIteratorHelperLoose */;
2026-07-20 16:05:17 +00:00
let isVerifiedTeenResult = tmp4;
2026-07-25 08:10:48 +00:00
const obj1 = { type: require(5852) /* ContentHarmTypeChannel */.ObscuredMediaTypes.Attachment, media: obj };
2026-07-20 16:05:17 +00:00
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-07-25 08:10:48 +00:00
isVerifiedTeenResult = require(4348) /* isReactiveCheckEnabled */.isVerifiedTeen();
const obj7 = require(4348) /* isReactiveCheckEnabled */;
2026-07-20 16:05:17 +00:00
}
obj2 = {};
let tmp8 = shouldObscureSpoiler;
if (shouldObscureSpoiler) {
tmp8 = hasFlagResult;
}
obj2.isSpoiler = tmp8;
let str = "";
let str2 = "";
if (shouldObscureSpoiler) {
str2 = str;
if (hasFlagResult) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
str2 = intl.string(require(1212) /* getSystemLocale */.t["F+x38C"]).toUpperCase();
const str3 = intl.string(require(1212) /* getSystemLocale */.t["F+x38C"]);
2026-07-20 16:05:17 +00:00
}
}
obj2.spoiler = str2;
obj2.obscure = mediaObscuredReasonFromBitmask.length > 0;
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-07-23 10:11:24 +00:00
const intl2 = require(1212) /* getSystemLocale */.intl;
str = intl2.string(require(1212) /* getSystemLocale */.t.SpxcUR);
2026-07-20 16:05:17 +00:00
}
obj2.obscureDescription = str;
2026-07-25 08:10:48 +00:00
obj2.obscureAwaitingScan = obj5.isMediaScanPending({ type: require(5852) /* ContentHarmTypeChannel */.ObscuredMediaTypes.Attachment, media: obj }, enabledContentHarmTypeFlags);
2026-07-20 16:05:17 +00:00
shouldAgeVerify = tmp4;
if (mediaObscuredReasonFromBitmask.length > 0) {
shouldAgeVerify = shouldAgeVerify.shouldAgeVerify;
}
obj2.verifyAge = shouldAgeVerify;
obj2.obscureHideControls = isVerifiedTeenResult;
obj2.obscureIsOpaque = mediaObscuredReasonFromBitmask.length > 0;
return obj2;
};
export const getUnfurledMediaItemObscurityProps = function getUnfurledMediaItemObscurityProps(arg0) {
let enabledContentHarmTypeFlags;
let isAuthorBot;
let isSpoilered;
let mediaItem;
let shouldAgeVerify;
let shouldObscureSpoiler;
let type;
({ mediaItem, isSpoilered, enabledContentHarmTypeFlags } = arg0);
({ type, isAuthorBot, shouldObscureSpoiler, shouldAgeVerify } = arg0);
2026-07-25 08:10:48 +00:00
let obj = require(5849) /* _createForOfIteratorHelperLoose */;
obj = { type: require(5852) /* ContentHarmTypeChannel */.ObscuredMediaTypes.GenericMedia, media: mediaItem };
2026-07-20 16:05:17 +00:00
let isMediaScanPendingResult = !isAuthorBot;
const mediaObscuredReasonFromBitmask = obj.getMediaObscuredReasonFromBitmask(obj, enabledContentHarmTypeFlags);
if (isMediaScanPendingResult) {
2026-07-25 08:10:48 +00:00
obj = { type: require(5852) /* ContentHarmTypeChannel */.ObscuredMediaTypes.GenericMedia, media: mediaItem };
isMediaScanPendingResult = require(5849) /* _createForOfIteratorHelperLoose */.isMediaScanPending(obj, enabledContentHarmTypeFlags);
const obj3 = require(5849) /* _createForOfIteratorHelperLoose */;
2026-07-20 16:05:17 +00:00
}
if (isSpoilered) {
isSpoilered = shouldObscureSpoiler;
}
let isVerifiedTeenResult = tmp4;
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-07-25 08:10:48 +00:00
isVerifiedTeenResult = require(4348) /* isReactiveCheckEnabled */.isVerifiedTeen();
const obj5 = require(4348) /* isReactiveCheckEnabled */;
2026-07-20 16:05:17 +00:00
}
const obj1 = { isSpoiler: isSpoilered };
let tmp8 = null;
if (isSpoilered) {
tmp8 = getSpoilerDescriptionForType(type);
}
obj1.spoilerDescription = tmp8;
obj1.isObscured = mediaObscuredReasonFromBitmask.length > 0;
let stringResult = null;
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
stringResult = intl.string(require(1212) /* getSystemLocale */.t.SpxcUR);
2026-07-20 16:05:17 +00:00
}
obj1.obscureDescription = stringResult;
obj1.obscureAwaitingScan = isMediaScanPendingResult;
let tmp13 = tmp4;
if (mediaObscuredReasonFromBitmask.length > 0) {
tmp13 = shouldAgeVerify;
}
obj1.verifyAge = tmp13;
obj1.obscureHideControls = isVerifiedTeenResult;
obj1.obscureIsOpaque = mediaObscuredReasonFromBitmask.length > 0;
return obj1;
};
export function getAttachmentObscurityDefaults() {
2026-07-23 10:11:24 +00:00
return { isSpoiler: false, spoiler: "" };
2026-07-20 16:05:17 +00:00
}