Files
discord-decomp/sources/modules/calls/useCanRing.tsx
T
2026-07-27 16:20:00 +03:00

147 lines
8.0 KiB
TypeScript

/* Metro module 8917; source: modules/calls/useCanRing.tsx; dependencies: [1226, 4258, 1379, 1945, 4798, 3784, 4396, 3793, 4297, 661, 566, 4619, 4808, 6632, 2] */
function _fun69590(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:6, offset: 0x01c77aca, size: 320 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = useCanRingToGuildVoiceChannel;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const callStore = importDefault(4258) /* metro dependency 4258: CallStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
const guildVerificationStore = importDefault(4798) /* metro dependency 4798: GuildVerificationStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */;
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_12 = constantsModule.ChannelTypes;
const env0_13 = constantsModule.ChannelTypesSets;
const env0_14 = constantsModule.StatusTypes;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/calls/useCanRing.tsx');
exports.useCanRing = useCanRing;
exports.canRingUsersInChannel = canRingUsersInChannel;
exports.useCanRingToGuildVoiceChannel = closure;
}
function useCanRingToGuildVoiceChannel(a0) { // fn#69591, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:250, offset: 0x01c77c0a, size: 288 bytes, params: 2, frame: 22
const value = a1;
const env0_0 = a0;
const value2 = undefined;
const r10 = value !== value2 ? value : 'useCanRingToGuildVoiceChannel';
const env0_1 = a2;
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], _fun69592);
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore,
GuildVerificationStore], _fun69593);
const needSubscriptionToAccess = (importDefault(6632) /* metro dependency 6632: useChannelRoleSubscriptionStatus */)(a2 == null ? value2 : a2.id).needSubscriptionToAccess;
const defaultImport2 = importDefault(4619) /* metro dependency 4619: GuildVoiceRingingExperiment */;
const useExperiment = defaultImport2.useExperiment;
const enabled = Reflect.apply(useExperiment, defaultImport2, [{guildId: a2 == null ? value2 : a2.guild_id,
location: r10}]).enabled;
const type = a2 == null ? value2 : a2.type;
const GUILD_VOICE = ChannelTypes.GUILD_VOICE;
let r0 = enabled && type === GUILD_VOICE && value4;
r0 = r0 && value3 && !needSubscriptionToAccess;
return r0;
}
function useCanRing(a0) { // fn#69594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:839, offset: 0x01c77dc3, size: 323 bytes, params: 2, frame: 24
let value = a1;
const env0_0 = a0;
const value2 = undefined;
const r8 = value !== value2 ? value : 'useCanRing';
const env0_1 = a2;
const channel = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(importDefault);
});
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AuthenticationStore], _fun69596);
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([RelationshipStore], _fun69597);
const value5 = (require(566) /* metro dependency 566: flux */).useStateFromStores([PresenceStore], _fun69598);
const type = channel == null ? value2 : channel.type;
const r2 = type != null && ChannelTypesSets.CALLABLE.has(type);
value = useCanRingToGuildVoiceChannel(a0, r8, channel);
let r0 = value4 && !value5 && !value3;
r0 = r0 && !a0.bot && !a0.system;
r0 = r0 && !a0.isProvisional && (value || r2);
return r0;
}
function canRingUsersInChannel(a0) { // fn#69599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:1337, offset: 0x01c77fb0, size: 248 bytes, params: 2, frame: 17
var r0;
var defaultImport;
var getCurrentConfig;
var guild_id;
var enabled;
var getVoiceState;
var value4;
var value;
const CALLABLE = ChannelTypesSets.CALLABLE;
const has = CALLABLE.has;
let type = a0.type;
const value2 = Reflect.apply(has, CALLABLE, [type]);
type = a0.type;
const GUILD_VOICE = ChannelTypes.GUILD_VOICE;
if (value2) {
value4 = CallStore.getCall(a0.id);
r0 = value4 != null && value4.messageId != null;
r0 = r0 && !CallStore.isCallUnavailable(a0.id);
return r0;
}
if (type === GUILD_VOICE) {
defaultImport = importDefault(4619) /* metro dependency 4619: GuildVoiceRingingExperiment */;
getCurrentConfig = defaultImport.getCurrentConfig;
guild_id = a0.guild_id;
enabled = Reflect.apply(getCurrentConfig, defaultImport, [{guildId: guild_id, location: 'ring'}]).enabled;
getVoiceState = VoiceStateStore.getVoiceState;
guild_id = a0.guild_id;
value = Reflect.apply(getVoiceState, VoiceStateStore, [guild_id, AuthenticationStore.getId()]);
r0 = enabled && value != null;
r0 = r0 && value.channelId === a0.id;
return r0;
}
return false;
}
function _fun69592() { // fn#69592, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:367, offset: 0x01c77d2a, size: 57 bytes, params: 1, frame: 15
return importDefault != null && (importDefault(4808) /* metro dependency 4808: canJoinVoiceChannel */)(importDefault,
PermissionStore);
}
function _fun69593() { // fn#69593, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:433, offset: 0x01c77d63, size: 96 bytes, params: 1, frame: 15
const guild_id = importDefault?.guild_id;
if (guild_id == null) {
return false;
}
const getMember = GuildMemberStore.getMember;
const value = Reflect.apply(getMember, GuildMemberStore, [guild_id, env0_0.id]) != null;
const getCheck = GuildVerificationStore.getCheck;
return value && Reflect.apply(getCheck, GuildVerificationStore, [guild_id]).canChat;
}
function _fun69596() { // fn#69596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:975, offset: 0x01c77f20, size: 35 bytes, params: 1, frame: 9
const value = environment.__proto__;
return AuthenticationStore.getId() === env0_0.id;
}
function _fun69597() { // fn#69597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:1033, offset: 0x01c77f43, size: 32 bytes, params: 1, frame: 11
return RelationshipStore.isFriend(env0_0.id);
}
function _fun69598() { // fn#69598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9102:1091, offset: 0x01c77f63, size: 77 bytes, params: 1, frame: 13
var r0;
var channelBinding;
let value = environment.__proto__;
const status = PresenceStore.getStatus(env0_0.id);
const DND = StatusTypes.DND;
value = status === DND;
if (value) {
channelBinding = channel;
value = undefined;
value = (channelBinding == null ? value : channel.guild_id) != null;
r0 = value;
} else {
r0 = value;
}
return r0;
}