// Metro module 12691 (f12692). import AuthenticationStore from "../../stores/AuthenticationStore"; import Logger from "../debug/Logger"; import GatewaySocket from "./GatewaySocket"; import LocalPresenceStateManager from "./LocalPresenceStateManager"; import LocalVoiceStateManager from "./LocalVoiceStateManager"; import DiscordAppState_native from "../app_state/DiscordAppState.native"; import AnalyticsUtils from "../../utils/AnalyticsUtils"; import { describeConnectionReasons } from "./RequestGatewaySocket"; import { isDesktop } from "../../utils/PlatformUtils"; import DiscordNative from "../../lib/DiscordNative"; import NetworkUtils from "../../utils/NetworkUtils"; import Dispatcher from "../../Dispatcher"; let c8745_4 = new Logger("ConnectionStore"); let c8745_5 = new GatewaySocket(); let c8745_6 = new LocalPresenceStateManager(c8745_5); const localVoiceStateManager = new LocalVoiceStateManager(c8745_5); c8745_5.handleIdentify = () => { const token = AuthenticationStore.getToken(); c8745_4.verbose("handleIdentify called", { hasToken: token != null }); if (token == null) { return null; } const state = DiscordAppState_native.getState(); const installationForTracking = AuthenticationStore.getInstallationForTracking(); return { token, properties: { ...AnalyticsUtils.getSuperProperties(), client_app_state: state, is_fast_connect: false, gateway_connect_reasons: describeConnectionReasons(), ...installationForTracking != null ? { installation_id: installationForTracking } : {} }, presence: c8745_6.getInitialState() }; }; if (isDesktop()) { DiscordNative.powerMonitor.on("resume", () => { c8745_5.expeditedHeartbeat(5000, "power monitor resumed"); }); } NetworkUtils.addOfflineCallback(() => { c8745_5.networkStateChange(15000, "network detected offline.", false); }); NetworkUtils.addOnlineCallback(() => { c8745_5.networkStateChange(5000, "network detected online."); }); c8745_5.on("disconnect", (a0) => { Dispatcher.dispatch({ type: "CONNECTION_CLOSED", code: a0.code, reason: a0.reason }); }); c8745_5.on("close", (a0) => { Dispatcher.dispatch({ type: "CONNECTION_INTERRUPTED", code: a0.code, reason: a0.reason }); }); export { c8745_5 as socket }; export { c8745_6 as localPresenceState }; export { localVoiceStateManager as localVoiceState };