decord/source/modules/gateway/GatewaySocketSingleton.tsx
2026-08-05 07:35:12 +00:00

78 lines
2.5 KiB
TypeScript

// Module ID: 12778
// Function ID: 12779
// Name: handleIdentify
// Dependencies: [1218, 3, 12779, 12818, 12821, 10356, 698, 675, 500, 3866, 1454, 709, 2]
// Module 12778 (handleIdentify)
import fetchFingerprint from "fetchFingerprint";
import set from "set";
import importDefaultResult from "awaitOnline";
import set from "noop";
let c4 = new require("getInitialState")("ConnectionStore");
let obj = new require("noop")();
const tmp3 = new require("getInitialState")(obj);
let closure_6 = tmp3;
const tmp2 = new require("getInitialState")("ConnectionStore");
obj.handleIdentify = () => {
let obj = token;
token = token.getToken();
obj = { hasToken: null != token };
tmp2.verbose("handleIdentify called", obj);
if (null == token) {
return null;
} else {
const state = importDefault(10356).getState();
const installationForTracking = obj.getInstallationForTracking();
obj = { token: null, properties: null, presence: null };
obj[0] = token;
const obj1 = {};
const obj5 = importDefault(10356);
const merged = Object.assign(importDefault(698).getSuperProperties());
obj1.client_app_state = state;
obj1.is_fast_connect = false;
const obj8 = importDefault(698);
obj1.gateway_connect_reasons = importAll(675).describeConnectionReasons();
if (null != installationForTracking) {
const obj2 = { installation_id: null };
obj2[0] = installationForTracking;
let obj3 = obj2;
} else {
obj3 = {};
}
const merged1 = Object.assign(obj3);
obj[1] = obj1;
obj[2] = obj1.getInitialState();
return obj;
}
};
if (set.isDesktop()) {
const powerMonitor = require("set").powerMonitor;
powerMonitor.on("resume", () => {
obj.expeditedHeartbeat(5000, "power monitor resumed");
});
}
const tmp4 = new require("guildId")(obj);
require("awaitOnline").addOfflineCallback(() => {
obj.networkStateChange(15000, "network detected offline.", false);
});
require("awaitOnline").addOnlineCallback(() => {
obj.networkStateChange(5000, "network detected online.");
});
obj.on("disconnect", (arg0) => {
let code;
let reason;
({ code, reason } = arg0);
importDefault(709).dispatch({ type: "CONNECTION_CLOSED", code, reason });
});
obj.on("close", (arg0) => {
let code;
let reason;
({ code, reason } = arg0);
importDefault(709).dispatch({ type: "CONNECTION_INTERRUPTED", code, reason });
});
const result = set.fileFinishedImporting("modules/gateway/GatewaySocketSingleton.tsx");
export const socket = obj;
export const localPresenceState = tmp3;
export const localVoiceState = tmp4;