decord/alpha/source/modules/age_assurance/AgeVerificationManager.tsx
github-actions e160b228c5 chore: update source for alpha 348.1
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4942.js (118.4 MB)
2026-09-22 07:41:18 +00:00

157 lines
5.8 KiB
TypeScript

// Module ID: 17742
// Function ID: 17743
// Name: AgeVerificationManager
// Dependencies: [2042, 4977, 2096, 1372, 1074, 8674, 3, 1096, 4969, 8870, 7701, 7548, 7365, 1978, 5642, 5643, 5491, 2]
// Module 17742 (AgeVerificationManager)
import LoggerDefault from "Logger" /* 3 */;
import MessageEmbedTypes from "MessageEmbedTypes" /* 1096 */;
import Server from "Server" /* 1978 */;
import AgeVerificationUtils from "AgeVerificationUtils" /* 4969 */;
import ChannelMessagesDefault from "ChannelMessages" /* 5491 */;
import RegionalFeatureConfigUtils from "RegionalFeatureConfigUtils" /* 5642 */;
import AgeGatedFeature from "AgeGatedFeature" /* 5643 */;
import ManualReviewActionCreators from "ManualReviewActionCreators" /* 8870 */;
import ChannelStore from "ChannelStore" /* 2042 */;
import MessageStore from "MessageStore" /* 4977 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2096 */;
import UserStore from "UserStore" /* 1372 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7365 */;
require = fn;
function handleMessageCreate(channelId) {
const message = MessageStore.getMessage(channelId.channelId, channelId.message.id);
let type;
if (message != null) {
const embeds = message.embeds;
if (embeds != null) {
const first = embeds[0];
if (first != null) {
type = first.type;
}
}
}
if (type === MessageEmbedTypes.MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION) {
let found;
if (message != null) {
const embeds2 = message.embeds;
if (embeds2 != null) {
const first1 = embeds2[0];
if (first1 != null) {
const fields = first1.fields;
if (fields != null) {
found = fields.find((rawName) => rawName.rawName === AgeVerificationUtils.AgeVerificationSystemNotificationEmbedKeys.CONTENT_TYPE);
}
}
}
}
let rawValue;
if (found != null) {
rawValue = found.rawValue;
}
if (rawValue === tmp4(4969).AgeVerificationSystemNotificationContentType.MANUAL_REVIEW_SUBMITTED) {
const result = tmp4(8870).invalidateAgeVerificationCaches();
const tmp4Result = tmp4(8870);
}
}
}
const transformUser = fn(1372).transformUser;
const Constants = fn(1074);
({ ChannelTypes: closure_8, MAX_MESSAGES_PER_CHANNEL: closure_9 } = Constants);
const SafetyToastType = fn(8674).SafetyToastType;
let closure_10 = new LoggerDefault("AgeVerificationManager");
const prototype = function AgeVerificationManager() {
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
require = applyArgumentsResult;
applyArgumentsResult._previousAgeVerificationStatus = null;
applyArgumentsResult.handlePostConnectionOpen = function handlePostConnectionOpen() {
const currentUser = UserStore.getCurrentUser();
let prop;
if (currentUser != null) {
prop = currentUser.ageVerificationStatus;
}
if (prop == null) {
prop = null;
}
applyArgumentsResult._previousAgeVerificationStatus = prop;
};
applyArgumentsResult.handleCurrentUserUpdate = function handleCurrentUserUpdate(user) {
let channelId;
c1 = undefined;
let prop = transformUser(user.user).ageVerificationStatus;
if (prop == null) {
prop = null;
}
let isFeatureAgeGatedResult = tmp5;
if (applyArgumentsResult._previousAgeVerificationStatus !== prop) {
isFeatureAgeGatedResult = prop === Server.AgeVerificationStatusUkAndAusOnly.VERIFIED_ADULT;
}
if (isFeatureAgeGatedResult) {
isFeatureAgeGatedResult = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
}
if (applyArgumentsResult._previousAgeVerificationStatus !== prop) {
const result = ManualReviewActionCreators.invalidateManualReviewCache();
}
try {
if (isFeatureAgeGatedResult) {
channelId = SelectedChannelStore.getChannelId();
c1 = false;
const item = ChannelMessagesDefault.forEach((channelId) => {
channelId = channelId.channelId;
channel = channel.getChannel(channelId);
let nsfw;
if (channel != null) {
nsfw = channel.nsfw;
}
if (nsfw) {
ChannelMessagesDefault.clear(channelId);
if (channelId === channelId) {
c1 = true;
}
}
});
let tmp20 = c1;
if (c1) {
tmp20 = null != tmp16;
}
if (tmp20) {
(function handleLoadChannelMessages(channelId) {
const messages = _true(7701).fetchMessages({ channelId, limit });
})(tmp16);
(function handleLoadForumPosts(arg0) {
channel = channel.getChannel(arg0);
let type;
if (channel != null) {
type = channel.type;
}
let tmp4 = type !== constants.GUILD_FORUM;
if (tmp4) {
let type1;
if (channel != null) {
type1 = channel.type;
}
tmp4 = type1 !== tmp3.GUILD_MEDIA;
}
if (!tmp4) {
channelId(7548).preloadForumThreads(channel);
const obj = channelId(7548);
}
})(tmp16);
}
}
applyArgumentsResult._previousAgeVerificationStatus = prop;
} catch (tmp25) {
tmp._previousAgeVerificationStatus = tmp2;
throw tmp25;
}
};
applyArgumentsResult.actions = { POST_CONNECTION_OPEN: applyArgumentsResult.handlePostConnectionOpen, CURRENT_USER_UPDATE: applyArgumentsResult.handleCurrentUserUpdate, MESSAGE_CREATE: handleMessageCreate };
return applyArgumentsResult;
}.prototype;
class prototype extends tmp4 {
}
const prototype1 = new prototype();
const size = fn(2);
let result = size.fileFinishedImporting("modules/age_assurance/AgeVerificationManager.tsx");
export default prototype1;