decord/source/stores/RTCConnectionDesyncStore.tsx

212 lines
7.5 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13223
// Function ID: 13224
2026-07-29 08:29:29 +00:00
// Name: retryFailedUsers
2026-08-25 06:04:03 +00:00
// Dependencies: [4400, 1391, 4454, 1922, 4399, 4455, 676, 4401, 4417, 4573, 8960, 4479, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 13223 (retryFailedUsers)
2026-08-24 06:08:38 +00:00
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import keysDefault from "keys" /* 4417 */;
import BaseConnectionEvent from "BaseConnectionEvent" /* 4479 */;
import closure_3 from "isVoiceMuted" /* 4400 */;
2026-08-24 06:08:38 +00:00
import closure_4 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_5 from "createRTCConnection" /* 4454 */;
2026-08-24 06:08:38 +00:00
import closure_6 from "mergeGuildAvatar" /* 1922 */;
2026-08-25 06:04:03 +00:00
import closure_7 from "updateVoiceState" /* 4399 */;
import { makeSortedVoiceState } from "getVoiceStatesForGuild" /* 4455 */;
2026-08-24 06:08:38 +00:00
import ME from "ME" /* 676 */;
2026-08-25 06:04:03 +00:00
import { ParticipantTypes } from "ParticipantTypes" /* 4401 */;
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function retryFailedUsers() {
const channelId = store.getChannelId();
if (null == channelId) {
return false;
} else {
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-08-24 06:08:38 +00:00
c2 = false;
2026-07-29 08:29:29 +00:00
const item = set.forEach((userId) => {
2026-08-24 06:08:38 +00:00
if (null == closure_1_7.getVoiceStateForChannel(channelId, userId)) {
const user = closure_1_6.getUser(userId);
2026-07-20 16:05:17 +00:00
if (null != user) {
2026-08-24 06:08:38 +00:00
dependencyMap = true;
closure_1_14.delete(userId);
2026-07-29 08:29:29 +00:00
let obj = { userId: null, channelId: null };
obj[0] = user.id;
obj[1] = tmp;
2026-08-24 06:08:38 +00:00
const tmp23 = new closure_1_3(obj);
2026-07-29 08:29:29 +00:00
let tmp6 = guildId;
if (guildId == null) {
2026-08-24 06:08:38 +00:00
tmp6 = closure_1_9;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
const result = closure_1_12.set(user.id, closure_1_8(tmp23, tmp6, user.id));
2026-07-29 08:29:29 +00:00
obj = { type: null, user: null, id: null, streamId: null, voiceState: null, voicePlatform: null, speaking: false, lastSpoke: 0, soundsharing: false, ringing: false, userNick: null, userAvatarDecoration: null, localVideoDisabled: false, isPoppedOut: false };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_11.USER;
2026-07-29 08:29:29 +00:00
obj[1] = user;
obj[2] = user.id;
obj[4] = tmp23;
2026-08-25 06:04:03 +00:00
obj[10] = guildId(4573).getName(guildId, tmp, user);
const obj2 = guildId(4573);
2026-08-24 06:08:38 +00:00
const tmp24 = closure_1_8;
2026-08-25 06:04:03 +00:00
obj[11] = channelId(8960).getAvatarDecoration(user, guildId);
2026-08-24 06:08:38 +00:00
const result1 = closure_1_13.set(user.id, obj);
2026-08-25 06:04:03 +00:00
const obj3 = channelId(8960);
2026-07-20 16:05:17 +00:00
}
} else {
2026-08-24 06:08:38 +00:00
closure_1_14.delete(userId);
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
return c2;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
({ ME: c9, RTCConnectionStates: c10 } = ME);
2026-08-24 06:08:38 +00:00
let closure_12 = new keysDefault();
const tmp3 = new keysDefault();
let closure_13 = new keysDefault();
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class RTCConnectionDesyncStore extends Store {
}
const prototype = RTCConnectionDesyncStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_7, closure_6, closure_4, closure_5);
const items = [closure_6];
2026-07-29 08:29:29 +00:00
this.syncWith(items, retryFailedUsers);
};
Object.defineProperty(prototype, "desyncedVoiceStatesCount", {
get: function desyncedVoiceStatesCount() {
2026-08-24 06:08:38 +00:00
return set.size();
2026-07-29 08:29:29 +00:00
},
set: undefined
});
prototype["getDesyncedUserIds"] = function getDesyncedUserIds() {
2026-08-24 06:08:38 +00:00
return set.keys();
2026-07-29 08:29:29 +00:00
};
prototype["getDesyncedVoiceStates"] = function getDesyncedVoiceStates() {
2026-08-24 06:08:38 +00:00
return set.values();
2026-07-29 08:29:29 +00:00
};
prototype["getDesyncedParticipants"] = function getDesyncedParticipants() {
2026-08-24 06:08:38 +00:00
return set2.values();
2026-07-29 08:29:29 +00:00
};
RTCConnectionDesyncStore.displayName = "RTCConnectionDesyncStore";
2026-08-24 06:08:38 +00:00
const rTCConnectionDesyncStore = new RTCConnectionDesyncStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
2026-08-24 06:08:38 +00:00
set.clear();
set2.clear();
2026-07-29 08:29:29 +00:00
set.clear();
},
VOICE_CHANNEL_SELECT: function handleReset() {
2026-08-24 06:08:38 +00:00
set.clear();
set2.clear();
2026-07-29 08:29:29 +00:00
set.clear();
2026-07-20 16:05:17 +00:00
},
RTC_CONNECTION_STATE: function handleRTCConnectionState(arg0) {
({ state, context } = arg0);
2026-08-24 06:08:38 +00:00
let tmp = context === BaseConnectionEvent.MediaEngineContextTypes.DEFAULT;
2026-07-20 16:05:17 +00:00
if (tmp) {
if (state === constants.DISCONNECTED) {
2026-08-24 06:08:38 +00:00
set.clear();
set2.clear();
2026-07-29 08:29:29 +00:00
set.clear();
2026-07-20 16:05:17 +00:00
}
tmp = tmp3;
}
return tmp;
},
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
2026-07-29 08:29:29 +00:00
let channelId;
channelId = store.getChannelId();
2026-07-20 16:05:17 +00:00
let reduced = null != channelId;
if (reduced) {
2026-07-29 08:29:29 +00:00
reduced = voiceStates.reduce((arg0, userId) => {
userId = userId.userId;
let tmp = userId.channelId === channelId;
if (tmp) {
2026-08-24 06:08:38 +00:00
let deleteResult = closure_1_12.delete(userId);
const deleteResult1 = closure_1_13.delete(userId);
2026-07-29 08:29:29 +00:00
if (!deleteResult) {
deleteResult = deleteResult1;
}
if (!deleteResult) {
deleteResult = deleteResult2;
}
tmp = deleteResult;
2026-08-24 06:08:38 +00:00
deleteResult2 = closure_1_14.delete(userId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp) {
tmp = arg0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}, false);
}
return reduced;
},
RTC_CONNECTION_CLIENT_CONNECT: function handleRTCConnectionClientConnect(context) {
2026-07-23 10:11:24 +00:00
({ userIds, guildId: require, channelId: importDefault } = context);
2026-08-24 06:08:38 +00:00
let reduced = context.context === BaseConnectionEvent.MediaEngineContextTypes.DEFAULT;
2026-07-20 16:05:17 +00:00
if (reduced) {
2026-07-29 08:29:29 +00:00
reduced = userIds.reduce((arg0, userId) => {
2026-08-24 06:08:38 +00:00
if (null != closure_1_7.getVoiceStateForChannel(closure_1, userId)) {
2026-07-20 16:05:17 +00:00
return arg0;
} else {
2026-08-24 06:08:38 +00:00
const user = closure_1_6.getUser(userId);
2026-07-20 16:05:17 +00:00
if (null == user) {
2026-08-24 06:08:38 +00:00
closure_1_14.add(userId);
2026-07-20 16:05:17 +00:00
let flag = arg0;
} else {
2026-07-29 08:29:29 +00:00
let obj = { userId: null, channelId: null };
obj[0] = user.id;
obj[1] = tmp;
2026-08-24 06:08:38 +00:00
const tmp21 = new closure_1_3(obj);
2026-07-29 08:29:29 +00:00
let tmp2 = closure_0;
if (closure_0 == null) {
2026-08-24 06:08:38 +00:00
tmp2 = closure_1_9;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
const result = closure_1_12.set(user.id, closure_1_8(tmp21, tmp2, user.id));
2026-07-29 08:29:29 +00:00
obj = { type: null, user: null, id: null, streamId: null, voiceState: null, voicePlatform: null, speaking: false, lastSpoke: 0, soundsharing: false, ringing: false, userNick: null, userAvatarDecoration: null, localVideoDisabled: false, isPoppedOut: false };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_11.USER;
2026-07-29 08:29:29 +00:00
obj[1] = user;
obj[2] = user.id;
obj[4] = tmp21;
2026-08-24 06:08:38 +00:00
obj[10] = closure_1_1(closure_1_2[9]).getName(closure_0, tmp, user);
const obj2 = closure_1_1(closure_1_2[9]);
const tmp22 = closure_1_8;
obj[11] = closure_1_0(closure_1_2[10]).getAvatarDecoration(user, closure_0);
const result1 = closure_1_13.set(user.id, obj);
2026-07-20 16:05:17 +00:00
flag = true;
2026-08-24 06:08:38 +00:00
const obj3 = closure_1_0(closure_1_2[10]);
2026-07-20 16:05:17 +00:00
}
return flag;
}
}, false);
}
return reduced;
},
2026-07-29 08:29:29 +00:00
RTC_CONNECTION_CLIENT_DISCONNECT: function handleRTCConnectionClientDisconnect(userId) {
userId = userId.userId;
2026-08-24 06:08:38 +00:00
let tmp = userId.context === BaseConnectionEvent.MediaEngineContextTypes.DEFAULT;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-08-24 06:08:38 +00:00
let deleteResult = set.delete(userId);
const deleteResult1 = set2.delete(userId);
2026-07-29 08:29:29 +00:00
if (!deleteResult) {
deleteResult = deleteResult1;
}
if (!deleteResult) {
deleteResult = deleteResult2;
}
tmp = deleteResult;
deleteResult2 = set.delete(userId);
2026-07-20 16:05:17 +00:00
}
return tmp;
}
});
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("stores/RTCConnectionDesyncStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default rTCConnectionDesyncStore;