Files
2026-07-28 01:06:53 +03:00

159 lines
9.4 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] */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import CallStore from '../../stores/CallStore.tsx'; /* Metro dependency 4258 */
import VoiceStateStore from '../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */
import GuildVoiceRingingExperiment from '../voice_calls/GuildVoiceRingingExperiment.tsx'; /* Metro dependency 4619 */
import GuildVerificationStore from '../../stores/GuildVerificationStore.tsx'; /* Metro dependency 4798 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
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 useCanRingToGuildVoiceChannel2 = useCanRingToGuildVoiceChannel;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/calls/useCanRing.tsx');
exports.useCanRing = useCanRing;
exports.canRingUsersInChannel = canRingUsersInChannel;
exports.useCanRingToGuildVoiceChannel = useCanRingToGuildVoiceChannel2;
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 = (FluxModule).useStateFromStores([PermissionStore], _fun69592);
const value4 = (FluxModule).useStateFromStores([GuildMemberStore,
GuildVerificationStore], _fun69593);
const needSubscriptionToAccess = (importDefault(6632) /* metro dependency 6632: useChannelRoleSubscriptionStatus */)(a2 == null ? value2 : a2.id).needSubscriptionToAccess;
const defaultImport2 = 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 _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 guildMemberStoreBinding = GuildMemberStore;
const getMember = guildMemberStoreBinding.getMember;
const value = Reflect.apply(getMember, guildMemberStoreBinding, [guild_id, env0_0.id]) != null;
const guildVerificationStoreBinding = GuildVerificationStore;
const getCheck = guildVerificationStoreBinding.getCheck;
return value && Reflect.apply(getCheck, guildVerificationStoreBinding, [guild_id]).canChat;
}
}
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 _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
const relationshipStoreBinding = RelationshipStore;
return relationshipStoreBinding.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;
}
}
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 voiceStateStoreBinding;
var getVoiceState;
var authenticationStoreBinding;
var callStoreBinding;
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) {
callStoreBinding = CallStore;
value4 = callStoreBinding.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;
voiceStateStoreBinding = VoiceStateStore;
getVoiceState = voiceStateStoreBinding.getVoiceState;
guild_id = a0.guild_id;
authenticationStoreBinding = AuthenticationStore;
value = Reflect.apply(getVoiceState, voiceStateStoreBinding, [guild_id, authenticationStoreBinding.getId()]);
r0 = enabled && value != null;
r0 = r0 && value.channelId === a0.id;
return r0;
}
return false;
}
}
global.__d(_fun69590, 8917, [1226, 4258, 1379, 1945, 4798, 3784, 4396, 3793, 4297, 661, 566, 4619, 4808, 6632,
2]) /* metro module 8917, dependencies: [1226, 4258, 1379, 1945, 4798, 3784, 4396, 3793, 4297, 661, 566, 4619, 4808, 6632, 2] */;