220 lines
12 KiB
TypeScript
220 lines
12 KiB
TypeScript
/* Metro module 12082; source: modules/routing/convertRouteToNavigation.native.tsx; dependencies: [661, 4010, 4007, 4008, 3974, 3987, 2] */
|
|
function _fun92846(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#92846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12268:6, offset: 0x0209b0a0, size: 117 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = (require(661) /* metro dependency 661: Constants */).Routes;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/routing/convertRouteToNavigation.native.tsx');
|
|
exports.convertRouteToNavigation = convertRouteToNavigation;
|
|
}
|
|
|
|
function convertRouteToNavigation(a0) { // fn#92847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12268:225, offset: 0x0209b115, size: 1386 bytes, params: 2, frame: 32
|
|
var r5;
|
|
var startsWith;
|
|
var moduleValue2;
|
|
var matchPath;
|
|
var object2;
|
|
const RouteParam = (require(3987) /* metro dependency 3987: RouteUtils */).RouteParam;
|
|
var guildId;
|
|
var moduleValue3;
|
|
var value11;
|
|
var moduleValue4;
|
|
var GUILD_MEMBER_VERIFICATION;
|
|
var value13;
|
|
var navigateToMemberVerification;
|
|
var params;
|
|
var channelId2;
|
|
var messageId;
|
|
var navigationReplace;
|
|
var openChannel;
|
|
var moduleValue5;
|
|
var moduleValue6;
|
|
var moduleValue7;
|
|
var coerceGuildsRoute;
|
|
var rootNavigationRef;
|
|
var value18;
|
|
const pathname = a0.pathname;
|
|
var value;
|
|
const value2 = undefined;
|
|
const rootNavigationRef2 = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
|
|
if (rootNavigationRef2 != null) {
|
|
if (rootNavigationRef2.isReady()) {
|
|
startsWith = pathname.startsWith;
|
|
if (Reflect.apply(startsWith, pathname, ['/channels/'])) {
|
|
moduleValue2 = require(3974) /* metro dependency 3974: matchPathCompat */;
|
|
matchPath = moduleValue2.matchPath;
|
|
object2 = {};
|
|
object2.path = '' + Routes.CHANNEL(RouteParam.guildId(),
|
|
RouteParam.channelId({optional: true})) + Routes.VOICE_CHAT_CHANNEL_PARTIAL(RouteParam.guildId({name: 'voiceGuildId'}),
|
|
|
|
|
|
|
|
RouteParam.channelId({name: 'voiceChannelId'}), ':voiceMessageId?');
|
|
if (Reflect.apply(matchPath, moduleValue2, [pathname, object2]) != null) {
|
|
return true;
|
|
}
|
|
moduleValue3 = require(3974) /* metro dependency 3974: matchPathCompat */;
|
|
matchPath = moduleValue3.matchPath;
|
|
object2 = {};
|
|
object2.path = Routes.CHANNEL(RouteParam.guildId(), RouteParam.channelId({optional: true}),
|
|
':messageId?');
|
|
value11 = Reflect.apply(matchPath, moduleValue3, [pathname, object2]);
|
|
if (value11 != null) {
|
|
params = value11.params;
|
|
channelId2 = params.channelId;
|
|
guildId = params.guildId;
|
|
messageId = params.messageId;
|
|
navigationReplace = a0.navigationReplace;
|
|
openChannel = a0.openChannel;
|
|
moduleValue5 = require(4010) /* metro dependency 4010: useChatLayout */;
|
|
if (moduleValue5.getChatLayout().isChatLockedOpen) {
|
|
if (channelId2 == null) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToRootTab({screen: 'guilds', guildId: guildId, channelId: channelId2,
|
|
resetRoot: navigationReplace});
|
|
} else if (navigationReplace !== false) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToRootTab({screen: 'guilds', guildId: guildId, channelId: channelId2,
|
|
resetRoot: navigationReplace});
|
|
} else {
|
|
moduleValue7 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
coerceGuildsRoute = moduleValue7.coerceGuildsRoute;
|
|
rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
|
|
value18 = Reflect.apply(coerceGuildsRoute, moduleValue7,
|
|
[rootNavigationRef == null ? value2 : rootNavigationRef.getCurrentRoute()]);
|
|
if ((value18 == null || value18.params == null ? value2 : value18.params.channelId) === channelId2) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToRootTab({screen: 'guilds', guildId: guildId, channelId: channelId2,
|
|
resetRoot: navigationReplace});
|
|
} else {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToChannel({channelId: channelId2, guildId: guildId, messageId: messageId,
|
|
replaceChannelAndFixRoot: navigationReplace});
|
|
}
|
|
}
|
|
} else if (channelId2 != null) {
|
|
if (navigationReplace !== true) {
|
|
if (navigationReplace !== false) {
|
|
moduleValue6 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
moduleValue6.navigateToRootTab({screen: 'guilds', guildId: guildId,
|
|
channelId: channelId2,
|
|
resetRoot: navigationReplace});
|
|
}
|
|
if (channelId2 != null && navigationReplace !== true) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToChannel({channelId: channelId2, guildId: guildId, messageId: messageId,
|
|
replaceChannelAndFixRoot: value2});
|
|
}
|
|
} else if (openChannel) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToChannel({channelId: channelId2, guildId: guildId, messageId: messageId,
|
|
replaceChannelAndFixRoot: navigationReplace, openChannel: true});
|
|
} else {
|
|
if (navigationReplace !== false) {
|
|
moduleValue6 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
moduleValue6.navigateToRootTab({screen: 'guilds', guildId: guildId,
|
|
channelId: channelId2,
|
|
resetRoot: navigationReplace});
|
|
}
|
|
if (channelId2 != null && navigationReplace !== true) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToChannel({channelId: channelId2, guildId: guildId, messageId: messageId,
|
|
replaceChannelAndFixRoot: value2});
|
|
}
|
|
}
|
|
} else {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.navigateToRootTab({screen: 'guilds', guildId: guildId, channelId: channelId2,
|
|
resetRoot: navigationReplace});
|
|
}
|
|
return true;
|
|
}
|
|
startsWith = pathname.startsWith;
|
|
if (Reflect.apply(startsWith, pathname, ['/member-verification/'])) {
|
|
moduleValue4 = require(3974) /* metro dependency 3974: matchPathCompat */;
|
|
matchPath = moduleValue4.matchPath;
|
|
GUILD_MEMBER_VERIFICATION = Routes.GUILD_MEMBER_VERIFICATION;
|
|
guildId = RouteParam.guildId;
|
|
value13 = Reflect.apply(matchPath, moduleValue4, [pathname,
|
|
{path: Reflect.apply(GUILD_MEMBER_VERIFICATION,
|
|
Routes,
|
|
[Reflect.apply(guildId, RouteParam, [])])}]);
|
|
if (value13 != null) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
navigateToMemberVerification = value.navigateToMemberVerification;
|
|
params = value13.params;
|
|
guildId = params.guildId;
|
|
params = value13.params;
|
|
Reflect.apply(navigateToMemberVerification, value, [guildId, params.inviteCode]);
|
|
}
|
|
return true;
|
|
}
|
|
startsWith = pathname.startsWith;
|
|
if (Reflect.apply(startsWith, pathname, [Routes.LOGIN])) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.resetToAuthRoute();
|
|
value = true;
|
|
r5 = value;
|
|
} else if (pathname.startsWith(Routes.REGISTER)) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.resetToAuthRoute();
|
|
value = true;
|
|
r5 = value;
|
|
} else {
|
|
value = pathname.startsWith(Routes.ACCOUNT_STANDING);
|
|
if (value) {
|
|
rootNavigationRef2.navigate({name: 'account-standing', params: value2});
|
|
r5 = true;
|
|
} else {
|
|
r5 = !!value;
|
|
}
|
|
}
|
|
return r5;
|
|
}
|
|
startsWith = pathname.startsWith;
|
|
if (Reflect.apply(startsWith, pathname, ['/member-verification/'])) {
|
|
moduleValue4 = require(3974) /* metro dependency 3974: matchPathCompat */;
|
|
matchPath = moduleValue4.matchPath;
|
|
GUILD_MEMBER_VERIFICATION = Routes.GUILD_MEMBER_VERIFICATION;
|
|
guildId = RouteParam.guildId;
|
|
value13 = Reflect.apply(matchPath, moduleValue4, [pathname,
|
|
{path: Reflect.apply(GUILD_MEMBER_VERIFICATION,
|
|
Routes,
|
|
[Reflect.apply(guildId, RouteParam, [])])}]);
|
|
if (value13 != null) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
navigateToMemberVerification = value.navigateToMemberVerification;
|
|
params = value13.params;
|
|
guildId = params.guildId;
|
|
params = value13.params;
|
|
Reflect.apply(navigateToMemberVerification, value, [guildId, params.inviteCode]);
|
|
}
|
|
return true;
|
|
}
|
|
startsWith = pathname.startsWith;
|
|
if (Reflect.apply(startsWith, pathname, [Routes.LOGIN])) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.resetToAuthRoute();
|
|
value = true;
|
|
r5 = value;
|
|
} else if (pathname.startsWith(Routes.REGISTER)) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value.resetToAuthRoute();
|
|
value = true;
|
|
r5 = value;
|
|
} else {
|
|
value = pathname.startsWith(Routes.ACCOUNT_STANDING);
|
|
if (value) {
|
|
rootNavigationRef2.navigate({name: 'account-standing', params: value2});
|
|
r5 = true;
|
|
} else {
|
|
r5 = !!value;
|
|
}
|
|
}
|
|
return r5;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|