decord/stable/source/modules/guild_rooms/GuildRoomManager.tsx
2026-10-06 22:12:49 +00:00

100 lines
3.7 KiB
TypeScript

// Module ID: 17143
// Function ID: 17144
// Name: GuildRoomManager
// Dependencies: [502, 4995, 6540, 5037, 4993, 2]
// Module 17143 (GuildRoomManager)
import GuildRoomActionCreators from "GuildRoomActionCreators" /* 4993 */;
import GuildRoomsExperiment from "GuildRoomsExperiment" /* 5037 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import GuildRoomStore from "GuildRoomStore" /* 4995 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6540 */;
import size from "module_2" /* 2 */;
const channelId = null;
const guildId = null;
class GuildRoomManager extends AutomaticLifecycleManager {
constructor() {
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
applyArgumentsResult.actions = {
VOICE_STATE_UPDATES(arg0) {
return applyArgumentsResult.handleVoiceStateUpdates(arg0);
},
CONNECTION_RESUMED() {
return applyArgumentsResult.handleConnectionResumed();
}
};
return applyArgumentsResult;
}
isExperimentEnabled(guildId, VOICE_STATE_UPDATE) {
const obj = GuildRoomsExperiment;
const obj2 = { guildId, location: VOICE_STATE_UPDATE };
return obj.getGuildRoomsConfig(obj2).enabled;
}
handleVoiceStateUpdates(arg0) {
let oldChannelId;
let sessionId;
let userId;
const self = this;
const iter = arg0.voiceStates[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
({ userId, guildId, channelId, sessionId, oldChannelId } = nextResult);
let obj = AuthenticationStore;
let tmp2 = userId;
if (userId === AuthenticationStore.getId()) {
if (sessionId === obj.getSessionId()) {
if (channelId !== channelId) {
let isExperimentEnabledResult = null != channelId;
if (isExperimentEnabledResult) {
isExperimentEnabledResult = null != guildId;
}
if (isExperimentEnabledResult) {
isExperimentEnabledResult = self.isExperimentEnabled(guildId, "VOICE_STATE_UPDATE");
}
if (isExperimentEnabledResult) {
let obj3 = GuildRoomActionCreators;
let guildRoomDisconnectResult = obj3.guildRoomDisconnect(guildId, channelId);
}
if (null != channelId) {
if (null != guildId) {
let pendingPosition = GuildRoomStore.getPendingPosition();
let pendingSeat = GuildRoomStore.getPendingSeat();
if (self.isExperimentEnabled(guildId, "VOICE_STATE_UPDATE")) {
let obj4 = GuildRoomActionCreators;
let guildRoomConnectResult = obj4.guildRoomConnect(guildId, channelId, pendingPosition, pendingSeat);
}
}
}
}
}
} else {
let tmp4 = null != oldChannelId;
if (tmp4) {
tmp4 = oldChannelId !== channelId;
}
if (tmp4) {
let obj2 = GuildRoomActionCreators;
let result = obj2.guildRoomLocalDisconnect(tmp2, oldChannelId);
}
}
continue;
}
}
handleConnectionResumed() {
let isExperimentEnabledResult = null != channelId && null != guildId;
if (isExperimentEnabledResult) {
const self = this;
isExperimentEnabledResult = this.isExperimentEnabled(guildId, "CONNECTION_RESUMED");
}
if (isExperimentEnabledResult) {
const obj = GuildRoomActionCreators;
const guildRoom = obj.fetchGuildRoom(guildId, channelId);
}
}
}
const prototype = GuildRoomManager.prototype;
const guildRoomManager = new GuildRoomManager();
let result = size.fileFinishedImporting("modules/guild_rooms/GuildRoomManager.tsx");
export default guildRoomManager;