90 lines
3.3 KiB
TypeScript
90 lines
3.3 KiB
TypeScript
// Metro module 5002 (f5003).
|
|
import ChannelStore from "../stores/ChannelStore";
|
|
import GuildStore from "../stores/GuildStore";
|
|
import GuildVerificationStore from "../stores/GuildVerificationStore";
|
|
import PermissionStore from "../stores/PermissionStore";
|
|
import SelectedChannelStore from "../stores/SelectedChannelStore";
|
|
import UserStore from "../stores/UserStore";
|
|
import VoiceStateStore from "../stores/VoiceStateStore";
|
|
import { STAGE_BOOSTING_SHEET_KEY } from "../modules/stage_channels/StageChannelsConstants";
|
|
import * as _ChannelUtils from "../utils/ChannelUtils";
|
|
import { canLurkerListen } from "../modules/stage_channels/StageChannelPermissionUtils";
|
|
import { unverifiedVoiceGate } from "../modules/toast/native/ToastUtils";
|
|
import canJoinVoiceChannel from "../modules/channel/canJoinVoiceChannel";
|
|
import { getStageHasMedia } from "../modules/stage_channels/StageMediaHooks";
|
|
import ActionSheetActionCreators from "../modules/action_sheet/native/ActionSheetActionCreators";
|
|
import collectCallFeedback from "../modules/voice_calls/collectCallFeedback";
|
|
import { v4 } from "../_bundle/Module514";
|
|
import Dispatcher from "../Dispatcher";
|
|
export function selectVoiceChannelAdditional(a0, guildId) {
|
|
let bypassIdleUpdate;
|
|
const channelId = a0;
|
|
let r10 = arguments[2];
|
|
if (r10 === void 0) {
|
|
r10 = false;
|
|
}
|
|
const video = r10;
|
|
let r9 = arguments[3];
|
|
if (r9 === void 0) {
|
|
r9 = false;
|
|
}
|
|
const stream = r9;
|
|
let r21 = arguments[4];
|
|
if (r21 === void 0) {
|
|
r21 = {};
|
|
}
|
|
let lockVoiceStateForResume2 = r21.lockVoiceStateForResume;
|
|
if (lockVoiceStateForResume2 === void 0) {
|
|
lockVoiceStateForResume2 = false;
|
|
}
|
|
const lockVoiceStateForResume = lockVoiceStateForResume2;
|
|
let bypassIdleUpdate2 = r21.bypassIdleUpdate;
|
|
if (bypassIdleUpdate2 === void 0) {
|
|
bypassIdleUpdate2 = false;
|
|
}
|
|
L24: {
|
|
bypassIdleUpdate = bypassIdleUpdate2;
|
|
const channel = ChannelStore.getChannel(a0);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
if (channel != null && channel.nsfw && !currentUser.nsfwAllowed) {
|
|
break L24;
|
|
}
|
|
L23: {
|
|
if (channel != null) {
|
|
const isChannelFull = _ChannelUtils.isChannelFull(channel, VoiceStateStore, GuildStore);
|
|
const check = GuildVerificationStore.getCheck(channel.guild_id);
|
|
if (!check.canChat && !canLurkerListen(channel)) {
|
|
return unverifiedVoiceGate(check);
|
|
}
|
|
const canJoinVoiceChannel2 = canJoinVoiceChannel(channel, PermissionStore);
|
|
if (isChannelFull && channel.isGuildStageVoice() && getStageHasMedia(channel.id)) {
|
|
ActionSheetActionCreators.openLazy(import("../modules/stage_channels/native/sheets/StageBoostingActionSheet"), STAGE_BOOSTING_SHEET_KEY, {
|
|
channel
|
|
});
|
|
return void 0;
|
|
}
|
|
if (!isChannelFull && canJoinVoiceChannel2) {
|
|
break L23;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
collectCallFeedback(function() {
|
|
const joinVoiceId = v4();
|
|
Dispatcher.dispatch({
|
|
type: "VOICE_CHANNEL_SELECT",
|
|
guildId,
|
|
channelId,
|
|
currentVoiceChannelId: SelectedChannelStore.getVoiceChannelId(),
|
|
video,
|
|
stream,
|
|
lockVoiceStateForResume,
|
|
joinVoiceId,
|
|
bypassIdleUpdate
|
|
});
|
|
}, a0, stream, video);
|
|
}
|
|
}
|
|
}
|