decord/source/modules/gateway/LocalVoiceStateManager.tsx

80 lines
3.4 KiB
TypeScript
Raw Normal View History

// Module ID: 13762
// Function ID: 13763
// Name: LocalVoiceStateManager
// Dependencies: [1957, 1908, 4686, 1074, 13760, 1935, 1384, 13763, 2]
2026-07-20 16:05:17 +00:00
// Module 13762 (LocalVoiceStateManager)
import FlagUtils from "FlagUtils" /* 1384 */;
import UserSettings from "UserSettings" /* 1935 */;
import isClipsEnabled from "isClipsEnabled" /* 13763 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import MediaEngineStore from "MediaEngineStore" /* 1908 */;
import RTCRegionStore from "RTCRegionStore" /* 4686 */;
import StateManager from "StateManager" /* 13760 */;
2026-07-23 10:11:24 +00:00
require = fn;
const Constants = fn(1074);
({ ChannelTypes: hasOwnProperty, VoiceFlags: metroRequire } = Constants);
2026-07-29 08:29:29 +00:00
class LocalVoiceStateManager extends tmp3 {
constructor(arg0) {
tmp = new LocalVoiceStateManager(new.target);
tmp.socket = global;
return tmp;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
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;
2026-07-29 08:29:29 +00:00
const setting = ClipsAllowVoiceRecording.getSetting();
const setFlagResult = FlagUtils.setFlag(0, constants2.ALLOW_VOICE_RECORDING, setting);
const obj2 = FlagUtils;
2026-08-25 06:04:03 +00:00
return obj2.setFlag(setFlagResult, constants2.CLIPS_ENABLED, isClipsEnabled.isClipsEnabled());
2026-07-29 08:29:29 +00:00
};
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 };
2026-07-29 08:29:29 +00:00
};
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() };
2026-07-29 08:29:29 +00:00
};
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);
2026-07-29 08:29:29 +00:00
let type;
if (channel != null) {
type = channel.type;
}
2026-08-25 06:04:03 +00:00
if (type === constants.GUILD_STAGE_VOICE) {
2026-07-29 08:29:29 +00:00
const socket2 = self.socket;
const obj = { guildId, channelId, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, videoStreamParameters: state.videoStreamParameters, flags };
2026-07-29 08:29:29 +00:00
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");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default LocalVoiceStateManager;