decord/source/modules/activities/utils/getEmbeddedActivityJoinability.tsx
github-actions cd74c1f217 chore: update source for alpha 345.5
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9667_m.js (378 MB)
2026-09-05 10:56:28 +00:00

133 lines
6.2 KiB
TypeScript

// Module ID: 9531
// Function ID: 9532
// Name: getEmbeddedActivityJoinability
// Dependencies: [1957, 1979, 4199, 1371, 4579, 1074, 9529, 4705, 9502, 504, 2]
// Exports: useEmbeddedActivityJoinability
// Module 9531 (getEmbeddedActivityJoinability)
import allowChannelAccess from "allowChannelAccess" /* 4705 */;
import isActivitySupportedOnClientPlatformDefault from "isActivitySupportedOnClientPlatform" /* 9529 */;
import closure_3 from "ensureGuildLoaded" /* 1957 */;
import closure_4 from "createGuildRecordFromRust" /* 1979 */;
import closure_5 from "getUncachedChannelPermissions" /* 4199 */;
import closure_6 from "mergeGuildAvatar" /* 1371 */;
import closure_7 from "updateVoiceState" /* 4579 */;
import { Permissions } from "ME" /* 1074 */;
require = arg1;
function getEmbeddedActivityJoinability(arg0) {
({ userId, activity, application, channelId, currentUser, ChannelStore, VoiceStateStore, PermissionStore, GuildStore } = arg0);
if (null == userId) {
return obj.NO_USER;
} else {
let nsfwAllowed;
if (currentUser != null) {
nsfwAllowed = currentUser.nsfwAllowed;
}
if (false === nsfwAllowed) {
let requires_age_gate;
if (application != null) {
const embeddedActivityConfig = application.embeddedActivityConfig;
if (embeddedActivityConfig != null) {
requires_age_gate = embeddedActivityConfig.requires_age_gate;
}
}
if (true === requires_age_gate) {
return obj.ACTIVITY_AGE_GATED;
}
}
if (tmp) {
let supported_platforms;
if (application != null) {
const embeddedActivityConfig2 = application.embeddedActivityConfig;
if (embeddedActivityConfig2 != null) {
supported_platforms = embeddedActivityConfig2.supported_platforms;
}
}
if (tmp7(supported_platforms)) {
let tmp10 = channelId;
if (null == channelId) {
let session_id;
if (activity != null) {
session_id = activity.session_id;
}
const voiceStateForSession = VoiceStateStore.getVoiceStateForSession(userId, session_id);
channelId = undefined;
if (voiceStateForSession != null) {
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 (guild != null) {
afkChannelId = guild.afkChannelId;
}
if (afkChannelId === channel.id) {
return obj.IS_AFK_CHANNEL;
} else {
const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(channel.getGuildId());
const obj2 = allowChannelAccess;
const isChannelFullResult = allowChannelAccess.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;
}
canResult = PermissionStore.can(Permissions.CONNECT, channel);
}
}
}
return obj.CAN_JOIN;
}
}
} else {
return obj.ACTIVITY_NOT_SUPPORTED_ON_OS;
}
tmp7 = isActivitySupportedOnClientPlatformDefault;
} else {
return obj.ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS;
}
}
}
let 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 = require("set").fileFinishedImporting("modules/activities/utils/getEmbeddedActivityJoinability.tsx");
export default getEmbeddedActivityJoinability;
export const EmbeddedActivityJoinability = obj;
export const useEmbeddedActivityJoinability = function useEmbeddedActivityJoinability(userId) {
userId = userId.userId;
const activity = userId.activity;
const channelId = userId.channelId;
const application = userId.application;
let isActivitiesEnabledForCurrentPlatform;
let stateFromStores;
isActivitiesEnabledForCurrentPlatform = userId(channelId[8]).useIsActivitiesEnabledForCurrentPlatform();
obj = userId(channelId[8]);
const items = [closure_6];
stateFromStores = userId(channelId[9]).useStateFromStores(items, () => currentUser.getCurrentUser());
const obj2 = userId(channelId[9]);
const items1 = [application, closure_7, stateFromStores, isActivitiesEnabledForCurrentPlatform];
const items2 = [activity, application, channelId, stateFromStores, isActivitiesEnabledForCurrentPlatform, userId];
return userId(channelId[9]).useStateFromStores(items1, () => closure_1_10({ userId, activity, application, channelId, currentUser: stateFromStores, isActivitiesEnabledForCurrentPlatform, ChannelStore: application, VoiceStateStore: closure_1_7, PermissionStore: stateFromStores, GuildStore: isActivitiesEnabledForCurrentPlatform }), items2);
};