decord/alpha/source/modules/gateway/LocalVoiceStateManager.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

79 lines
3.4 KiB
TypeScript

// Module ID: 13422
// Function ID: 13423
// Name: LocalVoiceStateManager
// Dependencies: [2044, 1993, 4895, 1074, 13420, 2021, 1385, 13423, 2]
// Module 13422 (LocalVoiceStateManager)
import FlagUtils from "FlagUtils" /* 1385 */;
import UserSettings from "UserSettings" /* 2021 */;
import isClipsEnabled from "isClipsEnabled" /* 13423 */;
import ChannelStore from "ChannelStore" /* 2044 */;
import MediaEngineStore from "MediaEngineStore" /* 1993 */;
import RTCRegionStore from "RTCRegionStore" /* 4895 */;
import StateManager from "StateManager" /* 13420 */;
require = fn;
const Constants = fn(1074);
({ ChannelTypes: hasOwnProperty, VoiceFlags: metroRequire } = Constants);
class LocalVoiceStateManager extends tmp3 {
constructor(arg0) {
tmp = new LocalVoiceStateManager(new.target);
tmp.socket = global;
return tmp;
}
}
const prototype = LocalVoiceStateManager.prototype;
Object.defineProperty(prototype, "guildId", {
get: function guildId() {
return this.getState().guildId;
},
set: undefined
});
Object.defineProperty(prototype, "channelId", {
get: function channelId() {
return this.getState().channelId;
},
set: undefined
});
prototype["computeVoiceFlags"] = function computeVoiceFlags() {
const ClipsAllowVoiceRecording = UserSettings.ClipsAllowVoiceRecording;
const setting = ClipsAllowVoiceRecording.getSetting();
const setFlagResult = FlagUtils.setFlag(0, constants2.ALLOW_VOICE_RECORDING, setting);
const obj2 = FlagUtils;
return obj2.setFlag(setFlagResult, constants2.CLIPS_ENABLED, isClipsEnabled.isClipsEnabled());
};
prototype["getInitialState"] = function getInitialState() {
return { guildId: null, channelId: null, selfMute: MediaEngineStore.isSelfMute(), selfDeaf: MediaEngineStore.isSelfDeaf(), selfVideo: MediaEngineStore.isVideoEnabled(), preferredRegion: null, preferredRegions: null, videoStreamParameters: null, flags: 0 };
};
prototype["getNextState"] = function getNextState(guildId) {
return { guildId: guildId.guildId, channelId: guildId.channelId, selfMute: MediaEngineStore.isSelfMute(), selfDeaf: MediaEngineStore.isSelfDeaf(), selfVideo: MediaEngineStore.isVideoEnabled(), preferredRegion: RTCRegionStore.getPreferredRegion(), preferredRegions: RTCRegionStore.getPreferredRegions(), videoStreamParameters: MediaEngineStore.getVideoStreamParameters(), flags: this.computeVoiceFlags() };
};
prototype["shouldCommit"] = function shouldCommit() {
const socket = this.socket;
return socket.isSessionEstablished();
};
prototype["didCommit"] = function didCommit(state) {
({ guildId, channelId, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, flags } = state);
if (flags === undefined) {
flags = 0;
}
const self = this;
if (selfVideo) {
const channel = ChannelStore.getChannel(channelId);
let type;
if (channel != null) {
type = channel.type;
}
if (type === constants.GUILD_STAGE_VOICE) {
const socket2 = self.socket;
const obj = { guildId, channelId, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, videoStreamParameters: state.videoStreamParameters, flags };
socket2.voiceStateUpdate(obj);
}
}
const socket = self.socket;
socket.voiceStateUpdate({ guildId, channelId, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, flags });
};
const size = fn(2);
const result = size.fileFinishedImporting("modules/gateway/LocalVoiceStateManager.tsx");
export default LocalVoiceStateManager;