Files
discord-decomp/sources/modules/routing/native/RouteManagerUtils.tsx
T
2026-07-27 16:20:00 +03:00

552 lines
31 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] */
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 closure = extractParamsFromVoiceModalRoute;
const closure2 = voiceRouteRewriter;
const closure3 = saveLastRouteListener;
const closure4 = saveLastNonVoiceRouteListener;
const closure5 = updateSelectedChannelListener;
const closure6 = extractParams;
const env0_3 = ['channelId', 'guildId'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(29) /* metro dependency 29 */;
const env0_5 = (require(7715) /* metro dependency 7715: ChannelCallStore */).setVoiceChatDrawerState;
const env0_6 = (require(1383) /* metro dependency 1383: ChannelRecord */).isGuildSelectableChannelType;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const defaultRouteStore = importDefault(3973) /* metro dependency 3973: DefaultRouteStore */;
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_11 = value.ME;
const Routes = value.Routes;
const env0_13 = value.ChannelTypes;
const env0_14 = (require(7716) /* metro dependency 7716: ChannelCallConstants */).VoiceChatDrawerState;
value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('RouteUtils');
const CHANNEL = Routes.CHANNEL;
const RouteParam = (require(3987) /* metro dependency 3987: RouteUtils */).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];
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/routing/native/RouteManagerUtils.tsx');
exports.MAIN_DRAWER_ROUTES = value;
exports.extractParamsFromVoiceModalRoute = closure;
exports.popVoiceRoute = popVoiceRoute;
exports.transitionToVoiceRoute = transitionToVoiceRoute;
exports.voiceRouteRewriter = closure2;
exports.saveLastRouteListener = closure3;
exports.saveLastNonVoiceRouteListener = closure4;
exports.updateSelectedChannelListener = closure5;
exports.extractParams = closure6;
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 (require(12074) /* metro dependency 12074 */).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 object2 = {};
copyDataProperties(object2, extractParams({match: value3, location: a0}), value3);
object2['voiceChannelId'] = voiceChannelId;
object2['voiceGuildId'] = voiceGuildId;
object2['voiceMessageId'] = voiceMessageId;
return object2;
}
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 getChannel = ChannelStore.getChannel;
const getLastSelectedChannelId = SelectedChannelStore.getLastSelectedChannelId;
const value2 = Reflect.apply(getChannel, ChannelStore, [Reflect.apply(getLastSelectedChannelId,
SelectedChannelStore, [])]);
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 object2 = {};
const matchPathToRoutesBinding = matchPathToRoutes;
const pathname = a0.pathname;
const value2 = undefined;
object2.match = matchPathToRoutesBinding(pathname, env0_17);
object2.location = a0;
const value3 = extractParamsBinding(object2);
const channelId = value3.channelId;
const guildId = value3.guildId;
let binding = env0_4;
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) {
object2 = {};
copyDataProperties(object2, value4, undefined);
object2['channelId'] = channelId;
object2['guildId'] = guildId;
r0 = object2;
} else if ((value6 == channel ? value2 : channel.type) !== ChannelTypes.GUILD_STAGE_VOICE) {
r0 = value6;
} else {
object2 = {};
copyDataProperties(object2, value4, undefined);
object2['channelId'] = channelId;
object2['guildId'] = guildId;
r0 = object2;
}
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
(require(12079) /* metro dependency 12079: DefaultRouteActionCreators */).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 value4 = null;
const channel = ChannelStore.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 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 = (require(4044) /* metro dependency 4044: Client */).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 object2 = {};
const routeUtilsModule = require(3987) /* metro dependency 3987: RouteUtils */;
object2.guildId = routeUtilsModule.isValidGuildId(guildId) ? guildId : ME;
const moduleValue2 = routeUtilsModule;
object2.channelId = moduleValue2.isValidChannelId(channelId) ? channelId : value;
object2.messageId = messageId;
object2.jumpType = r2;
object2.skipMessageFetch = !!location.skipMessageFetch;
return object2;
}
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 = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */;
const selectChannel = defaultImport.selectChannel;
const object2 = {guildId: a0};
object2.channelId = selectLastVisitedTextChannel(a0);
Reflect.apply(selectChannel, defaultImport, [object2]);
(require(1230) /* metro dependency 1230: router_utils */).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();
}
}
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__;
(require(7709) /* metro dependency 7709: PrivateChannelCallUtils */).openGuildVoiceModal(env0_0);
}