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

566 lines
34 KiB
TypeScript

/* Metro module 12073; source: modules/routing/native/RouteManagerUtils.tsx; dependencies: [29, 7715, 1383, 1379, 3973, 1935, 1934, 661, 7716, 3, 3987, 12074, 4796, 1230, 12079, 5080, 7709, 6593, 7713, 4007, 694, 7712, 4044, 12080, 2] */
import ObjectWithoutProperties from '../../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import GuildChannelStore from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import DefaultRouteStore from '../../../stores/DefaultRouteStore.tsx'; /* Metro dependency 3973 */
import SelectedChannelActionCreators from '../../../actions/SelectedChannelActionCreators.tsx'; /* Metro dependency 4796 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as Router_utilsModule from '../router_utils.tsx'; /* Metro dependency 1230 */
import * as ChannelRecordModule from '../../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as RouteUtilsModule from '../RouteUtils.tsx'; /* Metro dependency 3987 */
import * as ClientModule from '../../../flow/Client.tsx'; /* Metro dependency 4044 */
import * as PrivateChannelCallUtilsModule from '../../../utils/native/PrivateChannelCallUtils.tsx'; /* Metro dependency 7709 */
import * as ChannelCallStoreModule from '../../video_calls/native/ChannelCallStore.tsx'; /* Metro dependency 7715 */
import * as ChannelCallConstantsModule from '../../video_calls/native/ChannelCallConstants.tsx'; /* Metro dependency 7716 */
import * as Module12074Module from '../../../by-id/module-12074.js'; /* Metro dependency 12074 */
import * as DefaultRouteActionCreatorsModule from '../../../actions/DefaultRouteActionCreators.tsx'; /* Metro dependency 12079 */
function _fun92759(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#92759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:6, offset: 0x0209825c, size: 750 bytes, params: 8, frame: 30
const env0_0 = require;
const extractParamsFromVoiceModalRoute2 = extractParamsFromVoiceModalRoute;
const voiceRouteRewriter2 = voiceRouteRewriter;
const saveLastRouteListener2 = saveLastRouteListener;
const saveLastNonVoiceRouteListener2 = saveLastNonVoiceRouteListener;
const updateSelectedChannelListener2 = updateSelectedChannelListener;
const extractParams2 = extractParams;
const env0_3 = ['channelId', 'guildId'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_11 = value.ME;
const Routes = value.Routes;
const env0_13 = value.ChannelTypes;
value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('RouteUtils');
const CHANNEL = Routes.CHANNEL;
const RouteParam = (RouteUtilsModule).RouteParam;
value = RouteParam.guildId();
value = Reflect.apply(CHANNEL, Routes, [value, RouteParam.channelId({optional: true}), ':messageId?']);
const VOICE_CHAT_CHANNEL_PARTIAL = Routes.VOICE_CHAT_CHANNEL_PARTIAL;
object = ['' + value + Reflect.apply(VOICE_CHAT_CHANNEL_PARTIAL, Routes,
[RouteParam.guildId({name: 'voiceGuildId'}), RouteParam.channelId({name: 'voiceChannelId'}),
':voiceMessageId?']), value];
(FileImportTrackerModule).fileFinishedImporting('modules/routing/native/RouteManagerUtils.tsx');
exports.MAIN_DRAWER_ROUTES = value;
exports.extractParamsFromVoiceModalRoute = extractParamsFromVoiceModalRoute2;
exports.popVoiceRoute = popVoiceRoute;
exports.transitionToVoiceRoute = transitionToVoiceRoute;
exports.voiceRouteRewriter = voiceRouteRewriter2;
exports.saveLastRouteListener = saveLastRouteListener2;
exports.saveLastNonVoiceRouteListener = saveLastNonVoiceRouteListener2;
exports.updateSelectedChannelListener = updateSelectedChannelListener2;
exports.extractParams = extractParams2;
exports.initializeRouteManagerIfNeeded = initializeRouteManagerIfNeeded;
exports.cleanupRouteManager = cleanupRouteManager;
function matchPathToRoutes(a0, a1) { // fn#92760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:631, offset: 0x0209854a, size: 61 bytes, params: 3, frame: 13
return (Module12074Module).matchPath(a0, {'path': null, 'strict': false, 'exact': false,
path: a1});
}
function extractParamsFromVoiceModalRoute(a0) { // fn#92761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:720, offset: 0x02098587, size: 127 bytes, params: 2, frame: 18
const matchPathToRoutesBinding = matchPathToRoutes;
const pathname = a0.pathname;
const value2 = undefined;
const value3 = matchPathToRoutesBinding(pathname, env0_17);
const {voiceChannelId, voiceGuildId, voiceMessageId} = (value3 == null ? value2 : value3.params) ?? ({});
const object = {};
copyDataProperties(object, extractParams({match: value3, location: a0}), value3);
object['voiceChannelId'] = voiceChannelId;
object['voiceGuildId'] = voiceGuildId;
object['voiceMessageId'] = voiceMessageId;
return object;
}
function selectLastVisitedTextChannel(a0) { // fn#92762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:997, offset: 0x02098606, size: 144 bytes, params: 2, frame: 16
var r0;
var mostRecentSelectedTextChannelId;
var defaultChannel;
const channelStoreBinding = ChannelStore;
const getChannel = channelStoreBinding.getChannel;
const selectedChannelStoreBinding = SelectedChannelStore;
const getLastSelectedChannelId = selectedChannelStoreBinding.getLastSelectedChannelId;
const value2 = Reflect.apply(getChannel, channelStoreBinding, [Reflect.apply(getLastSelectedChannelId,
selectedChannelStoreBinding, [])]);
const value3 = undefined;
if ((value2 == null ? value3 : value2.type) == null) {
mostRecentSelectedTextChannelId = SelectedChannelStore.getMostRecentSelectedTextChannelId(a0);
if (mostRecentSelectedTextChannelId != null) {
r0 = mostRecentSelectedTextChannelId;
} else {
defaultChannel = GuildChannelStore.getDefaultChannel(a0);
r0 = defaultChannel == null ? value3 : defaultChannel.id;
}
} else if (isGuildSelectableChannelType(value2 == null ? value3 : value2.type)) {
r0 = value2.id;
} else {
mostRecentSelectedTextChannelId = SelectedChannelStore.getMostRecentSelectedTextChannelId(a0);
if (mostRecentSelectedTextChannelId != null) {
r0 = mostRecentSelectedTextChannelId;
} else {
defaultChannel = GuildChannelStore.getDefaultChannel(a0);
r0 = defaultChannel == null ? value3 : defaultChannel.id;
}
}
return r0;
}
function voiceRouteRewriter(a0) { // fn#92763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:1256, offset: 0x02098696, size: 424 bytes, params: 2, frame: 22
var r0;
var value9;
const state = a0.state;
const extractParamsBinding = extractParams;
let object = {};
const matchPathToRoutesBinding = matchPathToRoutes;
const pathname = a0.pathname;
const value2 = undefined;
object.match = matchPathToRoutesBinding(pathname, env0_17);
object.location = a0;
const value3 = extractParamsBinding(object);
const channelId = value3.channelId;
const guildId = value3.guildId;
let binding = ObjectWithoutProperties;
const value4 = binding(value3, env0_3);
const channel = ChannelStore.getChannel(channelId);
const value6 = null;
if (value6 == channelId) {
r0 = value6;
} else if (value6 == guildId) {
r0 = value6;
} else if ((value6 == channel ? value2 : channel.type) === ChannelTypes.GUILD_VOICE) {
object = {};
copyDataProperties(object, value4, undefined);
object['channelId'] = channelId;
object['guildId'] = guildId;
r0 = object;
} else if ((value6 == channel ? value2 : channel.type) !== ChannelTypes.GUILD_STAGE_VOICE) {
r0 = value6;
} else {
object = {};
copyDataProperties(object, value4, undefined);
object['channelId'] = channelId;
object['guildId'] = guildId;
r0 = object;
}
if (value6 != r0) {
if (value6 != env0_15) {
binding = env0_15;
binding.log('voiceRouteRewriter: has voiceChannelParams = ' + global.JSON.stringify(r0));
}
value9 = '' + DefaultRouteStore.lastNonVoiceRoute + Routes.VOICE_CHAT_CHANNEL_PARTIAL(r0.guildId, r0.channelId,
r0.messageId);
if (value9 === a0.pathname) {
r0 = value6;
} else {
if (value6 != env0_15) {
binding = env0_15;
binding.log('voiceRouteRewriter: rewriting route: ' + a0.pathname + ' -> ' + value9);
}
r0 = {path: value9, state: state};
}
return r0;
}
return value6;
}
function saveLastRouteListener({pathname}) { // fn#92764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:1952, offset: 0x0209883e, size: 47 bytes, params: 2, frame: 12
(DefaultRouteActionCreatorsModule).saveLastRoute(pathname);
}
function saveLastNonVoiceRouteListener(a0) { // fn#92765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:2021, offset: 0x0209886d, size: 207 bytes, params: 2, frame: 18
var moduleValue;
const matchPathToRoutesBinding = matchPathToRoutes;
const pathname = a0.pathname;
const value2 = undefined;
const value3 = matchPathToRoutesBinding(pathname, env0_17);
const channelStoreBinding = ChannelStore;
const value4 = null;
const channel = channelStoreBinding.getChannel(value4 == value3 ? value2 : value3.params.channelId);
const type = value4 == channel ? value2 : channel.type;
const GUILD_VOICE = ChannelTypes.GUILD_VOICE;
const r1 = type === GUILD_VOICE || (value4 == channel ? value2 : channel.type) === ChannelTypes.GUILD_STAGE_VOICE ? value4 : extractParams({match: value3,
location: a0});
if (value4 != r1) {
moduleValue = require(12079) /* metro dependency 12079: DefaultRouteActionCreators */;
moduleValue.saveLastNonVoiceRoute(Routes.CHANNEL(r1.guildId, r1.channelId));
}
return value2;
}
function updateSelectedChannelListener(a0) { // fn#92766, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:2405, offset: 0x0209893c, size: 1194 bytes, params: 2, frame: 39
var id;
var r8;
var channel;
var binding;
var log;
var JSON;
var verbose;
var value6;
var moduleValue;
var defaultImport2;
var moduleValue2;
var isModalOpen;
var moduleValue3;
var defaultImport3;
var popAboveKey;
var moduleValue4;
var value12;
var channel2;
var defaultImport5;
var popWithKey;
var moduleValue5;
var value;
const extractParamsFromVoiceModalRouteBinding = extractParamsFromVoiceModalRoute;
const value2 = undefined;
let r1 = extractParamsFromVoiceModalRouteBinding(a0) ?? ({});
const guildId = r1.guildId;
const channelId = r1.channelId;
const messageId = r1.messageId;
const jumpType = r1.jumpType;
const voiceChannelId = r1.voiceChannelId;
const voiceGuildId = r1.voiceGuildId;
const voiceMessageId = r1.voiceMessageId;
if (voiceChannelId != null) {
channel = ChannelStore.getChannel(voiceChannelId);
if ((channel == null ? value2 : channel.type) === ChannelTypes.GUILD_VOICE) {
if (env0_15 != null) {
binding = env0_15;
verbose = binding.verbose;
JSON = global.JSON;
value6 = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(verbose, binding,
['UpdateSelectedChannelListener -> voice route present! ' + value6 + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
moduleValue = require(7713) /* metro dependency 7713: VoicePanelUtilsNative */;
if (!moduleValue.isVoicePanelEnabled(channel)) {
(importDefault(6593) /* metro dependency 6593: GuildActionCreators */).selectGuild(voiceGuildId);
defaultImport2 = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */;
defaultImport2.selectChannel({guildId: voiceGuildId, channelId: voiceChannelId,
messageId: voiceMessageId,
jumpType: jumpType});
}
moduleValue2 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
isModalOpen = moduleValue2.isModalOpen;
moduleValue3 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
if (!Reflect.apply(isModalOpen, moduleValue2, [moduleValue3.getVoiceChannelKey(channel.id)])) {
defaultImport3 = importDefault(5080) /* metro dependency 5080: ModalActionCreators */;
popAboveKey = defaultImport3.popAboveKey;
moduleValue4 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
Reflect.apply(popAboveKey, defaultImport3, [moduleValue4.getVoiceChannelKey(channel.id)]);
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun92767);
}
r8 = channel.isGuildVoice() && voiceMessageId != null;
r8 = !r8 ? channel.isGuildStageVoice() : r8;
if (r8) {
setVoiceChatDrawerState(channel.id, VoiceChatDrawerState.OPEN);
r1 = voiceGuildId != null && voiceChannelId != null;
r1 = r1 && voiceMessageId != null;
if (r1) {
(importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */).jumpToVoiceChannelMessage(voiceGuildId,
voiceChannelId, voiceMessageId, jumpType);
}
}
} else if ((channel == null ? value2 : channel.type) === ChannelTypes.GUILD_STAGE_VOICE) {
if (env0_15 != null) {
binding = env0_15;
verbose = binding.verbose;
JSON = global.JSON;
value6 = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(verbose, binding,
['UpdateSelectedChannelListener -> voice route present! ' + value6 + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
moduleValue = require(7713) /* metro dependency 7713: VoicePanelUtilsNative */;
if (!moduleValue.isVoicePanelEnabled(channel)) {
(importDefault(6593) /* metro dependency 6593: GuildActionCreators */).selectGuild(voiceGuildId);
defaultImport2 = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */;
defaultImport2.selectChannel({guildId: voiceGuildId, channelId: voiceChannelId,
messageId: voiceMessageId,
jumpType: jumpType});
}
moduleValue2 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
isModalOpen = moduleValue2.isModalOpen;
moduleValue3 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
if (!Reflect.apply(isModalOpen, moduleValue2, [moduleValue3.getVoiceChannelKey(channel.id)])) {
defaultImport3 = importDefault(5080) /* metro dependency 5080: ModalActionCreators */;
popAboveKey = defaultImport3.popAboveKey;
moduleValue4 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
Reflect.apply(popAboveKey, defaultImport3, [moduleValue4.getVoiceChannelKey(channel.id)]);
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun92767);
}
r8 = channel.isGuildVoice() && voiceMessageId != null;
r8 = !r8 ? channel.isGuildStageVoice() : r8;
if (r8) {
setVoiceChatDrawerState(channel.id, VoiceChatDrawerState.OPEN);
r1 = voiceGuildId != null && voiceChannelId != null;
r1 = r1 && voiceMessageId != null;
if (r1) {
(importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */).jumpToVoiceChannelMessage(voiceGuildId,
voiceChannelId, voiceMessageId, jumpType);
}
}
} else if (env0_15 != null) {
binding = env0_15;
log = binding.log;
id = channel == null ? value2 : channel.id;
JSON = global.JSON;
value = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(log, binding,
['UpdateSelectedChannelListener -> !!!VERY BAD!!! channel.id ' + id + ' (voiceChannelId ' + voiceChannelId + ') is not a voice channel! and yet RouteUtils thinks it is! ' + value + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
} else {
if (voiceGuildId == null) {
if (env0_15 != null) {
binding = env0_15;
verbose = binding.verbose;
JSON = global.JSON;
value12 = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(verbose, binding,
['UpdateSelectedChannelListener -> no voice route present in ' + value12 + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
channel2 = ChannelStore.getChannel(SelectedChannelStore.getLastSelectedChannelId());
r8 = channel2 != null && channel2.isGuildVoice();
r8 = !r8 ? channel2 != null && channel2.isGuildStageVoice() : r8;
if (r8) {
defaultImport5 = importDefault(5080) /* metro dependency 5080: ModalActionCreators */;
popWithKey = defaultImport5.popWithKey;
moduleValue5 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
Reflect.apply(popWithKey, defaultImport5, [moduleValue5.getVoiceChannelKey(channel2.id)]);
}
value = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
value.selectGuild(guildId);
value = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */;
value.selectChannel({guildId: guildId, channelId: channelId, messageId: messageId, jumpType: jumpType,
skipMessageFetch: r1.skipMessageFetch});
return value2;
}
channel = ChannelStore.getChannel(voiceChannelId);
if ((channel == null ? value2 : channel.type) === ChannelTypes.GUILD_VOICE) {
if (env0_15 != null) {
binding = env0_15;
verbose = binding.verbose;
JSON = global.JSON;
value6 = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(verbose, binding,
['UpdateSelectedChannelListener -> voice route present! ' + value6 + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
moduleValue = require(7713) /* metro dependency 7713: VoicePanelUtilsNative */;
if (!moduleValue.isVoicePanelEnabled(channel)) {
(importDefault(6593) /* metro dependency 6593: GuildActionCreators */).selectGuild(voiceGuildId);
defaultImport2 = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */;
defaultImport2.selectChannel({guildId: voiceGuildId, channelId: voiceChannelId,
messageId: voiceMessageId,
jumpType: jumpType});
}
moduleValue2 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
isModalOpen = moduleValue2.isModalOpen;
moduleValue3 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
if (!Reflect.apply(isModalOpen, moduleValue2, [moduleValue3.getVoiceChannelKey(channel.id)])) {
defaultImport3 = importDefault(5080) /* metro dependency 5080: ModalActionCreators */;
popAboveKey = defaultImport3.popAboveKey;
moduleValue4 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
Reflect.apply(popAboveKey, defaultImport3, [moduleValue4.getVoiceChannelKey(channel.id)]);
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun92767);
}
r8 = channel.isGuildVoice() && voiceMessageId != null;
r8 = !r8 ? channel.isGuildStageVoice() : r8;
if (r8) {
setVoiceChatDrawerState(channel.id, VoiceChatDrawerState.OPEN);
r1 = voiceGuildId != null && voiceChannelId != null;
r1 = r1 && voiceMessageId != null;
if (r1) {
(importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */).jumpToVoiceChannelMessage(voiceGuildId,
voiceChannelId, voiceMessageId, jumpType);
}
}
} else if ((channel == null ? value2 : channel.type) === ChannelTypes.GUILD_STAGE_VOICE) {
if (env0_15 != null) {
binding = env0_15;
verbose = binding.verbose;
JSON = global.JSON;
value6 = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(verbose, binding,
['UpdateSelectedChannelListener -> voice route present! ' + value6 + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
moduleValue = require(7713) /* metro dependency 7713: VoicePanelUtilsNative */;
if (!moduleValue.isVoicePanelEnabled(channel)) {
(importDefault(6593) /* metro dependency 6593: GuildActionCreators */).selectGuild(voiceGuildId);
defaultImport2 = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */;
defaultImport2.selectChannel({guildId: voiceGuildId, channelId: voiceChannelId,
messageId: voiceMessageId,
jumpType: jumpType});
}
moduleValue2 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
isModalOpen = moduleValue2.isModalOpen;
moduleValue3 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
if (!Reflect.apply(isModalOpen, moduleValue2, [moduleValue3.getVoiceChannelKey(channel.id)])) {
defaultImport3 = importDefault(5080) /* metro dependency 5080: ModalActionCreators */;
popAboveKey = defaultImport3.popAboveKey;
moduleValue4 = require(7709) /* metro dependency 7709: PrivateChannelCallUtils */;
Reflect.apply(popAboveKey, defaultImport3, [moduleValue4.getVoiceChannelKey(channel.id)]);
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun92767);
}
r8 = channel.isGuildVoice() && voiceMessageId != null;
r8 = !r8 ? channel.isGuildStageVoice() : r8;
if (r8) {
setVoiceChatDrawerState(channel.id, VoiceChatDrawerState.OPEN);
r1 = voiceGuildId != null && voiceChannelId != null;
r1 = r1 && voiceMessageId != null;
if (r1) {
(importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */).jumpToVoiceChannelMessage(voiceGuildId,
voiceChannelId, voiceMessageId, jumpType);
}
}
} else if (env0_15 != null) {
binding = env0_15;
log = binding.log;
id = channel == null ? value2 : channel.id;
JSON = global.JSON;
value = JSON.stringify(a0);
JSON = global.JSON;
Reflect.apply(log, binding,
['UpdateSelectedChannelListener -> !!!VERY BAD!!! channel.id ' + id + ' (voiceChannelId ' + voiceChannelId + ') is not a voice channel! and yet RouteUtils thinks it is! ' + value + ' ' + JSON.stringify({guildId: guildId,
channelId: channelId, messageId: messageId, jumpType: jumpType, voiceChannelId: voiceChannelId,
voiceGuildId: voiceGuildId, voiceMessageId: voiceMessageId}) + ' ']);
}
}
return value2;
function _fun92767() { // fn#92767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:3750, offset: 0x02098de6, size: 45 bytes, params: 1, frame: 12
const value = environment.__proto__;
(PrivateChannelCallUtilsModule).openGuildVoiceModal(env0_0);
}
}
function extractParams({match, location}) { // fn#92768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:4248, offset: 0x02098e13, size: 332 bytes, params: 2, frame: 20
const JumpTypes = (ClientModule).JumpTypes;
let value = null;
if (value == match) {
value = environment;
return {'guildId': null, 'channelId': null, 'messageId': null, 'jumpType': null, 'skipMessageFetch': false,
guildId: ME, jumpType: JumpTypes.ANIMATED};
}
const {guildId, channelId, messageId} = match.params;
const jumpType = location.jumpType;
const INSTANT = JumpTypes.INSTANT;
const r2 = jumpType === INSTANT ? JumpTypes.INSTANT : JumpTypes.ANIMATED;
const object = {};
object.guildId = RouteUtilsModule.isValidGuildId(guildId) ? guildId : ME;
object.channelId = RouteUtilsModule.isValidChannelId(channelId) ? channelId : value;
object.messageId = messageId;
object.jumpType = r2;
object.skipMessageFetch = !!location.skipMessageFetch;
return object;
}
function logRouteChange({pathname}) { // fn#92769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:4715, offset: 0x02098f5f, size: 55 bytes, params: 2, frame: 13
env0_15.log('Navigated to: ' + pathname);
}
function popVoiceRoute(a0) { // fn#92770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:4965, offset: 0x02098f96, size: 136 bytes, params: 2, frame: 17
const lastNonVoiceRoute = DefaultRouteStore.lastNonVoiceRoute;
env0_15.log('popVoiceRoute: last non-voice route is ' + lastNonVoiceRoute);
const defaultImport = SelectedChannelActionCreators;
const selectChannel = defaultImport.selectChannel;
const object = {guildId: a0};
object.channelId = selectLastVisitedTextChannel(a0);
Reflect.apply(selectChannel, defaultImport, [object]);
(Router_utilsModule).transitionTo(lastNonVoiceRoute);
}
function transitionToVoiceRoute(a0, a1) { // fn#92771, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:5199, offset: 0x0209901e, size: 226 bytes, params: 3, frame: 28
const defaultRoute = DefaultRouteStore.defaultRoute;
const matchPathToRoutesBinding = matchPathToRoutes;
const value2 = undefined;
const value3 = matchPathToRoutesBinding(defaultRoute, env0_17);
const voiceChannelId = ((value3 == null ? value2 : value3.params) ?? ({})).voiceChannelId;
env0_15.log('transitionToVoiceRoute(<' + a0 + '>, <' + a1 + '>), current route ' + defaultRoute + ' has voiceChannelId ' + voiceChannelId);
if (voiceChannelId !== a1) {
(require(1230) /* metro dependency 1230: router_utils */).transitionToGuild(a0, a1);
} else {
env0_15.log('transitionToVoiceRoute -> ' + voiceChannelId + ' === ' + a1 + '. staying where we are');
}
return value2;
}
function initializeRouteManagerIfNeeded() { // fn#92772, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:5819, offset: 0x02099100, size: 177 bytes, params: 1, frame: 16
var defaultImport;
if (!env0_16) {
defaultImport = importDefault(12080) /* metro dependency 12080: RouteManager */;
defaultImport.addRouteRewriter(voiceRouteRewriter);
(importDefault(12080) /* metro dependency 12080: RouteManager */).addRouteChangeListener(saveLastRouteListener);
(importDefault(12080) /* metro dependency 12080: RouteManager */).addRouteChangeListener(saveLastNonVoiceRouteListener);
(importDefault(12080) /* metro dependency 12080: RouteManager */).addRouteChangeListener(updateSelectedChannelListener);
(importDefault(12080) /* metro dependency 12080: RouteManager */).addRouteChangeListener(logRouteChange);
(importDefault(12080) /* metro dependency 12080: RouteManager */).initialize();
}
}
function cleanupRouteManager() { // fn#92773, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12259:6191, offset: 0x020991b1, size: 175 bytes, params: 1, frame: 16
var defaultImport;
if (env0_16) {
defaultImport = importDefault(12080) /* metro dependency 12080: RouteManager */;
defaultImport.removeRouteRewriter(voiceRouteRewriter);
(importDefault(12080) /* metro dependency 12080: RouteManager */).removeRouteChangeListener(saveLastRouteListener);
(importDefault(12080) /* metro dependency 12080: RouteManager */).removeRouteChangeListener(saveLastNonVoiceRouteListener);
(importDefault(12080) /* metro dependency 12080: RouteManager */).removeRouteChangeListener(updateSelectedChannelListener);
(importDefault(12080) /* metro dependency 12080: RouteManager */).removeRouteChangeListener(logRouteChange);
(importDefault(12080) /* metro dependency 12080: RouteManager */).cleanup();
}
}
}
global.__d(_fun92759, 12073, [29, 7715, 1383, 1379, 3973, 1935, 1934, 661, 7716, 3, 3987, 12074, 4796, 1230, 12079,
5080, 7709, 6593, 7713, 4007, 694, 7712, 4044, 12080,
2]) /* metro module 12073, dependencies: [29, 7715, 1383, 1379, 3973, 1935, 1934, 661, 7716, 3, 3987, 12074, 4796, 1230, 12079, 5080, 7709, 6593, 7713, 4007, 694, 7712, 4044, 12080, 2] */;