69 lines
2.6 KiB
TypeScript
69 lines
2.6 KiB
TypeScript
// Metro module 10513 (f10514).
|
|
import SoundboardStore from "../modules/soundboard/SoundboardStore";
|
|
import SelectedChannelStore from "../stores/SelectedChannelStore";
|
|
import SpeakingStore from "../stores/SpeakingStore";
|
|
import VoiceStateStore from "../stores/VoiceStateStore";
|
|
import { useStateFromStores } from "../_bundle/Module589";
|
|
export default function useIsSpeaking(a0) {
|
|
let selfMute;
|
|
const { userId, checkSoundSharing = false } = a0;
|
|
let c18097_1 = checkSoundSharing;
|
|
let checkSoundboardSounds = a0.checkSoundboardSounds;
|
|
if (checkSoundboardSounds === void 0) {
|
|
checkSoundboardSounds = true;
|
|
}
|
|
let c18097_2 = checkSoundboardSounds;
|
|
let checkIsMuted = a0.checkIsMuted;
|
|
if (checkIsMuted === void 0) {
|
|
checkIsMuted = false;
|
|
}
|
|
const context = a0.context;
|
|
selfMute = void 0;
|
|
const stateFromStores = useStateFromStores([VoiceStateStore, SelectedChannelStore], () => {
|
|
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
|
|
return voiceChannelId != null ? VoiceStateStore.getVoiceStateForChannel(voiceChannelId, userId) : null;
|
|
});
|
|
if (checkIsMuted) {
|
|
checkIsMuted = stateFromStores?.mute || stateFromStores?.selfMute;
|
|
}
|
|
selfMute = checkIsMuted;
|
|
let r30 = useStateFromStores([SpeakingStore], () => SpeakingStore.isSpeaking(userId, context) && !selfMute);
|
|
const stateFromStores2 = useStateFromStores([SpeakingStore], () => SpeakingStore.isSoundSharing(userId) && c18097_1);
|
|
const stateFromStores3 = useStateFromStores([SoundboardStore], () => SoundboardStore.isUserPlayingSounds(userId) && c18097_2);
|
|
if (!r30) {
|
|
r30 = stateFromStores3;
|
|
}
|
|
if (!r30) {
|
|
r30 = stateFromStores2;
|
|
}
|
|
return r30;
|
|
};
|
|
export function getIsSpeaking(a0) {
|
|
const { userId: userId2, checkSoundSharing = false, checkSoundboardSounds = true } = a0;
|
|
let checkIsMuted = a0.checkIsMuted;
|
|
if (checkIsMuted === void 0) {
|
|
checkIsMuted = false;
|
|
}
|
|
const context2 = a0.context;
|
|
let r6 = arguments[1];
|
|
if (r6 === void 0) {
|
|
r6 = [VoiceStateStore, SelectedChannelStore, SpeakingStore, SoundboardStore];
|
|
}
|
|
const [r13, r39, r43, r47] = r6;
|
|
const voiceChannelId = r39.getVoiceChannelId();
|
|
const r55 = voiceChannelId != null ? r13.getVoiceStateForChannel(voiceChannelId, userId2) : null;
|
|
if (checkIsMuted) {
|
|
checkIsMuted = r55?.mute || r55?.selfMute;
|
|
}
|
|
let r62 = r43.isSpeaking(userId2, context2) && !checkIsMuted;
|
|
const r64 = r43.isSoundSharing(userId2) && checkSoundSharing;
|
|
const r66 = r47.isUserPlayingSounds(userId2) && checkSoundboardSounds;
|
|
if (!r62) {
|
|
r62 = r66;
|
|
}
|
|
if (!r62) {
|
|
r62 = r64;
|
|
}
|
|
return r62;
|
|
}
|