decord/source/modules/calls/ChannelCallManager.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

139 lines
5.9 KiB
TypeScript

// Module ID: 17422
// Function ID: 17423
// Name: ChannelCallManager
// Dependencies: [9973, 5328, 1957, 10151, 2011, 4450, 4624, 4629, 4621, 9972, 7170, 2]
// Module 17422 (ChannelCallManager)
import SoundpackStore from "SoundpackStore" /* 9973 */;
import CallStore from "CallStore" /* 5328 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import NotificationSettingsStore from "NotificationSettingsStore" /* 10151 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import StreamerModeStore from "StreamerModeStore" /* 4450 */;
import VoiceStateStore from "VoiceStateStore" /* 4624 */;
import SortedVoiceStateStore from "SortedVoiceStateStore" /* 4629 */;
import ChannelRTCStore from "ChannelRTCStore" /* 4621 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7170 */;
let require = fn;
const SoundUtils = fn(9972);
let closure_11 = SoundUtils.createSoundForPack("call_calling", SoundpackStore.getSoundpack());
class ChannelCallManager extends tmp2 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
tmp3 = _n;
set = new Set();
if (_n in applyArgumentsResult) {
str = "Cannot initialize private field twice.";
throw new TypeError("Cannot initialize private field twice.");
} else {
tmp5 = set;
applyArgumentsResult[set] = tmp3;
obj = { GUILD_LOCAL_RING_START: null, GUILD_RING_STOP: null };
obj.GUILD_LOCAL_RING_START = function GUILD_LOCAL_RING_START(arg0) {
return applyArgumentsResult.handleGuildRingStart(arg0);
};
obj.GUILD_RING_STOP = function GUILD_RING_STOP(arg0) {
return applyArgumentsResult.handleGuildRingStop(arg0);
};
applyArgumentsResult.actions = obj;
applyArgumentsResult._handleRing = function _handleRing(someResult, guildId) {
currentClientVoiceChannelId = currentClientVoiceChannelId.getCurrentClientVoiceChannelId(guildId);
let tmp2 = null != currentClientVoiceChannelId;
if (tmp2) {
tmp2 = SortedVoiceStateStore.countVoiceStatesForChannel(currentClientVoiceChannelId) >= 2;
}
if (null != currentClientVoiceChannelId) {
if (!tmp2) {
if (someResult) {
if (!soundDisabled.isSoundDisabled("call_calling")) {
if (!disableSounds.disableSounds) {
closure_11.loop();
}
}
}
}
}
closure_11.stop();
};
applyArgumentsResult.handleSoundpackUpdate = function handleSoundpackUpdate() {
closure_11.stop();
closure_11 = applyArgumentsResult(dependencyMap[9]).createSoundForPack("call_calling", soundpack.getSoundpack());
};
applyArgumentsResult.handleRingUpdate = function handleRingUpdate() {
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
if (guild_id == null) {
guild_id = null;
}
const calls = CallStore.getCalls();
let someResult = calls.some((ringing) => {
let tmp = ringing.ringing.length > 0;
if (tmp) {
tmp = currentClientVoiceChannelId.getCurrentClientVoiceChannelId(null) === ringing.channelId;
}
return tmp;
});
if (!someResult) {
someResult = applyArgumentsResult.#n.size > 0;
}
applyArgumentsResult._handleRing(someResult, guild_id);
};
applyArgumentsResult.handleGuildRingStart = function handleGuildRingStart(arg0) {
({ ringing, guildId } = arg0);
const item = ringing.forEach((item) => {
closure_1_0[closure_2_12].add(item);
});
applyArgumentsResult._handleRing(applyArgumentsResult.#n.size > 0, guildId);
};
applyArgumentsResult.handleGuildRingStop = function handleGuildRingStop(arg0) {
({ ringing, guildId } = arg0);
const item = ringing.forEach((item) => {
closure_1_0[closure_2_12].delete(item);
});
applyArgumentsResult._handleRing(applyArgumentsResult.#n.size > 0, guildId);
};
applyArgumentsResult.handleChannelRTCStoreChange = function handleChannelRTCStoreChange() {
voiceChannelId = voiceChannelId.getVoiceChannelId();
if (applyArgumentsResult[closure_1_12].size > 0) {
if (null == voiceChannelId) {
const _Set = Set;
const set = new Set();
obj[tmp2] = set;
obj._handleRing(obj[tmp2].size > 0, null);
} else if (null != voiceChannelId) {
applyArgumentsResult = guildRingingUsers.getGuildRingingUsers(voiceChannelId);
const _Set2 = Set;
const items = [];
HermesBuiltin.arraySpread(obj[tmp2], 0);
const set1 = new Set(items.filter((item) => !set.has(item)));
if (set1.size > 0) {
const item = set1.forEach((item) => {
set[closure_2_12].delete(item);
});
obj._handleRing(obj[tmp2].size > 0, null);
}
}
}
};
return applyArgumentsResult;
}
}
}
ChannelCallManager.prototype["_initialize"] = function _initialize() {
const result = new Map().set(CallStore, this.handleRingUpdate);
const result1 = result.set(NotificationSettingsStore, this.handleRingUpdate);
const result2 = result1.set(StreamerModeStore, this.handleRingUpdate);
const result3 = result2.set(VoiceStateStore, this.handleRingUpdate);
const result4 = result3.set(ChannelRTCStore, this.handleChannelRTCStoreChange);
this.stores = result4.set(SoundpackStore, this.handleSoundpackUpdate);
};
const channelCallManager = new ChannelCallManager();
const size = fn(2);
let result = size.fileFinishedImporting("modules/calls/ChannelCallManager.tsx");
export default channelCallManager;