decord/source/modules/age_gate/native/AgeGateUtils.tsx
github-actions 4f02868c60 chore: update source for alpha 346.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
2026-09-11 10:30:06 +00:00

113 lines
3.6 KiB
TypeScript

// Module ID: 10385
// Function ID: 10386
// Name: age_gate/AgeGateUtils
// Dependencies: [1979, 4245, 1371, 1074, 1115, 4810, 10386, 1896, 9388, 2]
// Exports: handleNSFWGuildInvite, isNSFWInvite, shouldNSFWGateGuild
// Module 10385 (age_gate/AgeGateUtils)
import PlatformUtils from "PlatformUtils" /* 1115 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4810 */;
import GuildStore from "GuildStore" /* 1979 */;
import PermissionStore from "PermissionStore" /* 4245 */;
import UserStore from "UserStore" /* 1371 */;
const asyncRequireImpl = tmp(1896);
const AgeRestrictedContentSettingsUtils = tmp(9388);
require = fn;
const Constants = fn(1074);
const GuildNSFWContentLevel = Constants.GuildNSFWContentLevel;
const Permissions = Constants.Permissions;
const items = [, ];
({ EXPLICIT: arr[0], AGE_RESTRICTED: arr[1] } = GuildNSFWContentLevel);
const set = new Set(items);
const size = fn(2);
const result = size.fileFinishedImporting("modules/age_gate/native/AgeGateUtils.tsx");
export const isNSFWInvite = function isNSFWInvite(guild) {
let nsfw_level;
if (guild != null) {
guild = guild.guild;
if (guild != null) {
nsfw_level = guild.nsfw_level;
}
}
if (nsfw_level == null) {
nsfw_level = GuildNSFWContentLevel.DEFAULT;
}
return set.has(nsfw_level);
};
export const handleNSFWGuildInvite = function handleNSFWGuildInvite(invite) {
if (obj.isIOS()) {
let nsfw_level;
if (invite != null) {
const guild = invite.guild;
if (guild != null) {
nsfw_level = guild.nsfw_level;
}
}
if (nsfw_level == null) {
nsfw_level = GuildNSFWContentLevel.DEFAULT;
}
const hasItem = set.has(nsfw_level);
if (invite != null) {
const guild2 = invite.guild;
if (guild2 != null) {
const id = guild2.id;
}
}
let tmp10 = !hasItem;
if (hasItem) {
tmp10 = null != GuildStore.getGuild(id);
}
let flag2 = !tmp10;
if (!tmp10) {
let id1;
const obj2 = ModalActionCreatorsDefault;
if (invite != null) {
const guild3 = invite.guild;
if (guild3 != null) {
id1 = guild3.id;
}
}
const obj3 = { guildId: id1 };
obj2.pushLazy(asyncRequireImpl(10386, tmp2.paths), obj3);
flag2 = true;
const tmp12 = asyncRequireImpl(10386, tmp2.paths);
}
return flag2;
} else {
return false;
}
obj = PlatformUtils;
tmp2 = dependencyMap;
};
export const shouldNSFWGateGuild = function shouldNSFWGateGuild(guildId) {
if (obj.isIOS()) {
const guild = GuildStore.getGuild(guildId);
const currentUser = UserStore.getCurrentUser();
if (null != guild) {
if (null != currentUser) {
const tmp9 = PermissionStore.can(Permissions.ADMINISTRATOR, guild) || PermissionStore.can(Permissions.MANAGE_GUILD, guild) || PermissionStore.can(Permissions.KICK_MEMBERS, guild) || PermissionStore.can(Permissions.BAN_MEMBERS, guild);
let nsfwAllowed = currentUser.nsfwAllowed;
if (nsfwAllowed) {
nsfwAllowed = AgeRestrictedContentSettingsUtils.getViewNsfwGuildsOrDefault();
const tmpResult = AgeRestrictedContentSettingsUtils;
}
let tmp11 = !tmp9;
if (!tmp9) {
let tmp12 = guild.nsfwLevel === GuildNSFWContentLevel.EXPLICIT;
if (!tmp12) {
tmp12 = guild.nsfwLevel === GuildNSFWContentLevel.AGE_RESTRICTED && !nsfwAllowed;
const tmp13 = guild.nsfwLevel === GuildNSFWContentLevel.AGE_RESTRICTED && !nsfwAllowed;
}
tmp11 = tmp12;
}
return tmp11;
}
}
return false;
} else {
return false;
}
obj = PlatformUtils;
};