decord/alpha/source/hooks/useIsSpeaking.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

126 lines
3.9 KiB
TypeScript

// Module ID: 8999
// Function ID: 9000
// Name: useIsSpeaking
// Dependencies: [5503, 2098, 5917, 4864, 504, 2]
// Exports: default, getIsSpeaking
// Module 8999 (useIsSpeaking)
import SoundboardStore from "SoundboardStore" /* 5503 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2098 */;
import SpeakingStore from "SpeakingStore" /* 5917 */;
import VoiceStateStore from "VoiceStateStore" /* 4864 */;
const require = globalThis.__r;
const require = fn;
const size = fn(2);
const result = size.fileFinishedImporting("hooks/useIsSpeaking.tsx");
export default function useIsSpeaking(checkSoundboardSounds) {
({ userId: require, checkSoundSharing } = checkSoundboardSounds);
if (checkSoundSharing === undefined) {
checkSoundSharing = false;
}
let flag = checkSoundboardSounds.checkSoundboardSounds;
if (flag === undefined) {
flag = true;
}
let flag2 = checkSoundboardSounds.checkIsMuted;
if (flag2 === undefined) {
flag2 = false;
}
const context = checkSoundboardSounds.context;
flag2 = undefined;
const items = [VoiceStateStore, context];
const stateFromStores = require("initialize").useStateFromStores(items, () => {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
let voiceStateForChannel = null;
if (null != voiceChannelId) {
voiceStateForChannel = VoiceStateStore.getVoiceStateForChannel(voiceChannelId, require);
}
return voiceStateForChannel;
});
if (flag2) {
let mute;
if (stateFromStores != null) {
mute = stateFromStores.mute;
}
if (!mute) {
let selfMute;
if (stateFromStores != null) {
selfMute = stateFromStores.selfMute;
}
mute = selfMute;
}
flag2 = mute;
}
const obj = require("initialize");
const items1 = [flag2];
let stateFromStores1 = require("initialize").useStateFromStores(items1, () => {
let isSpeakingResult = SpeakingStore.isSpeaking(require, context);
if (isSpeakingResult) {
isSpeakingResult = !flag2;
}
return isSpeakingResult;
});
const tmpResult = require("initialize");
const items2 = [flag2];
const stateFromStores2 = require("initialize").useStateFromStores(items2, () => SpeakingStore.isSoundSharing(require) && checkSoundSharing);
const tmpResult3 = require("initialize");
const items3 = [flag];
if (!stateFromStores1) {
stateFromStores1 = tmpResult4.useStateFromStores(items3, () => SoundboardStore.isUserPlayingSounds(require) && flag);
}
if (!stateFromStores1) {
stateFromStores1 = stateFromStores2;
}
return stateFromStores1;
};
export const getIsSpeaking = function getIsSpeaking(checkSoundboardSounds) {
({ userId, checkSoundSharing } = checkSoundboardSounds);
if (checkSoundSharing === undefined) {
checkSoundSharing = false;
}
let flag = checkSoundboardSounds.checkSoundboardSounds;
if (flag === undefined) {
flag = true;
}
let flag2 = checkSoundboardSounds.checkIsMuted;
if (flag2 === undefined) {
flag2 = false;
}
let tmp = arg1;
if (arg1 === undefined) {
const items = [VoiceStateStore, SelectedChannelStore, SpeakingStore, SoundboardStore];
tmp = items;
}
[obj, obj2, obj3, obj4] = tmp;
const voiceChannelId = obj2.getVoiceChannelId();
let voiceStateForChannel = null;
if (null != voiceChannelId) {
voiceStateForChannel = obj.getVoiceStateForChannel(voiceChannelId, userId);
}
if (flag2) {
let mute;
if (voiceStateForChannel != null) {
mute = voiceStateForChannel.mute;
}
if (!mute) {
let selfMute;
if (voiceStateForChannel != null) {
selfMute = voiceStateForChannel.selfMute;
}
mute = selfMute;
}
flag2 = mute;
}
let tmp10 = obj3.isSpeaking(userId, checkSoundboardSounds.context) && !flag2;
const tmp11 = obj3.isSoundSharing(userId) && checkSoundSharing;
if (!tmp10) {
tmp10 = tmp12;
}
if (!tmp10) {
tmp10 = tmp11;
}
return tmp10;
};