decord/source/hooks/useIsSpeaking.tsx

127 lines
3.9 KiB
TypeScript
Raw Normal View History

// Module ID: 9571
// Function ID: 9572
2026-07-29 08:29:29 +00:00
// Name: useIsSpeaking
// Dependencies: [5064, 2011, 5471, 4626, 504, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, getIsSpeaking
// Module 9571 (useIsSpeaking)
import SoundboardStore from "SoundboardStore" /* 5064 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import SpeakingStore from "SpeakingStore" /* 5471 */;
import VoiceStateStore from "VoiceStateStore" /* 4626 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const require = fn;
const size = fn(2);
const result = size.fileFinishedImporting("hooks/useIsSpeaking.tsx");
2026-07-20 16:05:17 +00:00
export default function useIsSpeaking(checkSoundboardSounds) {
2026-07-23 10:11:24 +00:00
({ userId: require, checkSoundSharing } = checkSoundboardSounds);
2026-07-20 16:05:17 +00:00
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;
2026-07-23 10:11:24 +00:00
flag2 = undefined;
const items = [VoiceStateStore, context];
const stateFromStores = require("initialize").useStateFromStores(items, () => {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
2026-07-20 16:05:17 +00:00
let voiceStateForChannel = null;
if (null != voiceChannelId) {
voiceStateForChannel = VoiceStateStore.getVoiceStateForChannel(voiceChannelId, require);
2026-07-20 16:05:17 +00:00
}
return voiceStateForChannel;
});
if (flag2) {
let mute;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
mute = stateFromStores.mute;
}
if (!mute) {
let selfMute;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
selfMute = stateFromStores.selfMute;
}
mute = selfMute;
}
flag2 = mute;
}
const obj = require("initialize");
2026-07-23 10:11:24 +00:00
const items1 = [flag2];
let stateFromStores1 = require("initialize").useStateFromStores(items1, () => {
let isSpeakingResult = SpeakingStore.isSpeaking(require, context);
2026-07-20 16:05:17 +00:00
if (isSpeakingResult) {
isSpeakingResult = !flag2;
}
return isSpeakingResult;
});
const tmpResult = require("initialize");
2026-07-23 10:11:24 +00:00
const items2 = [flag2];
const stateFromStores2 = require("initialize").useStateFromStores(items2, () => SpeakingStore.isSoundSharing(require) && checkSoundSharing);
const tmpResult3 = require("initialize");
2026-07-23 10:11:24 +00:00
const items3 = [flag];
2026-07-29 08:29:29 +00:00
if (!stateFromStores1) {
stateFromStores1 = tmpResult4.useStateFromStores(items3, () => SoundboardStore.isUserPlayingSounds(require) && flag);
2026-07-29 08:29:29 +00:00
}
if (!stateFromStores1) {
stateFromStores1 = stateFromStores2;
}
return stateFromStores1;
2026-07-20 16:05:17 +00:00
};
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;
}
2026-07-29 08:29:29 +00:00
let tmp = arg1;
if (arg1 === undefined) {
const items = [VoiceStateStore, SelectedChannelStore, SpeakingStore, SoundboardStore];
2026-07-20 16:05:17 +00:00
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;
2026-07-29 08:29:29 +00:00
if (voiceStateForChannel != null) {
2026-07-20 16:05:17 +00:00
mute = voiceStateForChannel.mute;
}
if (!mute) {
let selfMute;
2026-07-29 08:29:29 +00:00
if (voiceStateForChannel != null) {
2026-07-20 16:05:17 +00:00
selfMute = voiceStateForChannel.selfMute;
}
mute = selfMute;
}
flag2 = mute;
}
2026-07-29 08:29:29 +00:00
let tmp10 = obj3.isSpeaking(userId, checkSoundboardSounds.context) && !flag2;
2026-07-20 16:05:17 +00:00
const tmp11 = obj3.isSoundSharing(userId) && checkSoundSharing;
2026-07-29 08:29:29 +00:00
if (!tmp10) {
tmp10 = tmp12;
}
if (!tmp10) {
tmp10 = tmp11;
}
return tmp10;
2026-07-20 16:05:17 +00:00
};