104 lines
3.9 KiB
TypeScript
104 lines
3.9 KiB
TypeScript
// Metro module 5679 (f5680).
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import { Routes } from "../../Constants";
|
|
import { tryParseDiceRollLink, tryParseChannelPath } from "./LinkUtils";
|
|
import { startDiceRoll } from "../dice_roll/DiceRollActionCreators";
|
|
import { transitionTo } from "../routing/router_utils";
|
|
import isAccessibleChannelOrThreadPath from "./isAccessibleChannelOrThreadPath";
|
|
import AlertActionCreators from "../../actions/native/AlertActionCreators";
|
|
import { intl, t } from "../../intl/index.native";
|
|
import { isModeratorReportOrPostChannelId } from "../report_to_mod/ReportToModUtils";
|
|
import ReportToMod_messages from "../report_to_mod/ReportToMod.messages";
|
|
import RoleSubscriptionsLinkingUtil from "../guild_role_subscriptions/native/mobile_web_purchase/RoleSubscriptionsLinkingUtil";
|
|
export default async function safeTransitionTo(c25534_0, c25534_1) {
|
|
let c25534_2, c25534_4;
|
|
let c29549_0, c29549_1, c29549_2, c29549_3, c29549_4;
|
|
L38: {
|
|
L16: {
|
|
L33: {
|
|
L22: {
|
|
c25534_4 = void 0;
|
|
c29549_0 = c25534_0;
|
|
c29549_1 = c25534_1;
|
|
c29549_2 = void 0;
|
|
c29549_3 = void 0;
|
|
c29549_4 = void 0;
|
|
const r40 = tryParseDiceRollLink(c25534_0);
|
|
if (r40 != null) {
|
|
const { guildId, channelId } = r40;
|
|
startDiceRoll(channelId, r40.diceCount, r40.diceSides);
|
|
transitionTo(Routes.CHANNEL(guildId, channelId), c25534_1);
|
|
break L38;
|
|
}
|
|
const r65 = tryParseChannelPath(c25534_0);
|
|
c29549_2 = r65;
|
|
if (r65 == null) {
|
|
if (c29549_2 != null && c29549_2.guildId != null) {
|
|
c29549_3 = GuildStore.getGuild(c29549_2.guildId);
|
|
c29549_4 = c29549_2.channelId;
|
|
if (c29549_3 != null) {
|
|
if (isModeratorReportOrPostChannelId(c29549_4)) {
|
|
AlertActionCreators.show({
|
|
title: intl.string(ReportToMod_messages.iCIEAV),
|
|
body: intl.string(ReportToMod_messages.bvzo6p),
|
|
confirmText: intl.string(t.BddRzS)
|
|
});
|
|
break L33;
|
|
}
|
|
}
|
|
}
|
|
const r251 = c29549_2;
|
|
c25534_2 = r251;
|
|
if (r251 == null) {
|
|
c25534_2 = {
|
|
guildId: void 0
|
|
};
|
|
}
|
|
if (await RoleSubscriptionsLinkingUtil.maybePerformRoleSubscriptionUpsellRedirect(c25534_2)) {
|
|
break L16;
|
|
}
|
|
} else {
|
|
if (!await isAccessibleChannelOrThreadPath(r65)) {
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.r0DLNm),
|
|
body: intl.string(t["6Y0JlN"]),
|
|
confirmText: intl.string(t.BddRzS)
|
|
});
|
|
break L16;
|
|
}
|
|
if (c29549_2 != null && c29549_2.guildId != null) {
|
|
c29549_3 = GuildStore.getGuild(c29549_2.guildId);
|
|
c29549_4 = c29549_2.channelId;
|
|
if (c29549_3 != null) {
|
|
if (isModeratorReportOrPostChannelId(c29549_4)) {
|
|
AlertActionCreators.show({
|
|
title: intl.string(ReportToMod_messages.iCIEAV),
|
|
body: intl.string(ReportToMod_messages.bvzo6p),
|
|
confirmText: intl.string(t.BddRzS)
|
|
});
|
|
break L22;
|
|
}
|
|
}
|
|
}
|
|
const r147 = c29549_2;
|
|
c25534_2 = r147;
|
|
if (r147 == null) {
|
|
c25534_2 = {
|
|
guildId: void 0
|
|
};
|
|
}
|
|
if (await RoleSubscriptionsLinkingUtil.maybePerformRoleSubscriptionUpsellRedirect(c25534_2)) {
|
|
break L16;
|
|
}
|
|
}
|
|
transitionTo(c29549_0, c29549_1);
|
|
break L16;
|
|
}
|
|
return void 0;
|
|
}
|
|
return void 0;
|
|
}
|
|
return void 0;
|
|
}
|
|
};
|