decord/source/modules/age_gate/native/AgeGateManager.tsx

80 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 17397
// Function ID: 17398
// Name: AgeGateManager
// Dependencies: [5, 1957, 2011, 4426, 1098, 1074, 7170, 4816, 4808, 17398, 1896, 1093, 2]
2026-07-20 16:05:17 +00:00
// Module 17397 (AgeGateManager)
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4808 */;
import AgeGateUtils from "AgeGateUtils" /* 4816 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4426 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7170 */;
2026-07-23 10:11:24 +00:00
require = fn;
const AgeGateConstants = fn(1098);
({ EXISTING_USER_AGE_GATE_MODAL_KEY: closure_7, AgeGateSource: closure_8 } = AgeGateConstants);
const Constants = fn(1074);
({ ChannelTypes: closure_9, GuildNSFWContentLevel: c10 } = Constants);
2026-07-29 08:29:29 +00:00
class AgeGateManager extends tmp4 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
applyArgumentsResult.actions = { POST_CONNECTION_OPEN: applyArgumentsResult.handlePostConnectionOpen, CHANNEL_SELECT: applyArgumentsResult.handleChannelSelect, AGE_GATE_MODAL_OPEN: applyArgumentsResult.handleAgeGateModalOpen, AGE_GATE_MODAL_CLOSE: applyArgumentsResult.handleAgeGateModalClose, GUILD_UPDATE: applyArgumentsResult.handleGuildUpdate };
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = AgeGateManager.prototype;
prototype["handlePostConnectionOpen"] = function handlePostConnectionOpen() {
const guildId = SelectedGuildStore.getGuildId();
const channelId = SelectedChannelStore.getChannelId();
AgeGateUtils.maybeShowAgeGate(guildId, channelId);
2026-07-29 08:29:29 +00:00
};
prototype["handleChannelSelect"] = function handleChannelSelect(arg0) {
({ guildId, channelId } = arg0);
const channel = ChannelStore.getChannel(channelId);
2026-07-29 08:29:29 +00:00
let tmp2 = null != guildId;
if (tmp2) {
let type;
if (channel != null) {
type = channel.type;
}
tmp2 = type !== constants.GUILD_VOICE;
}
if (tmp2) {
AgeGateUtils.maybeShowAgeGate(guildId, channelId);
2026-07-29 08:29:29 +00:00
}
};
prototype["handleAgeGateModalOpen"] = function handleAgeGateModalOpen(source) {
source = source.source;
ModalActionCreatorsDefault.pushLazy(asyncGeneratorStep(async () => {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
await tmp2(paths[10])(paths[9], paths.paths);
closure_128_0 = arg1.default;
if (closure_129_0 === constants.AUTH) {
closure_128_0.modalConfig = { animation: tmp2(paths[11]).ModalAnimation.SLIDE_IN_OUT };
{ animation: tmp2(paths[11]).ModalAnimation.SLIDE_IN_OUT };
2026-07-29 08:29:29 +00:00
}
return closure_128_0;
2026-07-29 08:29:29 +00:00
}), { source }, closure_7);
};
prototype["handleAgeGateModalClose"] = function handleAgeGateModalClose() {
ModalActionCreatorsDefault.popWithKey(React5);
2026-07-29 08:29:29 +00:00
};
prototype["handleGuildUpdate"] = function handleGuildUpdate(guild) {
guild = guild.guild;
const guildId = SelectedGuildStore.getGuildId();
2026-07-29 08:29:29 +00:00
let tmp2 = null != guildId && guild.id === guildId;
if (tmp2) {
tmp2 = guild.owner_configured_content_level === constants2.AGE_RESTRICTED;
}
if (tmp2) {
AgeGateUtils.maybeShowAgeGate(guild.id, null);
2026-07-29 08:29:29 +00:00
}
};
const ageGateManager = new AgeGateManager();
const size = fn(2);
const result = size.fileFinishedImporting("modules/age_gate/native/AgeGateManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default ageGateManager;