decord/source/modules/gateway/GatewaySocketSingleton.tsx

90 lines
3.2 KiB
TypeScript
Raw Normal View History

// Module ID: 13628
// Function ID: 13629
2026-07-29 08:29:29 +00:00
// Name: handleIdentify
// Dependencies: [13629, 502, 3, 13630, 13670, 13673, 11300, 1242, 7757, 1115, 4182, 1461, 573, 2]
2026-07-23 10:11:24 +00:00
// Module 13628 (handleIdentify)
2026-08-24 06:08:38 +00:00
import timestampDefault from "timestamp" /* 3 */;
import dispatcherDefault from "dispatcher" /* 573 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 1242 */;
import setDefault from "set" /* 4182 */;
import setRequestedByAll from "setRequestedBy" /* 7757 */;
import _modDef11300 from "module_11300" /* 11300 */;
import noopDefault from "noop" /* 13630 */;
import getInitialStateDefault from "getInitialState" /* 13670 */;
import guildIdDefault from "guildId" /* 13673 */;
import closure_3 from "initialize" /* 13629 */;
import closure_4 from "fetchFingerprint" /* 502 */;
import set from "set" /* 1115 */;
import importDefaultResult from "awaitOnline" /* 1461 */;
2026-07-20 16:05:17 +00:00
let closure_5 = new timestampDefault("ConnectionStore");
2026-08-24 06:08:38 +00:00
let obj = new noopDefault();
const tmp3 = new getInitialStateDefault(obj);
let closure_7 = 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 };
closure_5.verbose("handleIdentify called", obj);
2026-07-20 16:05:17 +00:00
if (null == token) {
return null;
} else {
const state = _modDef11300.getState();
2026-07-29 08:29:29 +00:00
const installationForTracking = obj.getInstallationForTracking();
obj = { token: null, userId: null, properties: null, presence: null };
2026-07-29 08:29:29 +00:00
obj[0] = token;
let id = obj.getId();
if (id == null) {
id = targetUserId.getTargetUserId();
}
obj[1] = id;
2026-08-24 06:08:38 +00:00
obj1 = {};
const obj8 = _modDef11300;
const tmp12 = importDefault;
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;
const tmp12Result = expandEventPropertiesDefault;
2026-08-24 06:08:38 +00:00
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[2] = obj1;
obj[3] = 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;