decord/stable/source/stores/CallStore.tsx

197 lines
5.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-06 22:12:49 +00:00
// Module ID: 5591
// Function ID: 5592
// Name: CallStore
2026-10-06 22:12:49 +00:00
// Dependencies: [2051, 2102, 4657, 1086, 585, 1283, 12, 504, 2]
2026-10-06 22:12:49 +00:00
// Module 5591 (CallStore)
import _modDef12 from "module_12" /* 12 */;
2026-10-06 22:12:49 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 585 */;
import Constants from "Constants" /* 1086 */;
import HTTPUtils from "HTTPUtils" /* 1283 */;
import ChannelStore from "ChannelStore" /* 2051 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2102 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4657 */;
import size from "module_2" /* 2 */;
function callConnect() {
2026-10-06 22:12:49 +00:00
let obj;
let channelId = arg1;
if (arg1 === undefined) {
channelId = SelectedChannelStore.getChannelId();
}
const channel = ChannelStore.getChannel(channelId);
2026-10-06 22:12:49 +00:00
let tmp3 = null == channel || null != channel.getGuildId() || null == channelId;
if (!tmp3) {
2026-10-06 22:12:49 +00:00
tmp3 = null != obj[channelId] && !arg0;
const tmp5 = null != obj[channelId] && !arg0;
}
let flag = !tmp3;
2026-10-06 22:12:49 +00:00
if (flag) {
let tmp8 = obj[channelId];
2026-10-06 22:12:49 +00:00
const tmp7 = obj;
if (tmp8 == null) {
obj = { channelId, ringing: [] };
tmp8 = obj;
}
2026-10-06 22:12:49 +00:00
tmp7[channelId] = tmp8;
const obj2 = { type: "CALL_CONNECT", channelId };
2026-10-06 22:12:49 +00:00
const obj3 = DispatcherDefault;
obj3.dispatch(obj2);
flag = true;
}
return flag;
}
2026-10-06 22:12:49 +00:00
const Endpoints = Constants.Endpoints;
let calls = {};
2026-10-06 22:12:49 +00:00
const metroImportAll = {};
const Store = get_initializedDefault.Store;
class CallStore extends Store {
2026-10-06 22:12:49 +00:00
initialize() {
this.waitFor(ChannelStore, SelectedChannelStore, SelectedGuildStore);
}
2026-10-06 22:12:49 +00:00
getCall(channelId) {
return obj[channelId];
}
2026-10-06 22:12:49 +00:00
getCalls() {
return Object.values(obj);
}
getMessageId(channelId) {
const call = this.getCall(channelId);
let messageId = null;
if (null != call) {
messageId = call.messageId;
}
return messageId;
}
isCallActive(channelId, id) {
let tmp2 = null != tmp && !tmp.unavailable;
if (tmp2) {
let tmp4;
if (null != id) {
tmp4 = tmp.messageId === id;
} else {
tmp4 = null != tmp.region;
}
tmp2 = tmp4;
}
return tmp2;
}
isCallUnavailable(id) {
return null != obj[id] && obj[id].unavailable;
}
getInternalState() {
calls = { calls, enqueuedRings };
return calls;
}
}
const prototype = CallStore.prototype;
CallStore.displayName = "CallStore";
calls = {
CONNECTION_OPEN: function handleConnectionOpen() {
return callConnect(true);
},
CONNECTION_CLOSED: function handleConnectionClosed() {
2026-10-06 22:12:49 +00:00
let closure_8 = {};
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(callStoreInternalState) {
callStoreInternalState = callStoreInternalState.callStoreInternalState;
const merged = Object.assign(callStoreInternalState.calls);
2026-10-06 22:12:49 +00:00
const obj2 = {};
const merged1 = Object.assign(callStoreInternalState.enqueuedRings);
2026-10-06 22:12:49 +00:00
let closure_8 = obj2;
},
CONNECTION_RESUMED: function handleConnectionResumed() {
return callConnect(true);
},
CHANNEL_SELECT: function handleChannelSelect(channelId) {
return callConnect(false, channelId.channelId);
},
CHANNEL_DELETE: function handleChannelDelete(channel) {
channel = channel.channel;
if (null != enqueuedRings[channel.id]) {
2026-10-06 22:12:49 +00:00
delete enqueuedRings[channel.id];
}
if (null == obj[channel.id]) {
return false;
} else {
2026-10-06 22:12:49 +00:00
delete obj[channel.id];
}
},
CALL_CREATE: function handleCallCreate(channelId) {
2026-10-06 22:12:49 +00:00
let obj2;
channelId = channelId.channelId;
const obj = { channelId, messageId: channelId.messageId, region: channelId.region, ringing: Object.keys(channelId.ongoingRings), unavailable: false, regionUpdated: false };
obj[channelId] = obj;
if (null != enqueuedRings[channelId]) {
2026-10-06 22:12:49 +00:00
delete enqueuedRings[channelId];
let tmp = arr;
if (1 !== enqueuedRings[channelId].indexOf("all")) {
2026-10-06 22:12:49 +00:00
tmp = null;
}
const HTTP = HTTPUtils.HTTP;
2026-10-06 22:12:49 +00:00
const request = { url: Endpoints.CALL_RING(channelId), body: obj2, oldFormErrors: true, rejectWithError: true };
const post = HTTP.post;
obj2 = { recipients: tmp };
post(request);
}
},
CALL_UPDATE: function handleCallUpdate(arg0) {
2026-10-06 22:12:49 +00:00
let channelId;
let messageId;
let obj;
let ongoingRings;
let region;
({ channelId, region } = arg0);
let tmp2 = null != tmp;
({ messageId, ongoingRings } = arg0);
if (tmp2) {
2026-10-06 22:12:49 +00:00
tmp2 = obj[channelId].regionUpdated || obj[channelId].region !== region;
}
2026-10-06 22:12:49 +00:00
obj = { messageId, region, ringing: Object.keys(ongoingRings), regionUpdated: tmp2 };
const merged = Object.assign(obj[channelId]);
obj[channelId] = obj;
},
CALL_DELETE: function handleCallDelete(arg0) {
2026-10-06 22:12:49 +00:00
let channelId;
let obj;
let unavailable;
({ channelId, unavailable } = arg0);
if (true === unavailable) {
2026-10-06 22:12:49 +00:00
if (null != obj[channelId]) {
obj = { unavailable };
const merged = Object.assign(tmp);
}
2026-10-06 22:12:49 +00:00
tmp2[channelId] = { channelId, ringing: [], messageId: null, region: null, regionUpdated: false, unavailable };
if (null != enqueuedRings[channelId]) {
2026-10-06 22:12:49 +00:00
delete enqueuedRings[channelId];
}
}
},
CALL_ENQUEUE_RING: function handleCallEnqueueRing(arg0) {
2026-10-06 22:12:49 +00:00
let channelId;
let recipients;
({ channelId, recipients } = arg0);
let items = enqueuedRings[channelId];
2026-10-06 22:12:49 +00:00
const union = _modDef12.union;
_modDef12;
const tmp = enqueuedRings;
if (items == null) {
items = [];
}
if (recipients == null) {
recipients = ["all"];
}
2026-10-06 22:12:49 +00:00
tmp[channelId] = union(items, recipients);
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(channelId) {
if (null == channelId.channelId) {
2026-10-06 22:12:49 +00:00
let closure_8 = {};
}
}
};
const callStore = new CallStore(DispatcherDefault, calls);
const result = size.fileFinishedImporting("stores/CallStore.tsx");
export default callStore;