2026-10-06 22:12:49 +00:00
|
|
|
// Module ID: 5591
|
|
|
|
|
// Function ID: 5592
|
2026-09-18 20:18:48 +00:00
|
|
|
// Name: CallStore
|
2026-10-06 22:12:49 +00:00
|
|
|
// Dependencies: [2051, 2102, 4657, 1086, 585, 1283, 12, 504, 2]
|
2026-09-18 20:18:48 +00:00
|
|
|
|
2026-10-06 22:12:49 +00:00
|
|
|
// Module 5591 (CallStore)
|
2026-09-18 20:18:48 +00:00
|
|
|
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 */;
|
2026-09-18 20:18:48 +00:00
|
|
|
|
|
|
|
|
function callConnect() {
|
2026-10-06 22:12:49 +00:00
|
|
|
let obj;
|
2026-09-18 20:18:48 +00:00
|
|
|
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;
|
2026-09-18 20:18:48 +00:00
|
|
|
if (!tmp3) {
|
2026-10-06 22:12:49 +00:00
|
|
|
tmp3 = null != obj[channelId] && !arg0;
|
|
|
|
|
const tmp5 = null != obj[channelId] && !arg0;
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
let flag = !tmp3;
|
2026-10-06 22:12:49 +00:00
|
|
|
if (flag) {
|
2026-09-18 20:18:48 +00:00
|
|
|
let tmp8 = obj[channelId];
|
2026-10-06 22:12:49 +00:00
|
|
|
const tmp7 = obj;
|
2026-09-18 20:18:48 +00:00
|
|
|
if (tmp8 == null) {
|
|
|
|
|
obj = { channelId, ringing: [] };
|
|
|
|
|
tmp8 = obj;
|
|
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
tmp7[channelId] = tmp8;
|
2026-09-18 20:18:48 +00:00
|
|
|
const obj2 = { type: "CALL_CONNECT", channelId };
|
2026-10-06 22:12:49 +00:00
|
|
|
const obj3 = DispatcherDefault;
|
|
|
|
|
obj3.dispatch(obj2);
|
2026-09-18 20:18:48 +00:00
|
|
|
flag = true;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
const Endpoints = Constants.Endpoints;
|
2026-09-18 20:18:48 +00:00
|
|
|
let calls = {};
|
2026-10-06 22:12:49 +00:00
|
|
|
const metroImportAll = {};
|
|
|
|
|
const Store = get_initializedDefault.Store;
|
2026-09-18 20:18:48 +00:00
|
|
|
class CallStore extends Store {
|
2026-10-06 22:12:49 +00:00
|
|
|
initialize() {
|
|
|
|
|
this.waitFor(ChannelStore, SelectedChannelStore, SelectedGuildStore);
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
getCall(channelId) {
|
|
|
|
|
return obj[channelId];
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
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;
|
2026-09-18 20:18:48 +00:00
|
|
|
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 = {};
|
2026-09-18 20:18:48 +00:00
|
|
|
},
|
|
|
|
|
OVERLAY_INITIALIZE: function handleOverlayInitialize(callStoreInternalState) {
|
|
|
|
|
callStoreInternalState = callStoreInternalState.callStoreInternalState;
|
|
|
|
|
const merged = Object.assign(callStoreInternalState.calls);
|
2026-10-06 22:12:49 +00:00
|
|
|
const obj2 = {};
|
2026-09-18 20:18:48 +00:00
|
|
|
const merged1 = Object.assign(callStoreInternalState.enqueuedRings);
|
2026-10-06 22:12:49 +00:00
|
|
|
let closure_8 = obj2;
|
2026-09-18 20:18:48 +00:00
|
|
|
},
|
|
|
|
|
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];
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
if (null == obj[channel.id]) {
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
2026-10-06 22:12:49 +00:00
|
|
|
delete obj[channel.id];
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
CALL_CREATE: function handleCallCreate(channelId) {
|
2026-10-06 22:12:49 +00:00
|
|
|
let obj2;
|
2026-09-18 20:18:48 +00:00
|
|
|
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;
|
2026-09-18 20:18:48 +00:00
|
|
|
if (1 !== enqueuedRings[channelId].indexOf("all")) {
|
2026-10-06 22:12:49 +00:00
|
|
|
tmp = null;
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
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);
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
CALL_UPDATE: function handleCallUpdate(arg0) {
|
2026-10-06 22:12:49 +00:00
|
|
|
let channelId;
|
|
|
|
|
let messageId;
|
|
|
|
|
let obj;
|
|
|
|
|
let ongoingRings;
|
|
|
|
|
let region;
|
2026-09-18 20:18:48 +00:00
|
|
|
({ 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-09-18 20:18:48 +00:00
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
obj = { messageId, region, ringing: Object.keys(ongoingRings), regionUpdated: tmp2 };
|
2026-09-18 20:18:48 +00:00
|
|
|
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;
|
2026-09-18 20:18:48 +00:00
|
|
|
({ 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-09-18 20:18:48 +00:00
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
tmp2[channelId] = { channelId, ringing: [], messageId: null, region: null, regionUpdated: false, unavailable };
|
2026-09-18 20:18:48 +00:00
|
|
|
if (null != enqueuedRings[channelId]) {
|
2026-10-06 22:12:49 +00:00
|
|
|
delete enqueuedRings[channelId];
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
CALL_ENQUEUE_RING: function handleCallEnqueueRing(arg0) {
|
2026-10-06 22:12:49 +00:00
|
|
|
let channelId;
|
|
|
|
|
let recipients;
|
2026-09-18 20:18:48 +00:00
|
|
|
({ channelId, recipients } = arg0);
|
|
|
|
|
let items = enqueuedRings[channelId];
|
2026-10-06 22:12:49 +00:00
|
|
|
const union = _modDef12.union;
|
|
|
|
|
_modDef12;
|
|
|
|
|
const tmp = enqueuedRings;
|
2026-09-18 20:18:48 +00:00
|
|
|
if (items == null) {
|
|
|
|
|
items = [];
|
|
|
|
|
}
|
|
|
|
|
if (recipients == null) {
|
|
|
|
|
recipients = ["all"];
|
|
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
tmp[channelId] = union(items, recipients);
|
2026-09-18 20:18:48 +00:00
|
|
|
},
|
|
|
|
|
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(channelId) {
|
|
|
|
|
if (null == channelId.channelId) {
|
2026-10-06 22:12:49 +00:00
|
|
|
let closure_8 = {};
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const callStore = new CallStore(DispatcherDefault, calls);
|
|
|
|
|
const result = size.fileFinishedImporting("stores/CallStore.tsx");
|
|
|
|
|
|
|
|
|
|
export default callStore;
|