decord/source/modules/gateway/GatewaySocketSingleton.tsx

83 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13104
// Function ID: 13105
2026-07-29 08:29:29 +00:00
// Name: handleIdentify
2026-08-25 06:04:03 +00:00
// Dependencies: [1218, 3, 13105, 13144, 13147, 10557, 698, 675, 500, 4008, 1474, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-25 06:04:03 +00:00
// Module 13104 (handleIdentify)
2026-08-24 06:08:38 +00:00
import timestampDefault from "timestamp" /* 3 */;
import setRequestedByAll from "setRequestedBy" /* 675 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import setDefault from "set" /* 4008 */;
import _modDef10557 from "module_10557" /* 10557 */;
import noopDefault from "noop" /* 13105 */;
import getInitialStateDefault from "getInitialState" /* 13144 */;
import guildIdDefault from "guildId" /* 13147 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "fetchFingerprint" /* 1218 */;
import set from "set" /* 500 */;
import importDefaultResult from "awaitOnline" /* 1474 */;
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
let closure_4 = new timestampDefault("ConnectionStore");
let obj = new noopDefault();
const tmp3 = new getInitialStateDefault(obj);
2026-07-29 08:29:29 +00:00
let closure_6 = tmp3;
2026-08-24 06:08:38 +00:00
const tmp2 = new timestampDefault("ConnectionStore");
2026-07-29 08:29:29 +00:00
obj.handleIdentify = () => {
2026-08-24 06:08:38 +00:00
obj = token;
2026-07-29 08:29:29 +00:00
token = token.getToken();
obj = { hasToken: null != token };
2026-08-24 06:08:38 +00:00
closure_4.verbose("handleIdentify called", obj);
2026-07-20 16:05:17 +00:00
if (null == token) {
return null;
} else {
2026-08-25 06:04:03 +00:00
const state = _modDef10557.getState();
2026-07-29 08:29:29 +00:00
const installationForTracking = obj.getInstallationForTracking();
obj = { token: null, properties: null, presence: null };
obj[0] = token;
2026-08-24 06:08:38 +00:00
obj1 = {};
2026-08-25 06:04:03 +00:00
const obj5 = _modDef10557;
2026-08-24 06:08:38 +00:00
const merged = Object.assign(expandEventPropertiesDefault.getSuperProperties());
2026-07-29 08:29:29 +00:00
obj1.client_app_state = state;
obj1.is_fast_connect = false;
2026-08-24 06:08:38 +00:00
const obj8 = expandEventPropertiesDefault;
obj1.gateway_connect_reasons = setRequestedByAll.describeConnectionReasons();
2026-07-20 16:05:17 +00:00
if (null != installationForTracking) {
2026-07-29 08:29:29 +00:00
const obj2 = { installation_id: null };
obj2[0] = installationForTracking;
let obj3 = obj2;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj3 = {};
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(obj3);
obj[1] = obj1;
2026-08-24 06:08:38 +00:00
obj[2] = initialState.getInitialState();
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-07-23 10:11:24 +00:00
if (set.isDesktop()) {
2026-08-24 06:08:38 +00:00
const powerMonitor = setDefault.powerMonitor;
2026-07-20 16:05:17 +00:00
powerMonitor.on("resume", () => {
2026-07-29 08:29:29 +00:00
obj.expeditedHeartbeat(5000, "power monitor resumed");
2026-07-20 16:05:17 +00:00
});
}
2026-08-24 06:08:38 +00:00
const tmp4 = new guildIdDefault(obj);
importDefaultResult.addOfflineCallback(() => {
2026-07-29 08:29:29 +00:00
obj.networkStateChange(15000, "network detected offline.", false);
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
importDefaultResult.addOnlineCallback(() => {
2026-07-29 08:29:29 +00:00
obj.networkStateChange(5000, "network detected online.");
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
obj.on("disconnect", (arg0) => {
2026-07-20 16:05:17 +00:00
({ code, reason } = arg0);
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "CONNECTION_CLOSED", code, reason });
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
obj.on("close", (arg0) => {
2026-07-20 16:05:17 +00:00
({ code, reason } = arg0);
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "CONNECTION_INTERRUPTED", code, reason });
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
const result = set.fileFinishedImporting("modules/gateway/GatewaySocketSingleton.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const socket = obj;
export const localPresenceState = tmp3;
export const localVoiceState = tmp4;