// Metro module 12027 (f12028). import { ActivityFlags, ChannelTypes, GuildFeatures } from "../../../Constants"; import getCurrentUserPresenceActivity from "./getCurrentUserPresenceActivity"; import { getIsInParty } from "./getIsInParty"; import getEmbeddedActivityJoinability, { EmbeddedActivityJoinability } from "./getEmbeddedActivityJoinability"; import { getIsActivitiesEnabledForCurrentPlatform } from "../useIsActivitiesEnabledForCurrentPlatform"; import hasFlag from "./hasFlag"; import isActivityJoinableOnCurrentPlatform from "./isActivityJoinableOnCurrentPlatform"; import { platformSupportsActivityJoin } from "../../../utils/PlatformUtils"; import { getPartySize } from "./getPartySize"; import { hasPartySize } from "./hasPartySize"; import { isPartyFull } from "./isPartyFull"; let c8267_6 = { CAN_JOIN: "can_join", CANNOT_JOIN: "cannot_join", JOINED: "joined" }; export default function getActivityJoinability(a0) { L50: { const { user, activity, application, channelId, currentUser, isEmbedded, ChannelStore, GuildStore, GuildMemberCountStore, RelationshipStore, SelectedChannelStore, VoiceStateStore, PermissionStore, LocalActivityStore, SelfPresenceStore, EmbeddedActivitiesStore } = a0; if (!isEmbedded) { const currentUserPresenceActivity = getCurrentUserPresenceActivity(LocalActivityStore, SelfPresenceStore, activity?.application_id); if (currentUserPresenceActivity != null && getIsInParty(currentUserPresenceActivity, activity)) { break L50; } } if (isEmbedded) { const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity(); if (currentEmbeddedActivity != null && currentEmbeddedActivity.applicationId === activity?.application_id) { break L50; } } if (user == null) { return c8267_6.CANNOT_JOIN; } if (isEmbedded && channelId != null) { return getEmbeddedActivityJoinability({ userId: user.id, activity, channelId, currentUser, application, isActivitiesEnabledForCurrentPlatform: getIsActivitiesEnabledForCurrentPlatform(), ChannelStore, VoiceStateStore, PermissionStore, GuildStore }) === EmbeddedActivityJoinability.CAN_JOIN ? c8267_6.CAN_JOIN : c8267_6.CANNOT_JOIN; } if (isEmbedded && channelId == null && !hasFlag(activity, ActivityFlags.CONTEXTLESS)) { return c8267_6.CANNOT_JOIN; } L23: { if (!isEmbedded) { if (isActivityJoinableOnCurrentPlatform(activity) && platformSupportsActivityJoin()) { break L23; } return c8267_6.CANNOT_JOIN; } } const partySize = getPartySize(activity); if (hasPartySize(partySize) && !isPartyFull(partySize)) { if (hasFlag(activity, ActivityFlags.PARTY_PRIVACY_FRIENDS) && RelationshipStore.isFriend(user.id)) { return c8267_6.CAN_JOIN; } if (hasFlag(activity, ActivityFlags.PARTY_PRIVACY_VOICE_CHANNEL)) { const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); if (channel != null && VoiceStateStore.isInChannel(channel.id, user.id)) { const type = channel.type; if (ChannelTypes.DM !== type && ChannelTypes.GROUP_DM !== type) { const guild = GuildStore.getGuild(channel.getGuildId()); if (guild != null && !guild.features.has(GuildFeatures.COMMUNITY)) { const memberCount = GuildMemberCountStore.getMemberCount(guild.id); return memberCount != null && memberCount < 100 ? c8267_6.CAN_JOIN : c8267_6.CANNOT_JOIN; } return c8267_6.CANNOT_JOIN; } return c8267_6.CAN_JOIN; } return c8267_6.CANNOT_JOIN; } return c8267_6.CANNOT_JOIN; } return c8267_6.CANNOT_JOIN; } return c8267_6.JOINED; }; export { c8267_6 as ActivityJoinability };