decord/source/stores/PermissionVADStore.tsx

94 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13865
// Function ID: 13866
2026-07-29 08:29:29 +00:00
// Name: handleUpdateVADPermission
2026-08-25 06:04:03 +00:00
// Dependencies: [1218, 1391, 4431, 4025, 4454, 4399, 676, 709, 589, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 13865 (handleUpdateVADPermission)
2026-08-24 06:08:38 +00:00
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_2 from "fetchFingerprint" /* 1218 */;
import closure_3 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "_detectH265HardwareDecode" /* 4431 */;
import closure_5 from "getUncachedChannelPermissions" /* 4025 */;
import closure_6 from "createRTCConnection" /* 4454 */;
import closure_7 from "updateVoiceState" /* 4399 */;
2026-08-24 06:08:38 +00:00
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function handleUpdateVADPermission() {
2026-07-23 10:11:24 +00:00
channelId = channelId.getChannelId();
2026-07-20 16:05:17 +00:00
let flag = true;
if (null != channelId) {
2026-07-23 10:11:24 +00:00
channel = channel.getChannel(channelId);
2026-07-20 16:05:17 +00:00
let guildId;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guildId = channel.getGuildId();
}
2026-07-23 10:11:24 +00:00
voiceState = voiceState.getVoiceState(guildId, id.getId());
2026-07-20 16:05:17 +00:00
let canResult = mode.getMode() !== constants.VOICE_ACTIVITY || null == channel || channel.isPrivate() || channel.isGuildStageVoice();
if (!canResult) {
2026-08-24 06:08:38 +00:00
canResult = closure_5.can(constants2.USE_VAD, channel);
2026-07-20 16:05:17 +00:00
}
if (!canResult) {
canResult = null == voiceState || voiceState.suppress || null != voiceState.requestToSpeakTimestamp;
const tmp12 = null == voiceState || voiceState.suppress || null != voiceState.requestToSpeakTimestamp;
}
flag = canResult;
}
2026-07-23 10:11:24 +00:00
let flag2 = flag !== flag;
2026-07-20 16:05:17 +00:00
if (flag2) {
2026-07-29 08:29:29 +00:00
const obj = { type: "SET_VAD_PERMISSION", hasPermission: null };
obj[1] = flag;
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch(obj);
2026-07-20 16:05:17 +00:00
flag2 = true;
2026-08-24 06:08:38 +00:00
const obj2 = dispatcherDefault;
2026-07-20 16:05:17 +00:00
}
return flag2;
}
2026-08-24 06:08:38 +00:00
({ InputModes: closure_8, Permissions: c9 } = ME);
2026-07-29 08:29:29 +00:00
let c10 = true;
let c11 = true;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class PermissionVADStore extends Store {
}
const prototype = PermissionVADStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_2, closure_3, closure_4, closure_5, closure_6, closure_7);
2026-07-29 08:29:29 +00:00
};
prototype["shouldShowWarning"] = function shouldShowWarning() {
return !c11;
};
prototype["canUseVoiceActivity"] = function canUseVoiceActivity() {
return c10;
};
PermissionVADStore.displayName = "PermissionVADStore";
2026-08-24 06:08:38 +00:00
const permissionVADStore = new PermissionVADStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
RTC_CONNECTION_STATE: handleUpdateVADPermission,
MEDIA_ENGINE_SET_AUDIO_ENABLED: handleUpdateVADPermission,
AUDIO_SET_MODE: handleUpdateVADPermission,
CHANNEL_UPDATES: handleUpdateVADPermission,
THREAD_UPDATE: handleUpdateVADPermission,
GUILD_ROLE_UPDATE: handleUpdateVADPermission,
GUILD_MEMBER_UPDATE: handleUpdateVADPermission,
IMPERSONATE_UPDATE: handleUpdateVADPermission,
IMPERSONATE_STOP: handleUpdateVADPermission,
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
return voiceStates.some((userId) => {
2026-07-29 08:29:29 +00:00
let tmp = userId.userId === id.getId();
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp = callback();
2026-07-20 16:05:17 +00:00
}
return tmp;
});
},
AUDIO_TOGGLE_SELF_MUTE: function handleUnclearWarning() {
2026-08-24 06:08:38 +00:00
closure_11 = c10;
2026-07-20 16:05:17 +00:00
},
PERMISSION_CLEAR_VAD_WARNING: function handleClearWarning() {
2026-08-24 06:08:38 +00:00
c11 = true;
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("stores/PermissionVADStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default permissionVADStore;