550 lines
27 KiB
TypeScript
550 lines
27 KiB
TypeScript
/* 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] */
|
|
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});
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_5 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_6 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_7 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_8 = importDefault(18) /* metro dependency 18 */;
|
|
const env0_9 = importDefault(5) /* metro dependency 5 */;
|
|
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const callStore = importDefault(4258) /* metro dependency 4258: CallStore */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
|
|
const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */;
|
|
const rtcRegionStore = importDefault(4402) /* metro dependency 4402: RTCRegionStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
const selfPresenceStore = importDefault(6876) /* metro dependency 6876: SelfPresenceStore */;
|
|
const streamRTCConnectionStore = importDefault(4395) /* metro dependency 4395: StreamRTCConnectionStore */;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_20 = value.RTCConnectionStates;
|
|
const env0_21 = value.AppStates;
|
|
const env0_22 = (require(670) /* metro dependency 670: UserSettingsConstants */).UserSettingsTypes;
|
|
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 = (importDefault(566) /* metro dependency 566: 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,
|
|
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_35395();
|
|
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_35395();
|
|
}
|
|
}});
|
|
(require(2) /* metro dependency 2 */).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 env0_9(_fun35394).apply(this, arguments);
|
|
}
|
|
|
|
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 _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 closure = GatewayConnectionStore;
|
|
env0_8(closure, a0);
|
|
return env0_5(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(AuthenticationStore, CallStore, ChannelStore, MediaEngineStore, RTCConnectionStore, RTCRegionStore,
|
|
SelectedChannelStore, SelfPresenceStore, StreamRTCConnectionStore, UserSettingsProtoStore);
|
|
this.syncWith([MediaEngineStore], handleMediaEngineChange);
|
|
this.syncWith([SelfPresenceStore], 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 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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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 object2 = {};
|
|
const socket = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket;
|
|
object2.isEstablished = socket.isSessionEstablished();
|
|
Reflect.apply(verbose, binding, ['session refresh dispatched', object2]);
|
|
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(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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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_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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket;
|
|
const localVoiceState = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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 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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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;
|
|
const socket = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isIOS()) {
|
|
if (AuthenticationStore.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);
|
|
if (AuthenticationStore.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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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 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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket;
|
|
if (socket.isSessionEstablished()) {
|
|
channelIds.forEach(function(a0) {
|
|
require(dependencyMap[18]).socket.callConnect(a0);
|
|
});
|
|
}
|
|
return false;
|
|
}
|
|
|
|
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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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;
|
|
}
|
|
|
|
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 object2 = {};
|
|
const voiceChannelId = env2_17.getVoiceChannelId();
|
|
if (voiceChannelId == null) {
|
|
env2_0(env2_3[18]).localVoiceState.update(object2, 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 = object2;
|
|
} else {
|
|
object2 = {};
|
|
object2.guildId = channel.getGuildId();
|
|
object2.channelId = voiceChannelId;
|
|
env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId);
|
|
r7 = object2;
|
|
}
|
|
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 = object2;
|
|
} else {
|
|
object2 = {};
|
|
object2.guildId = channel.getGuildId();
|
|
object2.channelId = voiceChannelId;
|
|
env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId);
|
|
r7 = object2;
|
|
}
|
|
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 = object2;
|
|
} else {
|
|
object2 = {};
|
|
object2.guildId = channel.getGuildId();
|
|
object2.channelId = voiceChannelId;
|
|
env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId);
|
|
r7 = object2;
|
|
}
|
|
} else if (env2_27) {
|
|
binding = env2_15;
|
|
binding.setLastSessionVoiceChannelId(voiceChannelId ?? null);
|
|
binding = env2_1;
|
|
binding(env2_3[23]).selectVoiceChannel(null);
|
|
r7 = object2;
|
|
} else {
|
|
channel = env2_13.getChannel(voiceChannelId);
|
|
if (channel == null) {
|
|
r7 = object2;
|
|
} else {
|
|
object2 = {};
|
|
object2.guildId = channel.getGuildId();
|
|
object2.channelId = voiceChannelId;
|
|
env2_0(env2_3[22]).muteCustomJoinSound(voiceChannelId);
|
|
r7 = object2;
|
|
}
|
|
}
|
|
env2_0(env2_3[18]).localVoiceState.update(r7, true);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
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 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 _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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).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 _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 = (require(12490) /* metro dependency 12490: GatewaySocketSingleton */).socket;
|
|
const requestGuildMembers = socket.requestGuildMembers;
|
|
const binding = env0_0;
|
|
Reflect.apply(requestGuildMembers, socket, [binding.guildIds, {userIds: a0, presences: !!binding.presences}]);
|
|
}
|
|
|