Files
discord-decomp/sources/modules/gateway/GatewaySocketSingleton.tsx
T
2026-07-28 01:06:53 +03:00

81 lines
5.3 KiB
TypeScript

/* Metro module 12490; source: modules/gateway/GatewaySocketSingleton.tsx; dependencies: [1226, 3, 12491, 12528, 12531, 9493, 683, 660, 477, 3767, 1458, 694, 2] */
import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */
import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import NetworkUtils from '../../utils/NetworkUtils.tsx'; /* Metro dependency 1458 */
import DiscordAppStateNative from '../app_state/DiscordAppState.native.tsx'; /* Metro dependency 9493 */
import LocalPresenceStateManager from './LocalPresenceStateManager.tsx'; /* Metro dependency 12528 */
import LocalVoiceStateManager from './LocalVoiceStateManager.tsx'; /* Metro dependency 12531 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as PlatformUtilsModule from '../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
function _fun95044(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#95044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:6, offset: 0x0212fa50, size: 460 bytes, params: 8, frame: 23
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = Logger;
value = new value('ConnectionStore');
value = importDefault(12491) /* metro dependency 12491: GatewaySocket */;
value = new value();
const value6 = new (LocalPresenceStateManager)(value);
const value10 = new (LocalVoiceStateManager)(value);
value.handleIdentify = handleIdentify;
if (PlatformUtilsModule.isDesktop()) {
(importDefault(3767) /* metro dependency 3767: DiscordNative */).powerMonitor.on('resume', _fun95046);
}
(NetworkUtils).addOfflineCallback(_fun95047);
(NetworkUtils).addOnlineCallback(_fun95048);
value.on('disconnect', _fun95049);
value.on('close', _fun95050);
(FileImportTrackerModule).fileFinishedImporting('modules/gateway/GatewaySocketSingleton.tsx');
exports.socket = value;
exports.localPresenceState = value6;
exports.localVoiceState = value10;
function handleIdentify() { // fn#95045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:208, offset: 0x0212fc1c, size: 258 bytes, params: 1, frame: 19
const token = AuthenticationStore.getToken();
env0_4.verbose('handleIdentify called', {hasToken: token != null});
if (token == null) {
return null;
}
const state = (DiscordAppStateNative).getState();
const installationForTracking = AuthenticationStore.getInstallationForTracking();
object = {token: token};
const object2 = {};
const defaultImport2 = AnalyticsUtils;
const getSuperProperties = defaultImport2.getSuperProperties;
copyDataProperties(object2, Reflect.apply(getSuperProperties, defaultImport2, []), defaultImport2);
object2['client_app_state'] = state;
object2['is_fast_connect'] = false;
object2['gateway_connect_reasons'] = (importAll(660) /* metro dependency 660: RequestGatewaySocket */).describeConnectionReasons();
copyDataProperties(object2, installationForTracking != null ? {installation_id: installationForTracking} : {},
defaultImport2);
object.properties = object2;
object.presence = env0_6.getInitialState();
return object;
}
function _fun95046() { // fn#95046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:645, offset: 0x0212fd1e, size: 35 bytes, params: 1, frame: 13
env0_5.expeditedHeartbeat(5000, 'power monitor resumed');
}
function _fun95047() { // fn#95047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:732, offset: 0x0212fd41, size: 38 bytes, params: 1, frame: 15
env0_5.networkStateChange(15000, 'network detected offline.', false);
}
function _fun95048() { // fn#95048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:826, offset: 0x0212fd67, size: 35 bytes, params: 1, frame: 13
env0_5.networkStateChange(5000, 'network detected online.');
}
function _fun95049({code, reason}) { // fn#95049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:906, offset: 0x0212fd8a, size: 70 bytes, params: 2, frame: 15
Dispatcher.dispatch({type: 'CONNECTION_CLOSED', code: code, reason: reason});
}
function _fun95050({code, reason}) { // fn#95050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12680:1007, offset: 0x0212fdd0, size: 70 bytes, params: 2, frame: 15
Dispatcher.dispatch({type: 'CONNECTION_INTERRUPTED', code: code, reason: reason});
}
}
global.__d(_fun95044, 12490, [1226, 3, 12491, 12528, 12531, 9493, 683, 660, 477, 3767, 1458, 694,
2]) /* metro module 12490, dependencies: [1226, 3, 12491, 12528, 12531, 9493, 683, 660, 477, 3767, 1458, 694, 2] */;