// Metro module 12734 (f12735). import RunningGameStore_native from "../game_detection/RunningGameStore.native"; import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore"; import ChannelStore from "../../stores/ChannelStore"; import MediaEngineStore from "../../stores/MediaEngineStore"; import RTCRegionStore from "../../stores/RTCRegionStore"; import { ApplicationStreamStates, ChannelTypes, VoiceFlags } from "../../Constants"; import StateManager from "../../lib/StateManager"; import { ClipsAllowVoiceRecording } from "../user_settings/UserSettings"; import { setFlag } from "../../_bundle/Module1384"; import { isClipsEnabled, isDecoupledClipsEnabled } from "../clips/isClipsEnabled"; class LocalVoiceStateManager extends StateManager { constructor(a0) { super(); this.socket = a0; } get guildId() { return this.getState().guildId; } get channelId() { return this.getState().channelId; } computeVoiceFlags() { const r19 = setFlag(0, VoiceFlags.ALLOW_VOICE_RECORDING, ClipsAllowVoiceRecording.getSetting()); let r23 = isClipsEnabled() && (ApplicationStreamingStore.getCurrentUserActiveStream()?.state === ApplicationStreamStates.ACTIVE || ApplicationStreamingStore.getCurrentUserActiveStream()?.state === ApplicationStreamStates.PAUSED); const r37 = isDecoupledClipsEnabled() && RunningGameStore_native.getVisibleGame()?.windowHandle != null; const CLIPS_ENABLED = VoiceFlags.CLIPS_ENABLED; if (!r23) { r23 = r37; } return setFlag(r19, CLIPS_ENABLED, r23); } getInitialState() { return { guildId: null, channelId: null, selfMute: MediaEngineStore.isSelfMute(), selfDeaf: MediaEngineStore.isSelfDeaf(), selfVideo: MediaEngineStore.isVideoEnabled(), preferredRegion: null, preferredRegions: null, videoStreamParameters: null, flags: 0 }; } getNextState(a0) { return { guildId: a0.guildId, channelId: a0.channelId, selfMute: MediaEngineStore.isSelfMute(), selfDeaf: MediaEngineStore.isSelfDeaf(), selfVideo: MediaEngineStore.isVideoEnabled(), preferredRegion: RTCRegionStore.getPreferredRegion(), preferredRegions: RTCRegionStore.getPreferredRegions(), videoStreamParameters: MediaEngineStore.getVideoStreamParameters(), flags: this.computeVoiceFlags() }; } shouldCommit() { return this.socket.isSessionEstablished(); } didCommit({ guildId: guildId2, channelId: channelId2, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, videoStreamParameters, flags = 0 }) { if (selfVideo) { if (ChannelStore.getChannel(channelId2)?.type === ChannelTypes.GUILD_STAGE_VOICE) { this.socket.voiceStateUpdate({ guildId: guildId2, channelId: channelId2, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, videoStreamParameters, flags }); } else { this.socket.voiceStateUpdate({ guildId: guildId2, channelId: channelId2, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, flags }); } } else { this.socket.voiceStateUpdate({ guildId: guildId2, channelId: channelId2, selfMute, selfDeaf, selfVideo, preferredRegion, preferredRegions, flags }); } } } export default LocalVoiceStateManager;