Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4941.js (118.4 MB)
171 lines
5.7 KiB
TypeScript
171 lines
5.7 KiB
TypeScript
// Module ID: 9993
|
|
// Function ID: 9994
|
|
// Name: useCanRing
|
|
// Dependencies: [502, 5490, 2041, 2105, 5625, 4395, 4796, 4405, 4775, 1074, 504, 9994, 5628, 5219, 2]
|
|
// Exports: canRingUsersInChannel, useCanRing
|
|
|
|
// Module 9993 (useCanRing)
|
|
import useChannelRoleSubscriptionStatusDefault from "useChannelRoleSubscriptionStatus" /* 5219 */;
|
|
import canJoinVoiceChannelDefault from "canJoinVoiceChannel" /* 5628 */;
|
|
import AuthenticationStore from "AuthenticationStore" /* 502 */;
|
|
import CallStore from "CallStore" /* 5490 */;
|
|
import ChannelStore from "ChannelStore" /* 2041 */;
|
|
import GuildMemberStore from "GuildMemberStore" /* 2105 */;
|
|
import GuildVerificationStore from "GuildVerificationStore" /* 5625 */;
|
|
import PermissionStore from "PermissionStore" /* 4395 */;
|
|
import PresenceStore from "PresenceStore" /* 4796 */;
|
|
import RelationshipStore from "RelationshipStore" /* 4405 */;
|
|
import VoiceStateStore from "VoiceStateStore" /* 4775 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
const GuildVoiceRingingExperimentDefault = tmp4(9994);
|
|
const require = fn;
|
|
function useCanRingToGuildVoiceChannel(user, useCanRing, stateFromStores) {
|
|
_require = user;
|
|
let str = useCanRing;
|
|
if (useCanRing === undefined) {
|
|
str = "useCanRingToGuildVoiceChannel";
|
|
}
|
|
importDefault = stateFromStores;
|
|
const items = [PermissionStore];
|
|
stateFromStores = require("initialize").useStateFromStores(items, () => {
|
|
let tmp2 = null != closure_1;
|
|
if (tmp2) {
|
|
tmp2 = canJoinVoiceChannelDefault(tmp, PermissionStore);
|
|
}
|
|
return tmp2;
|
|
});
|
|
const obj = require("initialize");
|
|
const items1 = [GuildMemberStore, GuildVerificationStore];
|
|
const stateFromStores1 = require("initialize").useStateFromStores(items1, () => {
|
|
let guild_id;
|
|
if (stateFromStores != null) {
|
|
guild_id = stateFromStores.guild_id;
|
|
}
|
|
if (null == guild_id) {
|
|
return false;
|
|
} else {
|
|
let canChat = null != GuildMemberStore.getMember(guild_id, user.id);
|
|
if (canChat) {
|
|
canChat = GuildVerificationStore.getCheck(guild_id).canChat;
|
|
}
|
|
return canChat;
|
|
}
|
|
});
|
|
let id;
|
|
const obj2 = require("initialize");
|
|
if (stateFromStores != null) {
|
|
id = stateFromStores.id;
|
|
}
|
|
const tmp5 = useChannelRoleSubscriptionStatusDefault;
|
|
let guild_id;
|
|
if (stateFromStores != null) {
|
|
guild_id = stateFromStores.guild_id;
|
|
}
|
|
let enabled = GuildVoiceRingingExperimentDefault.useExperiment({ guildId: guild_id, location: str }).enabled;
|
|
if (stateFromStores != null) {
|
|
const type = stateFromStores.type;
|
|
}
|
|
if (enabled) {
|
|
enabled = type === constants.GUILD_VOICE;
|
|
}
|
|
if (enabled) {
|
|
enabled = stateFromStores1;
|
|
}
|
|
if (enabled) {
|
|
enabled = stateFromStores;
|
|
}
|
|
if (enabled) {
|
|
enabled = !tmp5(id).needSubscriptionToAccess;
|
|
}
|
|
return enabled;
|
|
}
|
|
const Constants = fn(1074);
|
|
({ ChannelTypes: closure_12, ChannelTypesSets: map1, StatusTypes: closure_14 } = Constants);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/calls/useCanRing.tsx");
|
|
|
|
export const useCanRing = function useCanRing(user, DisconnectedUserRow, selectedVoiceChannelId) {
|
|
_require = user;
|
|
let str = DisconnectedUserRow;
|
|
if (DisconnectedUserRow === undefined) {
|
|
str = "useCanRing";
|
|
}
|
|
closure_1 = selectedVoiceChannelId;
|
|
let stateFromStores;
|
|
const items = [ChannelStore];
|
|
stateFromStores = require("initialize").useStateFromStores(items, () => ChannelStore.getChannel(closure_1));
|
|
const obj = require("initialize");
|
|
const items1 = [AuthenticationStore];
|
|
const stateFromStores1 = require("initialize").useStateFromStores(items1, () => AuthenticationStore.getId() === user.id);
|
|
const obj2 = require("initialize");
|
|
const items2 = [RelationshipStore];
|
|
let stateFromStores2 = require("initialize").useStateFromStores(items2, () => RelationshipStore.isFriend(user.id));
|
|
const obj3 = require("initialize");
|
|
const items3 = [PresenceStore];
|
|
let type;
|
|
const stateFromStores3 = require("initialize").useStateFromStores(items3, () => {
|
|
let tmp = PresenceStore.getStatus(user.id) === constants3.DND;
|
|
if (tmp) {
|
|
let guild_id;
|
|
if (stateFromStores != null) {
|
|
guild_id = stateFromStores.guild_id;
|
|
}
|
|
tmp = null != guild_id;
|
|
}
|
|
return tmp;
|
|
});
|
|
if (stateFromStores != null) {
|
|
type = stateFromStores.type;
|
|
}
|
|
let hasItem = null != type;
|
|
if (hasItem) {
|
|
const CALLABLE = constants2.CALLABLE;
|
|
hasItem = CALLABLE.has(type);
|
|
}
|
|
let tmp8 = useCanRingToGuildVoiceChannel(user, str, stateFromStores);
|
|
if (stateFromStores2) {
|
|
stateFromStores2 = !stateFromStores3;
|
|
}
|
|
if (stateFromStores2) {
|
|
stateFromStores2 = !stateFromStores1;
|
|
}
|
|
if (stateFromStores2) {
|
|
stateFromStores2 = !user.bot;
|
|
}
|
|
if (stateFromStores2) {
|
|
stateFromStores2 = !user.system;
|
|
}
|
|
if (stateFromStores2) {
|
|
stateFromStores2 = !user.isProvisional;
|
|
}
|
|
if (stateFromStores2) {
|
|
if (!tmp8) {
|
|
tmp8 = hasItem;
|
|
}
|
|
stateFromStores2 = tmp8;
|
|
}
|
|
return stateFromStores2;
|
|
};
|
|
export const canRingUsersInChannel = function canRingUsersInChannel(channel) {
|
|
const CALLABLE = constants2.CALLABLE;
|
|
if (CALLABLE.has(channel.type)) {
|
|
const call = CallStore.getCall(channel.id);
|
|
return null != call && null != call.messageId && !CallStore.isCallUnavailable(channel.id);
|
|
} else if (tmp === tmp2) {
|
|
const obj2 = { guildId: channel.guild_id, location: "ring" };
|
|
let enabled = GuildVoiceRingingExperimentDefault.getCurrentConfig(obj2).enabled;
|
|
const voiceState = VoiceStateStore.getVoiceState(channel.guild_id, AuthenticationStore.getId());
|
|
if (enabled) {
|
|
enabled = null != voiceState;
|
|
}
|
|
if (enabled) {
|
|
enabled = voiceState.channelId === channel.id;
|
|
}
|
|
return enabled;
|
|
} else {
|
|
return false;
|
|
}
|
|
};
|
|
export { useCanRingToGuildVoiceChannel };
|