/* Metro module 4257; source: modules/gateway/GatewayConnectionStore.tsx; dependencies: [6, 7, 15, 17, 18, 5, 1348, 1226, 4258, 1379, 4259, 4294, 4402, 1934, 6876, 4395, 661, 670, 12490, 12532, 3, 587, 6944, 4796, 477, 12524, 22, 4285, 12503, 566, 694, 2] */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import UserSettingsProtoStore from '../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */ import CallStore from '../../stores/CallStore.tsx'; /* Metro dependency 4258 */ import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */ import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */ import StreamRTCConnectionStore from '../../stores/StreamRTCConnectionStore.tsx'; /* Metro dependency 4395 */ import RTCRegionStore from '../../stores/RTCRegionStore.tsx'; /* Metro dependency 4402 */ import SelfPresenceStore from '../../stores/SelfPresenceStore.tsx'; /* Metro dependency 6876 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as PlatformUtilsModule from '../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as UserSettingsConstantsModule from '../user_settings/UserSettingsConstants.tsx'; /* Metro dependency 670 */ import * as GatewaySocketSingletonModule from './GatewaySocketSingleton.tsx'; /* Metro dependency 12490 */ function _fun35388(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#35388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:6, offset: 0x01071406, size: 985 bytes, params: 8, frame: 22 const env0_0 = require; const closure = function() { require(dependencyMap[18]).localVoiceState.update(); }; const handleMediaEngineChange = function() { require(dependencyMap[18]).localVoiceState.update(); return false; }; const handleLocalPresenceChange = function() { require(dependencyMap[18]).localPresenceState.update(); return false; }; const deleteStream = function(a0) { var socket = require(dependencyMap[18]).socket; if (socket.isSessionEstablished()) { socket.streamDelete(a0); } }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ConstantsModule; const env0_20 = value.RTCConnectionStates; const env0_21 = value.AppStates; const env0_23 = global.window.DiscordNative; (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket.dispatcher.getDispatchHandler = importDefault(12532) /* metro dependency 12532: dispatchSocketMessage */; value = importDefault(3) /* metro dependency 3: Logger */; value = new value('ConnectionStore'); const Store = (Flux).Store; _fun35404(Store).displayName = 'GatewayConnectionStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {START_SESSION: START_SESSION, LOGIN_SUCCESS: LOGIN_SUCCESS_35413, LOGOUT: LOGOUT_35414, CLEAR_CACHES: CLEAR_CACHES_35415, CONNECTION_OPEN: function(a0) { _fun35417(a0); }, CONNECTION_RESUMED: function() { env0_29 = null; }, CONNECTION_CLOSED: CONNECTION_CLOSED_35419, RTC_CONNECTION_STATE: RTC_CONNECTION_STATE, VOICE_CHANNEL_SELECT: VOICE_CHANNEL_SELECT_35421, VOICE_STATE_UPDATES: function({voiceStates}) { return voiceStates.reduce(_fun35423, false); }, GUILD_DELETE: function(a0) { if (a0.guild.id === require(dependencyMap[18]).localVoiceState.guildId) { require(dependencyMap[18]).localVoiceState.setState({'guildId': null, 'channelId': null}); } }, CHANNEL_DELETE: function(a0) { if (a0.channel.id === require(dependencyMap[18]).localVoiceState.channelId) { require(dependencyMap[18]).localVoiceState.setState({'guildId': null, 'channelId': null}); } }, CALL_DELETE: CALL_DELETE, APP_STATE_UPDATE: APP_STATE_UPDATE, GUILD_MEMBERS_REQUEST: GUILD_MEMBERS_REQUEST, GUILD_SEARCH_RECENT_MEMBERS: function({guildId, query, continuationToken}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { require(dependencyMap[18]).socket.searchRecentMembers(guildId, {query: query, continuationToken: continuationToken}); } }, GUILD_SUBSCRIPTIONS_FLUSH: function({subscriptions}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { require(dependencyMap[18]).socket.updateGuildSubscriptions(subscriptions); } return false; }, CALL_CONNECT: function({channelId}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { require(dependencyMap[18]).socket.callConnect(channelId); } return false; }, CALL_CONNECT_MULTIPLE: function({channelIds}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { channelIds.forEach(_fun35434); } return false; }, STREAM_CREATE: closure, STREAM_START: STREAM_START, STREAM_WATCH: function({streamKey, allowMultiple}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { if (!allowMultiple) { cleanupAllStreamsExceptSelf(); } require(dependencyMap[18]).socket.streamWatch(streamKey); } return false; }, STREAM_STOP: function({streamKey}) { deleteStream(streamKey); STREAM_CREATE(); return false; }, STREAM_SET_PAUSED: function({streamKey, paused}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { require(dependencyMap[18]).socket.streamSetPaused(streamKey, paused); } }, PUSH_NOTIFICATION_CLICK: function() { require(dependencyMap[18]).socket.expeditedHeartbeat(5000, 'user clicked on notification', true); return false; }, REQUEST_FORUM_UNREADS: function({guildId, channelId, threads}) { require(dependencyMap[18]).socket.requestForumUnreads(guildId, channelId, threads); }, REQUEST_SOUNDBOARD_SOUNDS: function({guildIds}) { require(dependencyMap[18]).socket.requestSoundboardSounds(guildIds); }, REMOTE_COMMAND: function({sessionId, payload}) { if (require(dependencyMap[18]).socket.isSessionEstablished()) { require(dependencyMap[18]).socket.remoteCommand(sessionId, payload); } return false; }, RESET_SOCKET: function(a0) { if (require(dependencyMap[18]).socket.connectionState !== importDefault(dependencyMap[28]).WILL_RECONNECT) { require(dependencyMap[18]).socket.resetSocketAndClearCacheOnError(a0.args); } }, CLIPS_SETTINGS_UPDATE: closure, RUNNING_GAMES_CHANGE: closure, USER_SETTINGS_PROTO_UPDATE: function(a0) { if (a0.settings.type === UserSettingsTypes.PRELOADED_USER_SETTINGS && a0.settings.proto.clips?.allowVoiceRecording != null) { STREAM_CREATE(); } }}); (FileImportTrackerModule).fileFinishedImporting('modules/gateway/GatewayConnectionStore.tsx'); exports.default = value; function _isNativeReflectConstruct_35389() { // fn#35389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:342, offset: 0x010717df, size: 94 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_35389_isNativeReflectConstruct = function() { return !!result; })(); } function _handleConnectionOpen() { // fn#35392, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:686, offset: 0x0107183d, size: 48 bytes, params: 1, frame: 14 return Module00005(_fun35394).apply(this, arguments); function* _fun35394({sessionId}) { // fn#35394, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:751, offset: 0x01071876, size: 637 bytes, params: 2, frame: 25 var r5; var type; var r7; var performance; var entriesByType; var channel; if (false) { return undefined; } const Date = global.Date; value = Date.now(); let binding = env2_0; value = undefined; binding(env2_3[18]).localPresenceState.handleConnectionOpen(); let object = {}; const voiceChannelId = env2_17.getVoiceChannelId(); if (voiceChannelId == null) { env2_0(env2_3[18]).localVoiceState.update(object, true); env2_27 = false; } else { var Storage = env2_0(env2_3[21]).Storage; var value6 = Storage.get('discord_watchdog_restart_timestamp'); r5 = value6 != null && global.Date.now() - global.parseInt(value6, 10) < 60000; Storage = env2_0(env2_3[21]).Storage; Storage.remove('discord_watchdog_restart_timestamp'); var window = global.window; if (window == null) { type = value; } else { performance = window.performance; if (performance == null) { type = value; } else if (performance.getEntriesByType == null) { type = value; } else { entriesByType = performance.getEntriesByType('navigation'); type = entriesByType == null || entriesByType[0] == null ? value : entriesByType[0].type; } } if (type === 'reload') { binding = env2_13; channel = binding.getChannel(voiceChannelId); if (channel == null) { r7 = object; } else { object = {}; object.guildId = channel.getGuildId(); object.channelId = voiceChannelId; env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId); r7 = object; } binding = env2_0; binding(env2_3[18]).localVoiceState.update(r7, true); env2_27 = false; return value; } if (r5) { binding = env2_13; channel = binding.getChannel(voiceChannelId); if (channel == null) { r7 = object; } else { object = {}; object.guildId = channel.getGuildId(); object.channelId = voiceChannelId; env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId); r7 = object; } binding = env2_0; binding(env2_3[18]).localVoiceState.update(r7, true); env2_27 = false; return value; } r5 = env2_23 == null || env2_23.processUtils == null || env2_23.processUtils.getLastCrash == null ? value : env2_23.processUtils.getLastCrash(); yield r5; if (false) { return undefined; } if ((null == undefined ? value : undefined.rendererCrashReason) != null) { channel = env2_13.getChannel(voiceChannelId); if (channel == null) { r7 = object; } else { object = {}; object.guildId = channel.getGuildId(); object.channelId = voiceChannelId; env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId); r7 = object; } } else if (env2_27) { binding = env2_15; binding.setLastSessionVoiceChannelId(voiceChannelId ?? null); binding = env2_1; binding(env2_3[23]).selectVoiceChannel(null); r7 = object; } else { channel = env2_13.getChannel(voiceChannelId); if (channel == null) { r7 = object; } else { object = {}; object.guildId = channel.getGuildId(); object.channelId = voiceChannelId; env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId); r7 = object; } } env2_0(env2_3[18]).localVoiceState.update(r7, true); } return value; } } function cleanupAllStreamsExceptSelf() { // fn#35399, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:1949, offset: 0x01071bcd, size: 66 bytes, params: 1, frame: 13 const env0_0 = getSelfStreamKey(); let value = StreamRTCConnectionStore.getAllActiveStreamKeys(); value = value.filter(_fun35402); value.forEach(function(a0) { deleteStream(a0); }); function getSelfStreamKey() { // fn#35400, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:1994, owner: cleanupAllStreamsExceptSelf.getSelfStreamKey, offset: 0x01071c0f, size: 37 bytes, params: 1, frame: 11 var environment; const value = environment.__proto__; return StreamRTCConnectionStore.getAllActiveStreamKeys().find(function(a0) { return require(dependencyMap[27]).decodeStreamKey(a0).ownerId === AuthenticationStore.getId(); }); } function _fun35402(a0) { // fn#35402, offset: 0x00ce1772, size: 16 bytes, params: 2, frame: 2 return a0 !== env0_0; } } function _fun35404(a0) { // fn#35404, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:2200, offset: 0x01071c88, size: 185 bytes, params: 2, frame: 16 const GatewayConnectionStore2 = GatewayConnectionStore; Inherits(GatewayConnectionStore2, a0); return CreateClass(GatewayConnectionStore2, [{key: 'initialize', value: function() { var authenticationStoreBinding = AuthenticationStore; var callStoreBinding = CallStore; var channelStoreBinding = ChannelStore; var mediaEngineStoreBinding = MediaEngineStore; var rtcConnectionStoreBinding = RTCConnectionStore; var rtcRegionStoreBinding = RTCRegionStore; var selectedChannelStoreBinding = SelectedChannelStore; var selfPresenceStoreBinding = SelfPresenceStore; this.waitFor(authenticationStoreBinding, callStoreBinding, channelStoreBinding, mediaEngineStoreBinding, rtcConnectionStoreBinding, rtcRegionStoreBinding, selectedChannelStoreBinding, selfPresenceStoreBinding, StreamRTCConnectionStore, UserSettingsProtoStore); this.syncWith([mediaEngineStoreBinding], handleMediaEngineChange); this.syncWith([selfPresenceStoreBinding], handleLocalPresenceChange); }}, {key: 'getSocket', value: function() { return require(dependencyMap[18]).socket; }}, {key: 'isTryingToConnect', value: function() { return !require(dependencyMap[18]).socket.isClosed(); }}, {key: 'isConnected', value: function() { return require(dependencyMap[18]).socket.isSessionEstablished(); }}, {key: 'isConnectedOrOverlay', value: value_35410}, {key: 'lastTimeConnectedChanged', value: value_35411}]); function GatewayConnectionStore() { // fn#35405, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:2212, offset: 0x01071d41, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_4(this, GatewayConnectionStore); const value3 = env1_7(GatewayConnectionStore); return env1_6(this, _isNativeReflectConstruct_35389() ? global.Reflect.construct(value3, arguments, env1_7(this).constructor) : value3.apply(this, arguments)); } function value_35410() { // fn#35410, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:2930, offset: 0x01071ea1, size: 48 bytes, params: 1, frame: 11 const value = environment.__proto__; return (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket.isSessionEstablished() || false; } function value_35411() { // fn#35411, offset: 0x00df3ad6, size: 9 bytes, params: 1, frame: 1 return env1_25; } } function START_SESSION() { // fn#35412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:3147, offset: 0x01071ed1, size: 115 bytes, params: 1, frame: 15 var r0; const socket = (GatewaySocketSingletonModule).socket; const isClosed2 = socket.isClosed(); const binding = env0_24; const verbose = binding.verbose; if (isClosed2) { Reflect.apply(verbose, binding, ['Socket is reconnecting because of starting new session']); r0 = socket.connect(); } else { Reflect.apply(verbose, binding, ['Socket is not reconnecting during a new session because it is not closed']); r0 = false; } return r0; } function LOGIN_SUCCESS_35413() { // fn#35413, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:3413, offset: 0x01071f44, size: 166 bytes, params: 1, frame: 19 var r0; const binding = env0_24; const verbose = binding.verbose; const object = {}; const socket = (GatewaySocketSingletonModule).socket; object.isEstablished = socket.isSessionEstablished(); Reflect.apply(verbose, binding, ['session refresh dispatched', object]); const isSessionEstablished2 = socket.isSessionEstablished(); if (isSessionEstablished2) { socket.close(); r0 = socket.connect(); } else { r0 = !!isSessionEstablished2; } return r0; } function LOGOUT_35414(a0) { // fn#35414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:3649, offset: 0x01071fea, size: 119 bytes, params: 2, frame: 12 if (a0.isSwitchingAccount) { (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).localPresenceState.handleAccountSwitch(); } env0_24.verbose('Closing socket because of logout'); (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket.close(); } function CLEAR_CACHES_35415(a0) { // fn#35415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:3830, offset: 0x01072061, size: 113 bytes, params: 2, frame: 14 const socket = (GatewaySocketSingletonModule).socket; if (a0.resetSocket) { socket.close(); socket.dispatcher.clear(); socket.connect(); } return false; } function CONNECTION_OPEN_35416(a0) { // fn#35416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:3989, offset: 0x010720d2, size: 22 bytes, params: 2, frame: 11 (function() { return _handleConnectionOpen.apply(this, arguments); })(a0); function CONNECTION_OPEN_35416HandleConnectionOpen() { // fn#35417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:3994, owner: CONNECTION_OPEN_35416.handleConnectionOpen, offset: 0x010720e8, size: 30 bytes, params: 1, frame: 13 return _handleConnectionOpen.apply(this, arguments); } } function CONNECTION_CLOSED_35419() { // fn#35419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:4162, offset: 0x01072113, size: 49 bytes, params: 1, frame: 12 env0_24.verbose('connection closed dispatched'); const Date = global.Date; env0_25 = Date.now(); } function RTC_CONNECTION_STATE(a0) { // fn#35420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:4273, offset: 0x01072144, size: 143 bytes, params: 2, frame: 13 const socket = (GatewaySocketSingletonModule).socket; const state = a0.state; const DISCONNECTED = RTCConnectionStates.DISCONNECTED; if (state !== DISCONNECTED) { return false; } if (a0.willReconnect) { if (a0.streamKey != null) { socket.streamPing(a0.streamKey); } else { socket.voiceServerPing(); } } } function VOICE_CHANNEL_SELECT_35421(a0) { // fn#35421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:4480, offset: 0x010721d3, size: 307 bytes, params: 2, frame: 16 const socket = (GatewaySocketSingletonModule).socket; const localVoiceState = (GatewaySocketSingletonModule).localVoiceState; const update = localVoiceState.update; let channelId = a0.channelId; Reflect.apply(update, localVoiceState, [{guildId: a0.guildId, channelId: channelId}]); const lockVoiceStateForResume = a0.lockVoiceStateForResume; const value2 = null; if (lockVoiceStateForResume) { channelId = a0.channelId; channelId = value2 != channelId ? a0.channelId : value2; } if ((require(477) /* metro dependency 477: PlatformUtils */).isIOS() && env0_28 === AppStates.BACKGROUND) { if (value2 == a0.channelId) { socket.close(true); } else if (socket.isClosed()) { (importAll(12524) /* metro dependency 12524: PauseGatewaySocket */).setIsPaused(false); socket.connect(); } } return false; } function VOICE_STATE_UPDATES_35422({voiceStates}) { // fn#35422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:4850, offset: 0x01072306, size: 32 bytes, params: 2, frame: 13 return voiceStates.reduce(_fun35423, false); function _fun35423(a0, a1) { // fn#35423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:4917, offset: 0x01072326, size: 246 bytes, params: 3, frame: 17 const localVoiceState = (GatewaySocketSingletonModule).localVoiceState; const id = AuthenticationStore.getId(); const userId = a1.userId; if (id !== userId) { return a0; } if (a1.sessionId === env1_26) { if (env1_29 != null) { env1_24.verbose('Ignoring voice state for own session due to VSU lock on channel:', env1_29); return a0; } localVoiceState.setState({guildId: a1.guildId, channelId: a1.channelId}); } else { if (a1.guildId !== localVoiceState.guildId) { return a0; } localVoiceState.setState({'guildId': null, 'channelId': null}); } return true; } } function CALL_DELETE({channelId}) { // fn#35426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:5632, offset: 0x010724ea, size: 110 bytes, params: 2, frame: 14 const localVoiceState = (GatewaySocketSingletonModule).localVoiceState; if (channelId === localVoiceState.channelId) { if (env0_29 === channelId) { return false; } localVoiceState.setState({'guildId': null, 'channelId': null}); } } function APP_STATE_UPDATE(a0) { // fn#35427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:5818, offset: 0x01072558, size: 462 bytes, params: 2, frame: 16 var r2; var state; var authenticationStoreBinding; const socket = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket; if (PlatformUtilsModule.isIOS()) { authenticationStoreBinding = AuthenticationStore; if (authenticationStoreBinding.isAuthenticated()) { if (env0_28 !== AppStates.INACTIVE) { r2 = env0_28 === AppStates.BACKGROUND && a0.state === AppStates.ACTIVE; r2 = r2 && socket.isClosed(); if (r2) { (importAll(12524) /* metro dependency 12524: PauseGatewaySocket */).setIsPaused(false); socket.connect(); } } else if (a0.state !== AppStates.BACKGROUND) { r2 = env0_28 === AppStates.BACKGROUND && a0.state === AppStates.ACTIVE; r2 = r2 && socket.isClosed(); if (r2) { (importAll(12524) /* metro dependency 12524: PauseGatewaySocket */).setIsPaused(false); socket.connect(); } } else if ((require(12490) /* metro dependency 12490: GatewaySocketSingleton */).localVoiceState.channelId == null) { socket.close(true); } else { r2 = env0_28 === AppStates.BACKGROUND && a0.state === AppStates.ACTIVE; r2 = r2 && socket.isClosed(); if (r2) { (importAll(12524) /* metro dependency 12524: PauseGatewaySocket */).setIsPaused(false); socket.connect(); } } } state = a0.state; } else if (a0.state === AppStates.ACTIVE) { (importAll(12524) /* metro dependency 12524: PauseGatewaySocket */).setIsPaused(false); authenticationStoreBinding = AuthenticationStore; if (authenticationStoreBinding.isAuthenticated()) { socket.resetBackoff('App state is active'); } } return false; } function GUILD_MEMBERS_REQUEST(a0) { // fn#35428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:6273, offset: 0x01072726, size: 213 bytes, params: 2, frame: 18 const env0_0 = a0; var value; const socket = (GatewaySocketSingletonModule).socket; if (socket.isSessionEstablished()) { if ('userIds' in a0) { value = importDefault(22) /* metro dependency 22 */; value = value(a0.userIds); value = value.chunk(100); value.forEach(_fun35429); } else { socket.requestGuildMembers(a0.guildIds, {query: a0.query, limit: a0.limit, presences: !!a0.presences}); } } return false; function _fun35429(a0) { // fn#35429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:6413, offset: 0x010727fb, size: 85 bytes, params: 2, frame: 16 const socket = (GatewaySocketSingletonModule).socket; const requestGuildMembers = socket.requestGuildMembers; const binding = env0_0; Reflect.apply(requestGuildMembers, socket, [binding.guildIds, {userIds: a0, presences: !!binding.presences}]); } } function CALL_CONNECT_MULTIPLE({channelIds}) { // fn#35433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:7168, offset: 0x01072978, size: 74 bytes, params: 2, frame: 12 const socket = (GatewaySocketSingletonModule).socket; if (socket.isSessionEstablished()) { channelIds.forEach(function(a0) { require(dependencyMap[18]).socket.callConnect(a0); }); } return false; function _fun35434(a0) { // fn#35434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:7277, offset: 0x010729c2, size: 47 bytes, params: 2, frame: 12 (GatewaySocketSingletonModule).socket.callConnect(a0); } } function STREAM_START({streamType, guildId, channelId}) { // fn#35435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4429:7363, offset: 0x010729f1, size: 208 bytes, params: 2, frame: 22 var r2; var streamCreate; const socket = (GatewaySocketSingletonModule).socket; if (socket.isSessionEstablished()) { r2 = guildId != null ? ChannelStore.getChannel(channelId)?.rtcRegion : CallStore.getCall(channelId)?.region; streamCreate = socket.streamCreate; r2 = r2 ?? RTCRegionStore.getPreferredRegion(); Reflect.apply(streamCreate, socket, [streamType, guildId, channelId, r2]); } return false; } } global.__d(_fun35388, 4257, [6, 7, 15, 17, 18, 5, 1348, 1226, 4258, 1379, 4259, 4294, 4402, 1934, 6876, 4395, 661, 670, 12490, 12532, 3, 587, 6944, 4796, 477, 12524, 22, 4285, 12503, 566, 694, 2]) /* metro module 4257, dependencies: [6, 7, 15, 17, 18, 5, 1348, 1226, 4258, 1379, 4259, 4294, 4402, 1934, 6876, 4395, 661, 670, 12490, 12532, 3, 587, 6944, 4796, 477, 12524, 22, 4285, 12503, 566, 694, 2] */;