decord/source/modules/voice_calls/VoicePermissionManager.tsx

104 lines
4.2 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 16625
// Function ID: 16626
2026-07-29 08:29:29 +00:00
// Name: handleVoiceChannelSelect
2026-08-24 06:08:38 +00:00
// Dependencies: [4995, 4548, 1218, 1391, 4501, 4544, 676, 4844, 4845, 16626, 4986, 5043, 2]
2026-07-29 08:29:29 +00:00
// Exports: shouldImmediatelyRequestVoicePermissions
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 16625 (handleVoiceChannelSelect)
import initializeDefault from "initialize" /* 5043 */;
import closure_3 from "buildStageChannelUserRoles" /* 4995 */;
import closure_4 from "isVoiceMuted" /* 4548 */;
import closure_5 from "fetchFingerprint" /* 1218 */;
import closure_6 from "ensureGuildLoaded" /* 1391 */;
import closure_7 from "_detectH265HardwareDecode" /* 4501 */;
import closure_8 from "createRTCConnection" /* 4544 */;
import { InputModes } from "ME" /* 676 */;
import { NativePermissionTypes } from "NativePermissionStatus" /* 4844 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let c11 = null;
2026-08-24 06:08:38 +00:00
initializeDefault;
2026-07-29 08:29:29 +00:00
class VoicePermissionManager extends tmp2 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
applyArgumentsResult.actions = { VOICE_STATE_UPDATES: applyArgumentsResult.handleVoiceStateUpdates, VOICE_CHANNEL_SELECT: applyArgumentsResult.handleVoiceChannelSelect };
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = VoicePermissionManager.prototype;
prototype["handleVoiceChannelSelect"] = function handleVoiceChannelSelect(channelId) {
if (null == channelId.channelId) {
2026-08-24 06:08:38 +00:00
c11 = null;
2026-07-29 08:29:29 +00:00
}
};
prototype["handleVoiceStateUpdates"] = function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
const item = voiceStates.forEach((arg0) => {
({ userId, channelId } = arg0);
if (null != channelId) {
if (id.getId() === userId) {
if (null != rTCConnectionId.getRTCConnectionId()) {
if (channelId !== channelId) {
channel = channel.getChannel(channelId);
let isListenModeCapableResult;
if (channel != null) {
isListenModeCapableResult = channel.isListenModeCapable();
}
let isSpeakerResult = !isListenModeCapableResult;
if (isListenModeCapableResult) {
isSpeakerResult = speaker.isSpeaker(userId, channelId);
}
if (isSpeakerResult) {
2026-08-24 06:08:38 +00:00
const permission = callback2(4845).requestPermission(constants2.AUDIO);
2026-07-29 08:29:29 +00:00
permission.then((arg0) => {
if (arg0) {
callback(table[9])(true);
}
});
if (store.getMode() === constants.PUSH_TO_TALK) {
2026-08-24 06:08:38 +00:00
const permission1 = callback2(4845).requestPermission(constants2.INPUT_MONITORING);
const tmp19Result = callback2(4845);
2026-07-29 08:29:29 +00:00
}
} else {
2026-08-24 06:08:38 +00:00
const tmp8 = new closure_4(arg0);
const audienceRequestToSpeakState = callback(4986).getAudienceRequestToSpeakState(tmp8);
if (audienceRequestToSpeakState === callback(4986).RequestToSpeakStates.REQUESTED_TO_SPEAK_AND_AWAITING_USER_ACK) {
const permission2 = callback2(4845).requestPermission(constants2.AUDIO);
2026-07-29 08:29:29 +00:00
permission2.then((arg0) => {
if (arg0) {
callback(table[9])(true);
}
});
if (store.getMode() === constants.PUSH_TO_TALK) {
2026-08-24 06:08:38 +00:00
const permission3 = tmp13(4845).requestPermission(tmp14.INPUT_MONITORING);
const tmp13Result = tmp13(4845);
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
const obj2 = callback2(4845);
2026-07-29 08:29:29 +00:00
tmp13 = callback2;
tmp14 = constants2;
}
2026-08-24 06:08:38 +00:00
const obj = callback(4986);
2026-07-29 08:29:29 +00:00
}
}
}
}
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
};
const voicePermissionManager = new VoicePermissionManager();
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/voice_calls/VoicePermissionManager.tsx");
2026-07-29 08:29:29 +00:00
export default voicePermissionManager;
export const shouldImmediatelyRequestVoicePermissions = function shouldImmediatelyRequestVoicePermissions(id, id2) {
2026-07-23 10:11:24 +00:00
channel = channel.getChannel(id2);
2026-07-20 16:05:17 +00:00
let isListenModeCapableResult;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
isListenModeCapableResult = channel.isListenModeCapable();
}
let isSpeakerResult = !isListenModeCapableResult;
2026-07-29 08:29:29 +00:00
if (isListenModeCapableResult) {
2026-07-20 16:05:17 +00:00
isSpeakerResult = speaker.isSpeaker(id, id2);
}
return isSpeakerResult;
2026-07-29 08:29:29 +00:00
};