decord/source/modules/activities/utils/getEmbeddedActivityJoinability.tsx
2026-07-21 06:55:02 +00:00

142 lines
6.2 KiB
TypeScript

// Module ID: 10509
// Function ID: 82048
// Name: getEmbeddedActivityJoinability
// Dependencies: []
// Exports: useEmbeddedActivityJoinability
// Module 10509 (getEmbeddedActivityJoinability)
function getEmbeddedActivityJoinability(arg0) {
let ChannelStore;
let GuildStore;
let PermissionStore;
let VoiceStateStore;
let activity;
let application;
let channelId;
let currentUser;
let userId;
({ userId, activity, application, channelId, currentUser, ChannelStore, VoiceStateStore, PermissionStore, GuildStore } = arg0);
if (null == userId) {
return obj.NO_USER;
} else {
let nsfwAllowed;
if (null != currentUser) {
nsfwAllowed = currentUser.nsfwAllowed;
}
if (false === nsfwAllowed) {
let requires_age_gate;
if (null != application) {
const embeddedActivityConfig = application.embeddedActivityConfig;
if (null != embeddedActivityConfig) {
requires_age_gate = embeddedActivityConfig.requires_age_gate;
}
}
if (true === requires_age_gate) {
return obj.ACTIVITY_AGE_GATED;
}
}
if (tmp) {
let supported_platforms;
if (null != application) {
const embeddedActivityConfig2 = application.embeddedActivityConfig;
if (null != embeddedActivityConfig2) {
supported_platforms = embeddedActivityConfig2.supported_platforms;
}
}
if (tmp7(supported_platforms)) {
let tmp10 = channelId;
if (null == channelId) {
let session_id;
if (null != activity) {
session_id = activity.session_id;
}
const voiceStateForSession = VoiceStateStore.getVoiceStateForSession(userId, session_id);
channelId = undefined;
if (null != voiceStateForSession) {
channelId = voiceStateForSession.channelId;
}
tmp10 = channelId;
}
if (null == tmp10) {
return obj.NO_CHANNEL;
} else {
const channel = ChannelStore.getChannel(channelId);
if (null == channel) {
return obj.NO_CHANNEL;
} else {
if (!channel.isPrivate()) {
const guildId = channel.getGuildId();
if (null == guildId) {
return obj.NO_GUILD;
} else {
const guild = GuildStore.getGuild(guildId);
let afkChannelId;
if (null != guild) {
afkChannelId = guild.afkChannelId;
}
if (afkChannelId === channel.id) {
return obj.IS_AFK_CHANNEL;
} else {
const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(channel.getGuildId());
const obj2 = arg1(dependencyMap[7]);
const isChannelFullResult = arg1(dependencyMap[7]).isChannelFull(channel, VoiceStateStore, GuildStore);
if (PermissionStore.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
if (channel.isVocal()) {
if (currentClientVoiceChannelId !== tmp10) {
if (isChannelFullResult) {
return obj.CHANNEL_FULL;
} else if (!canResult) {
return obj.NO_CHANNEL_CONNECT_PERMISSION;
}
}
}
} else {
return obj.NO_USE_EMBEDDED_ACTIVITIES_PERMISSION;
}
const canResult = PermissionStore.can(Permissions.CONNECT, channel);
}
}
}
return obj.CAN_JOIN;
}
}
} else {
return obj.ACTIVITY_NOT_SUPPORTED_ON_OS;
}
const tmp7 = importDefault(dependencyMap[6]);
} else {
return obj.ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS;
}
}
}
let closure_3 = importDefault(dependencyMap[0]);
let closure_4 = importDefault(dependencyMap[1]);
let closure_5 = importDefault(dependencyMap[2]);
let closure_6 = importDefault(dependencyMap[3]);
let closure_7 = importDefault(dependencyMap[4]);
const Permissions = arg1(dependencyMap[5]).Permissions;
const obj = { CAN_JOIN: 0, [0]: "CAN_JOIN", NO_USE_EMBEDDED_ACTIVITIES_PERMISSION: 1, [1]: "NO_USE_EMBEDDED_ACTIVITIES_PERMISSION", NO_CHANNEL_CONNECT_PERMISSION: 2, [2]: "NO_CHANNEL_CONNECT_PERMISSION", CHANNEL_FULL: 3, [3]: "CHANNEL_FULL", NO_CHANNEL: 4, [4]: "NO_CHANNEL", ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS: 5, [5]: "ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS", ACTIVITY_NOT_SUPPORTED_ON_OS: 6, [6]: "ACTIVITY_NOT_SUPPORTED_ON_OS", ACTIVITY_AGE_GATED: 7, [7]: "ACTIVITY_AGE_GATED", NO_USER: 8, [8]: "NO_USER", IS_AFK_CHANNEL: 9, [9]: "IS_AFK_CHANNEL", NO_GUILD: 10, [10]: "NO_GUILD" };
const result = arg1(dependencyMap[10]).fileFinishedImporting("modules/activities/utils/getEmbeddedActivityJoinability.tsx");
export default getEmbeddedActivityJoinability;
export const EmbeddedActivityJoinability = obj;
export const useEmbeddedActivityJoinability = function useEmbeddedActivityJoinability(userId) {
userId = userId.userId;
const arg1 = userId;
const activity = userId.activity;
const importDefault = activity;
const channelId = userId.channelId;
const dependencyMap = channelId;
const application = userId.application;
let closure_3 = application;
const isActivitiesEnabledForCurrentPlatform = arg1(dependencyMap[8]).useIsActivitiesEnabledForCurrentPlatform();
let closure_4 = isActivitiesEnabledForCurrentPlatform;
const obj = arg1(dependencyMap[8]);
const items = [closure_6];
const stateFromStores = arg1(dependencyMap[9]).useStateFromStores(items, () => currentUser.getCurrentUser());
let closure_5 = stateFromStores;
const obj2 = arg1(dependencyMap[9]);
const items1 = [closure_3, closure_7, closure_5, closure_4];
const items2 = [activity, application, channelId, stateFromStores, isActivitiesEnabledForCurrentPlatform, userId];
return arg1(dependencyMap[9]).useStateFromStores(items1, () => callback({ userId, activity, application, channelId, currentUser: stateFromStores, isActivitiesEnabledForCurrentPlatform, ChannelStore: application, VoiceStateStore: closure_7, PermissionStore: stateFromStores, GuildStore: isActivitiesEnabledForCurrentPlatform }), items2);
};