This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+148
View File
@@ -0,0 +1,148 @@
// Metro module 4155 (f4156).
import { AppState, NativeEventEmitter, NativeModules } from "react-native";
import { create } from "../../../_bundle/Module644";
import { isAndroid, isIOS } from "../../../utils/PlatformUtils";
import Module4156, { BrowserType } from "../../../_bundle/Module4156";
import { WebBrowserType } from "../../../ConstantsIOS";
import Linking from "../../../lib/native/Linking";
import { assertNever } from "../../../utils/GlobalUtils";
let c2392_8;
const BrowserManager = NativeModules.BrowserManager;
let c2392_7 = create(() => ({
isChromeInstalled: isAndroid() ? Module4156.getConstants().isChromeInstalled : BrowserManager.isChromeInstalled,
selectedBrowser: isAndroid() ? Module4156.getConstants().selectedBrowser : BrowserManager.selectedBrowser,
supportsInAppBrowser: isAndroid() ? Module4156.getConstants().supportsInAppBrowser : BrowserManager.supportsInAppBrowser,
isInAppBrowserOpen: false
}));
c2392_8 = null;
export function useBrowserManagerIsChromeInstalled() {
return c2392_7((a0) => a0.isChromeInstalled);
}
export function getBrowserManagerIsChromeInstalled() {
return c2392_7.getState().isChromeInstalled;
}
export function useBrowserManagerSupportsInAppBrowser() {
return c2392_7((a0) => a0.supportsInAppBrowser);
}
export function useBrowserManagerSelectedBrowser() {
return c2392_7((a0) => a0.selectedBrowser);
}
export function getBrowserManagerSelectedBrowser() {
return c2392_7.getState().selectedBrowser;
}
export function useIsInAppBrowserOpen() {
return c2392_7((a0) => a0.isInAppBrowserOpen);
}
export function getIsInAppBrowserOpen() {
return c2392_7.getState().isInAppBrowserOpen;
}
export function subscribeToIsInAppBrowserOpen(c13869_0) {
return c2392_7.subscribe((a0, a1) => {
if (a0.isInAppBrowserOpen !== a1.isInAppBrowserOpen) {
c13869_0(a0.isInAppBrowserOpen, a1.isInAppBrowserOpen);
}
});
}
export function browserManagerOpenUrl(a0, r8 = c2392_7.getState().selectedBrowser) {
L19: {
if (r8 !== WebBrowserType.SAFARI) {
if (r8 === WebBrowserType.CHROME && !c2392_7.getState().isChromeInstalled) {
break L19;
}
if (r8 === WebBrowserType.IN_APP && isAndroid() && !c2392_7.getState().supportsInAppBrowser) {
break L19;
}
if (WebBrowserType.IN_APP === r8) {
return (isAndroid() ? Module4156.openInAppURL(a0) : BrowserManager.openInAppURL(a0)).then((result) => {
if (result !== false) {
c2392_7.setState({
isInAppBrowserOpen: true
});
const r11 = c2392_8;
if (r11 != null) {
r11.remove();
}
c2392_8 = null;
if (isIOS()) {
c2392_8 = new NativeEventEmitter(BrowserManager).addListener("safariViewControllerDidFinish", () => {
c2392_7.setState({
isInAppBrowserOpen: false
});
const r6 = c2392_8;
if (r6 != null) {
r6.remove();
}
c2392_8 = null;
});
} else if (isAndroid()) {
c2392_8 = AppState.addEventListener("change", (a0) => {
if (a0 === "active" && c2392_7.getState().isInAppBrowserOpen) {
c2392_7.setState({
isInAppBrowserOpen: false
});
const r12 = c2392_8;
if (r12 != null) {
r12.remove();
}
c2392_8 = null;
}
});
}
}
});
}
if (WebBrowserType.CHROME === r8) {
return isAndroid() ? Module4156.openInChromeURL(a0) : BrowserManager.openInChromeURL(a0, true);
}
return assertNever(r8);
}
}
Linking.performURLNavigation(a0);
return Promise.resolve();
}
export function browserManagerSelectBrowser(a0) {
if (isAndroid()) {
if (WebBrowserType.SAFARI === a0) {
Module4156.selectBrowser(BrowserType.SAFARI);
} else if (WebBrowserType.IN_APP === a0) {
Module4156.selectBrowser(BrowserType.IN_APP);
} else if (WebBrowserType.CHROME === a0) {
Module4156.selectBrowser(BrowserType.CHROME);
}
} else {
NativeModules.BrowserManager.selectBrowser(a0);
}
c2392_7.setState({
selectedBrowser: a0
});
}
export function browserManagerCloseBrowser() {
c2392_7.setState({
isInAppBrowserOpen: false
});
if (!isAndroid()) {
NativeModules.BrowserManager.closeBrowser();
}
}
export function openPlayStoreInlineInstall(a0, a1, a2) {
let r23;
let c13870_1 = Date.now();
if (isAndroid()) {
r23 = Module4156.openPlayStoreInline(a0, a1, function callback() {
const r7 = Date.now() - c13870_1;
if (a2 != null) {
a2(r7);
}
});
} else if (a1 == null) {
r23 = Promise.resolve(false);
} else {
if (a2 != null) {
BrowserManager.setOpenAppStoreDismissCallback(() => {
a2(Date.now() - c13870_1);
});
}
r23 = BrowserManager.openAppStoreInline(a0, a1);
}
return r23;
}
+9
View File
@@ -0,0 +1,9 @@
// Metro module 3883 (f3884).
import { NativeModules } from "react-native";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module3884 from "../../../_bundle/Module3884";
const r17 = {
tryOpenUrlAsUniversalLink: (a0) => isAndroid() ? Module3884.tryOpenUrlAsUniversalLink(a0) : NativeModules.DCDLinkingManager.tryOpenUrlAsUniversalLink(a0),
tryOpenScheme: (a0) => isAndroid() ? Module3884.tryOpenScheme(a0) : NativeModules.DCDLinkingManager.tryOpenScheme(a0)
};
export default r17;
+10
View File
@@ -0,0 +1,10 @@
// Metro module 3885 (f3886).
const r10 = {
bestbuy: {
regex: /(?:^https?:\/\/)(?:www\.)?bestbuy\.com(?:\/(.*))?$/i,
protocol: "bestbuy://"
}
};
const r13 = Object.values(r10);
export { r10 as LINKING_SCHEMAS };
export { r13 as LINKING_SCHEMAS_VALUES };
+54
View File
@@ -0,0 +1,54 @@
// Metro module 3887 (f3888).
const r10 = {
discordConnect: {
regex: /(?:^discordconnect:\/\/)/i,
protocol: "discordconnect://"
},
facebook: {
regex: /(?:^https?:\/\/)(?:www\.)?(facebook\.com)(?:$|\/)/i,
protocol: "fb://"
},
instagram: {
regex: /(?:^https?:\/\/)(?:www\.)?(instagram\.com|instagr\.am)(?:$|\/)/i,
protocol: "instagram://"
},
snapchat: {
regex: /(?:^https?:\/\/)(?:www\.)?(snapchat\.com)(?:$|\/)/i,
protocol: "snapchat://"
},
spotify: {
regex: /(?:^https?:\/\/)(?:open\.)?(spotify\.com)(?:$|\/)/i,
protocol: "https://open.spotify.com"
},
tiktok: {
regex: /(?:^https?:\/\/)(?:www\.)?(tiktok\.com)(?:$|\/)/i,
protocol: "tiktok://"
},
twitch: {
regex: /(?:^https?:\/\/)(?:www\.)?(twitch\.tv)(?:$|\/)/i,
protocol: "twitch://"
},
telegram: {
regex: /(?:^https?:\/\/)(?:www\.)?(t\.me)(?:$|\/)/i,
protocol: "tg://"
},
twitter: {
regex: /(?:^https?:\/\/)(?:www\.)?(?:twitter\.com|x\.com)(?:$|\/)/i,
protocol: "twitter://"
},
whatsapp: {
regex: /(?:^https?:\/\/)(?:www\.)?(whatsapp\.com)(?:$|\/)/i,
protocol: "whatsapp://"
},
youtube: {
regex: /(?:^https?:\/\/)(?:www\.)?(youtube\.com|youtu\.be)(?:$|\/)/i,
protocol: "youtube://"
},
zoom: {
regex: /(?:^https?:\/\/)(?:www\.)?(zoom\.us)(?:$|\/)/i,
protocol: "zoomus://"
}
};
const r35 = Object.values(r10);
export { r10 as LINKING_WHITELIST };
export { r35 as LINKING_WHITELIST_VALUES };
@@ -0,0 +1,79 @@
// Metro module 9547 (f9548).
import { addPostConnectionCallback } from "../../gateway/PostConnectionCallbackStore";
import { Routes } from "../../../Constants";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import safeTransitionTo_native from "../safeTransitionTo.native";
import { transitionTo } from "../../routing/router_utils";
import SummaryActionCreators from "../../summaries/SummaryActionCreators";
function $mk115490($env) {
return (a0, a1) => {
const r2 = $env;
let env31503 = {
$parent: $env
};
env31503[0] = a0;
env31503[1] = a1;
r2[6] = () => (0, env31503[1])(new Error("superseded"));
(0, addPostConnectionCallback)(() => {
env31503.$parent[6] = null;
(0, env31503[0])();
});
};
}
let env6294 = {};
const c6294_6 = null;
export default async function handleContentLinking(c26467_0) {
let env30107;
const r35 = env6294;
let c26467_2 = r35;
const r10 = env30107 = {
$parent: r35
};
let c26467_1 = r10;
env30107[0] = void 0;
env30107[1] = void 0;
env30107[2] = void 0;
env30107[3] = void 0;
env30107[4] = void 0;
env30107[0] = c26467_0.guildId;
env30107[1] = c26467_0.channelId;
env30107[2] = c26467_0.navigationSettings;
env30107[3] = c26467_0.messageId;
env30107[4] = c26467_0.summaryId;
env30107[5] = void 0;
env30107[6] = void 0;
env30107[7] = void 0;
env30107[8] = void 0;
env30107[9] = void 0;
env30107[10] = void 0;
await void 0;
ModalActionCreators.popAll();
env30107[5] = env30107[2].safe;
env30107[6] = env30107[2].navigationReplace;
env30107[7] = env30107[6] === void 0 || env30107[6];
env30107[8] = env30107[2].waitForConnection;
env30107[9] = env30107[8] === void 0 || env30107[8];
env30107[10] = env30107[2].skipMessageFetch;
if (env30107[9]) {
if (c6294_6 != null) {
c6294_6();
}
await new Promise($mk115490(env6294));
}
if (env30107[5]) {
await safeTransitionTo_native(Routes.CHANNEL(env30107[0], env30107[1], env30107[3]), {
navigationReplace: env30107[7],
openChannel: true,
skipMessageFetch: env30107[10]
});
} else {
transitionTo(Routes.CHANNEL(env30107[0], env30107[1], env30107[3]), {
navigationReplace: env30107[7],
openChannel: true,
skipMessageFetch: env30107[10]
});
}
if (env30107[1] != null && env30107[4] != null) {
SummaryActionCreators.setSelectedSummary(env30107[1], env30107[4]);
}
};
+284
View File
@@ -0,0 +1,284 @@
// Metro module 16731 (f16732).
import ChannelStore from "../../../stores/ChannelStore";
import RTCConnectionStore from "../../../stores/RTCConnectionStore";
import AppStateStore from "../../../stores/native/AppStateStore";
import { AnalyticEvents, AppStates, LinkingTypes } from "../../../Constants";
import Logger from "../../debug/Logger";
import { trackAppOpened } from "../../tti_analytics/native/TTIAnalyticsUtils";
import { DeeplinkSource } from "../../deep_link/DeepLinkTypes";
import { navigateToVoiceChannel } from "../../../utils/native/PrivateChannelCallUtils";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import handleSupportedURL from "./handleSupportedURL";
import parseURL from "../../../utils/native/parseURL";
import { parseInviteCodeFromInviteKey } from "../../instant_invite/InviteCodeUtils";
import { extractId } from "../../../_bundle/Module513";
import InstantInviteActionCreators from "../../../actions/InstantInviteActionCreators";
import externalFingerprint from "../../auth/externalFingerprint";
import { HermesBuiltin } from "../../../_hermes/prelude";
let c12059_10 = new Logger("index.native.tsx");
export default async function handleIncomingURL(c28510_0, c28510_1) {
let c28510_2, c28510_3, c28510_4, c28510_5;
let c28510_6 = 0;
const r42 = "Empty or whitespace-only URL fragment in AppsFlyer legacy URL";
const r14 = void 0;
L105: {
L104: {
L94: {
L93: {
L92: {
L77: {
L20: {
try {
let env31108;
c28510_4 = r14;
const r47 = env31108 = {};
c28510_3 = r47;
env31108[0] = c28510_0;
env31108[1] = c28510_1;
env31108[2] = void 0;
env31108[3] = void 0;
env31108[4] = void 0;
env31108[5] = void 0;
env31108[6] = void 0;
env31108[7] = void 0;
env31108[8] = void 0;
env31108[9] = void 0;
env31108[10] = void 0;
env31108[11] = void 0;
env31108[12] = void 0;
env31108[13] = void 0;
env31108[14] = void 0;
env31108[15] = void 0;
env31108[2] = c28510_0.url;
env31108[3] = c28510_0.source;
c12059_10.log(`Opening url: ${env31108[2]} [${env31108[3]}]`);
if (AppStateStore.getState() !== AppStates.ACTIVE) {
trackAppOpened(env31108[2] == null ? "launcher" : "deeplink");
}
if (env31108[2] == null) {
break L105;
}
L13: {
if (env31108[2].startsWith("discord://app/open")) {
const r97 = env31108[2].indexOf("#");
if (r97 !== -1) {
const r101 = env31108[2].substring(r97 + 1);
env31108[4] = r101;
if (r101 !== "" && r101.trim() !== "") {
c28510_6 = 1;
const uRL = new URL(r101);
env31108[5] = uRL;
env31108[6] = ["campaign", "deep_link_value", "media_source"];
c28510_2 = 0;
const r123 = uRL.searchParams.keys();
const r124 = [];
c28510_2 = HermesBuiltin.arraySpread(r124, r123, c28510_2);
r124.filter((item) => item.startsWith("af_") || env31108[6].includes(item)).forEach((item) => env31108[5].searchParams.delete(item));
env31108[2] = uRL.toString();
env31108[3] = DeeplinkSource.AppsFlyer;
c12059_10.log(`Extracted clean URL from AppsFlyer legacy URL: ${env31108[2]}`);
c28510_6 = 0;
break L13;
}
c12059_10.warn(r42, {
originalUrl: env31108[2]
});
break L20;
}
c12059_10.warn("No hash mark found in AppsFlyer legacy URL", {
originalUrl: env31108[2]
});
}
}
if (env31108[2].startsWith("discordwidget:///")) {
if (env31108[2].startsWith("discordwidget:///open-voice-panel")) {
const channelId = RTCConnectionStore.getChannelId();
const r480 = channelId != null ? ChannelStore.getChannel(channelId) : null;
if (r480 == null) {
break L104;
}
navigateToVoiceChannel(r480, "LiveActivity");
const r553 = env31108[2].indexOf("?");
const surface = new URLSearchParams(r553 >= 0 ? env31108[2].slice(r553 + 1) : "").get("source");
if (surface !== "lockScreen" && surface !== "dynamicIsland") {
break L104;
}
AnalyticsUtils.track(AnalyticEvents.LIVE_ACTIVITY_INTERACTED, {
action: "Open Voice Panel",
channel_id: r480.id,
surface
});
break L104;
}
const r483 = env31108[2].split("voice/");
if (r483.length !== 2) {
break L94;
}
const r488 = r483[1].split("/");
if (r488.length === 0) {
break L93;
}
if (r488[0] === "user") {
break L105;
}
if (r488[0] === "invite") {
handleSupportedURL({
payload: {
type: LinkingTypes.CREATE_VOICE_INVITE,
guildId: r488[1],
channelId: r488[2]
}
});
break L105;
}
if (r488[0] === "wave") {
handleSupportedURL({
payload: {
type: LinkingTypes.SEND_VOICE_HANGOUT_WAVE,
guildId: r488[1],
channelId: r488[2]
}
});
break L105;
}
if (r488[0] === "join") {
handleSupportedURL({
payload: {
type: LinkingTypes.CHANNEL,
guildId: r488[1],
channelId: r488[2]
}
});
break L105;
}
if (r488.length !== 2) {
break L105;
}
handleSupportedURL({
payload: {
type: LinkingTypes.CHANNEL,
guildId: r488[0],
channelId: r488[1]
}
});
break L92;
}
if (new URL(env31108[2]).hostname === "l.discord.com") {
env31108[2] = (await fetch(env31108[2], {
method: "HEAD",
redirect: "follow"
})).url;
env31108[3] = DeeplinkSource.Iterable;
env31108[7] = parseURL(env31108[2], true);
env31108[8] = env31108[7].fingerprint;
env31108[9] = env31108[7].attemptId;
env31108[10] = env31108[7].payload;
env31108[11] = env31108[7].installationId;
c12059_10.log("Parsed url as: ", env31108[7]);
env31108[12] = env31108[10].inviteCode;
env31108[13] = env31108[10].guildTemplateCode;
env31108[14] = env31108[10].authToken;
env31108[15] = env31108[12] != null ? parseInviteCodeFromInviteKey(env31108[12]) : null;
if (!(env31108[8] == null && env31108[9] == null && env31108[12] == null && env31108[13] == null && env31108[14] == null && env31108[3] == null && env31108[11] == null)) {
const EXTERNAL_DYNAMIC_LINK_RECEIVED2 = AnalyticEvents.EXTERNAL_DYNAMIC_LINK_RECEIVED;
AnalyticsUtils.track(EXTERNAL_DYNAMIC_LINK_RECEIVED2, {
invite_code: env31108[15],
guild_template_code: env31108[13],
has_auth_token: env31108[14] != null && env31108[14].length === 0,
is_backgrounded: AppStateStore.getState() === AppStates.BACKGROUND,
attempt_id: env31108[9],
deeplink_source: env31108[3],
link_type: env31108[10].type,
is_cold_start: env31108[1],
received_installation_id: env31108[11],
...env31108[8] != null ? {
fingerprint: extractId(env31108[8])
} : null
});
}
if (env31108[15] != null && env31108[11] != null) {
InstantInviteActionCreators.setReceivedInstallationIdForInviteCode(env31108[15], env31108[11]);
}
externalFingerprint(env31108[2]);
handleSupportedURL({
payload: env31108[10]
});
break L77;
}
env31108[7] = parseURL(env31108[2], true);
env31108[8] = env31108[7].fingerprint;
env31108[9] = env31108[7].attemptId;
env31108[10] = env31108[7].payload;
env31108[11] = env31108[7].installationId;
c12059_10.log("Parsed url as: ", env31108[7]);
env31108[12] = env31108[10].inviteCode;
env31108[13] = env31108[10].guildTemplateCode;
env31108[14] = env31108[10].authToken;
env31108[15] = env31108[12] != null ? parseInviteCodeFromInviteKey(env31108[12]) : null;
if (!(env31108[8] == null && env31108[9] == null && env31108[12] == null && env31108[13] == null && env31108[14] == null && env31108[3] == null && env31108[11] == null)) {
const EXTERNAL_DYNAMIC_LINK_RECEIVED = AnalyticEvents.EXTERNAL_DYNAMIC_LINK_RECEIVED;
AnalyticsUtils.track(EXTERNAL_DYNAMIC_LINK_RECEIVED, {
invite_code: env31108[15],
guild_template_code: env31108[13],
has_auth_token: env31108[14] != null && env31108[14].length === 0,
is_backgrounded: AppStateStore.getState() === AppStates.BACKGROUND,
attempt_id: env31108[9],
deeplink_source: env31108[3],
link_type: env31108[10].type,
is_cold_start: env31108[1],
received_installation_id: env31108[11],
...env31108[8] != null ? {
fingerprint: extractId(env31108[8])
} : null
});
}
if (env31108[15] != null && env31108[11] != null) {
InstantInviteActionCreators.setReceivedInstallationIdForInviteCode(env31108[15], env31108[11]);
}
externalFingerprint(env31108[2]);
handleSupportedURL({
payload: env31108[10]
});
break L105;
} catch ($e) {
const r64 = $e;
let r8 = r64;
c28510_5 = r64;
if (c28510_6 !== 0) {
while (true) {
try {
const r585 = c28510_5;
c28510_6 = 0;
env31108[16] = r585;
c12059_10.warn("Failed to parse URL from AppsFlyer legacy URL", {
originalUrl: env31108[0].url,
extractedUrlString: env31108[4],
error: env31108[16].message
});
} catch (r581) {
r8 = r581;
c28510_5 = r581;
if (c28510_6 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r8;
}
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
};
+862
View File
@@ -0,0 +1,862 @@
// Metro module 12988 (f12989).
import { addPostConnectionCallback } from "../../gateway/PostConnectionCallbackStore";
import GuildScheduledEventStore from "../../guild_scheduled_events/GuildScheduledEventStore";
import { handleMobileWebCheckoutStatus } from "../../premium/native/PremiumPlanPurchasedStore";
import PremiumNitroNavigationStore from "../../user_settings/premium/native/PremiumNitroNavigationStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import { AnalyticEvents, LinkingTypes, PlatformTypes, Routes, UserSettingsSections } from "../../../Constants";
import { StaticChannelRoute } from "../../channel/ChannelConstants";
import { StreamTypes } from "../../go_live/Constants";
import { NativePermissionTypes } from "../../native_permissions/NativePermissionConstants";
import { OAUTH2_AUTHORIZE_MODAL_KEY } from "../../oauth2/native/Constants";
import { FAMILY_CENTER_LINK_REQUEST_REGEX } from "../../parent_tools/FamilyCenterConstants";
import { MobileWebRedirectCheckoutDeepLinkActions } from "../../payments/PaymentConstants";
import { SHARE_SCREEN_MODAL_KEY } from "../../share/native/ShareScreenConstants";
import { AccountSettingsTabs } from "../../user_settings/account/native/SettingsAccountConstants";
import { MobileSetting } from "../../user_settings/core/native/SettingsConstants";
import { openContactSyncModalDeeplink } from "../../contact_sync/native/ContactSyncModalActionCreators";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
import AddFriendModalActionCreators from "../../../components_native/add_friend/AddFriendModalActionCreators";
import { showUserProfileActionSheetPostConnection } from "../../user_profile/native/showUserProfileActionSheet";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import { showInvite, clearDisplayedInvite } from "../../../actions/native/DisplayedInviteActionCreators";
import GuildTemplateActionCreators from "../../guild_templates/native/GuildTemplateActionCreators";
import { dismissGlobalKeyboard } from "../../../utils/native/KeyboardManagerUtils";
import { resolveGiftCode } from "../../../actions/GiftCodeActionCreators";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { openGiftCodeRedeemModal } from "../../../actions/native/GiftCodeActionCreators";
import { startDiceRoll } from "../../dice_roll/DiceRollActionCreators";
import handleContentLinking from "./handleContentLinking";
import { handleFamilyCenterQRCodeScan } from "../../parent_tools/native/FamilyCenterNativeUtils";
import { isMidjourneyOnboardingFlow } from "../../midjourney_onboarding/MidjourneyOnboardingUtils";
import CreateGuildModalActionCreators from "../../create_guild/native/CreateGuildModalActionCreators";
import authorizeCallback from "../../oauth2/native/authorizeCallback";
import { openOAuth2Modal } from "../../../utils/native/ApplicationUtils";
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
import NativePermissionUtils from "../../native_permissions/NativePermissionUtils";
import Linking from "../../../lib/native/Linking";
import { transitionToGuild } from "../../routing/transitionToGuild.native";
import GuildScheduledEventsActionCreators from "../../guild_scheduled_events/GuildScheduledEventsActionCreators";
import { openGuildEventDetails } from "../../guild_scheduled_events/GuildScheduledEventModalActionCreators.native";
import MobileWebHandoffLinking from "../../mobile_web_handoff/native/MobileWebHandoffLinking";
import transitionToStream_native from "../../go_live/utils/transitionToStream.native";
import { disconnectRemote } from "../../game_console/GameConsoleActionCreators";
import { navigateToRootTab } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { stringify } from "../../../_bundle/keysSorter";
import { transitionTo } from "../../routing/router_utils";
import Dispatcher from "../../../Dispatcher";
import ConnectedAccountsActionCreators from "../../../actions/ConnectedAccountsActionCreators";
import URLUtils from "../../../utils/URLUtils";
import GuildSettingsActionCreators from "../../guild_settings/GuildSettingsActionCreators";
import ActivateDeviceModalActionCreators from "../../activate_device/native/ActivateDeviceModalActionCreators";
import { openGuildSettingsPickerModal } from "../../guild_settings_picker/GuildSettingsPickerActionCreators.native";
import * as _PlatformUtils from "../../../utils/PlatformUtils";
import { showInstantInviteActionSheetForChannel } from "../../instant_invite/native/InstantInviteUtils";
import { openBuildInstallerUrl } from "../../mobile_native_updater/MobileNativeUpdateUtils";
import { fetchSubscriptions } from "../../billing/actions/BillingActionCreators";
import openGuildActionSheet from "../../guild_action_sheet/native/openGuildActionSheet";
import { openCollectiblesShopMobile } from "../../collectibles/CollectiblesActionCreators";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import SecureFramesPlatformUtils_native from "../../rtc/SecureFramesPlatformUtils.native";
import { trackQuestEvent } from "../../quests/lib/analytics/AnalyticsActions";
import { QuestContent } from "../../../_bundle/Module5038";
import { openQuestHome } from "../../quests/native/QuestUtils.native";
import { openGiftModal } from "../../premium/native/utils/openGiftModal";
import openActivityDMLauncher from "../../activities/native/openActivityDMLauncher";
import { openApplyBoostModal } from "../../../actions/native/BoostingActionCreators";
import closeVoicePanels from "../../voice_panel/native/utils/closeVoicePanels";
import { GameProfileSources } from "../../game_profile/GameProfileAnalyticUtils";
import * as _GameProfileActionCreators_native from "../../game_profile/GameProfileActionCreators.native";
import { browserManagerCloseBrowser } from "./BrowserManager";
import { $forInKeys } from "../../../_hermes/prelude";
const _excluded = ["code", "state"];
export default function handleSupportedURL(a0) {
let r0;
let payload, rootNavigationRef, rootNavigationRef2, inviteCode, username, deeplinkAttemptId, guildTemplateCode, pathname, remoteAuthFingerprint, deepLinkAction, gameId, rootNavigationRef3;
L142: {
payload = a0.payload;
const { safe, navigationReplace, waitForConnection, skipMessageFetch } = a0;
rootNavigationRef = void 0;
rootNavigationRef2 = void 0;
inviteCode = void 0;
username = void 0;
deeplinkAttemptId = void 0;
guildTemplateCode = void 0;
pathname = void 0;
remoteAuthFingerprint = void 0;
deepLinkAction = void 0;
gameId = void 0;
rootNavigationRef3 = void 0;
const type = payload.type;
if (LinkingTypes.CONTACT_SYNC === type) {
openContactSyncModalDeeplink();
r0 = true;
} else if (LinkingTypes.COMPOSE_MESSAGE === type) {
ModalActionCreators.popAll();
const rootNavigationRef4 = getRootNavigationRef();
const r486 = rootNavigationRef4 == null;
r0 = true;
if (!r486) {
rootNavigationRef4.navigate("friends", {
screen: "new-message",
params: {
sourcePage: "Deeplink"
}
});
r0 = true;
}
} else if (LinkingTypes.ADD_FRIENDS === type) {
ModalActionCreators.popAll();
rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef == null) {
AddFriendModalActionCreators.openAddFriendModalDeeplink();
r0 = true;
} else if (rootNavigationRef.isReady()) {
rootNavigationRef.navigate("friends", {
screen: "add-friends",
params: {
sourcePage: "Deeplink"
}
});
r0 = true;
} else {
addPostConnectionCallback(() => rootNavigationRef.navigate("friends", {
screen: "add-friends",
params: {
sourcePage: "Deeplink"
}
}));
r0 = true;
}
} else if (LinkingTypes.FRIENDS === type) {
ModalActionCreators.popAll();
rootNavigationRef2 = getRootNavigationRef();
if (rootNavigationRef2 != null) {
if (rootNavigationRef2.isReady()) {
rootNavigationRef2.navigate("friends");
} else {
addPostConnectionCallback(() => {
rootNavigationRef2.navigate("friends");
});
}
}
const r441 = payload.userId != null;
r0 = true;
if (r441) {
showUserProfileActionSheetPostConnection({
userId: payload.userId
});
r0 = true;
}
} else if (LinkingTypes.EDIT_PROFILE === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.PROFILE_CUSTOMIZATION
});
});
r0 = true;
} else if (LinkingTypes.INVITE === type) {
inviteCode = payload.inviteCode;
username = payload.username;
deeplinkAttemptId = payload.deeplinkAttemptId;
if (!AuthenticationStore.isAuthenticated() && inviteCode != null) {
showInvite(inviteCode, username, {
deeplinkAttemptId,
fromDeeplink: true,
location: "Deep Link"
});
r0 = true;
break L142;
}
addPostConnectionCallback(() => {
GuildTemplateActionCreators.hideModal();
if (inviteCode != null) {
dismissGlobalKeyboard();
showInvite(inviteCode, username, {
deeplinkAttemptId,
fromDeeplink: true,
location: "Deep Link"
});
}
});
r0 = true;
} else if (LinkingTypes.GUILD_TEMPLATE === type) {
guildTemplateCode = payload.guildTemplateCode;
addPostConnectionCallback(() => {
clearDisplayedInvite();
if (guildTemplateCode != null) {
dismissGlobalKeyboard();
GuildTemplateActionCreators.showModal(guildTemplateCode);
}
});
r0 = true;
} else if (LinkingTypes.GIFT_CODE === type) {
const giftCode = payload.giftCode;
let r383 = giftCode != null;
if (r383) {
resolveGiftCode(giftCode).then(({ giftCode }) => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "gift_accept",
location: null
});
openGiftCodeRedeemModal(giftCode.code);
}).catch(() => {});
r383 = true;
}
r0 = r383;
} else if (LinkingTypes.ROLL_DICE === type) {
const { guildId: guildId2, channelId: channelId2, diceCount, diceSides } = payload;
let r368 = guildId2 != null && channelId2 != null;
if (r368) {
startDiceRoll(channelId2, diceCount, diceSides);
handleContentLinking({
guildId: guildId2,
channelId: channelId2,
messageId: void 0,
navigationSettings: {
safe,
navigationReplace,
waitForConnection,
skipMessageFetch
}
});
r368 = true;
}
r0 = r368;
} else {
if (LinkingTypes.CHANNEL !== type && LinkingTypes.MESSAGE !== type) {
if (LinkingTypes.SESSION_MANAGEMENT === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.SESSIONS
});
});
r0 = true;
break L142;
}
if (LinkingTypes.FAMILY_CENTER === type) {
const pathname2 = (payload == null ? {} : payload).pathname;
pathname = pathname2 !== void 0 ? pathname2 : null;
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.FAMILY_CENTER
});
if (pathname != null && FAMILY_CENTER_LINK_REQUEST_REGEX.test(pathname)) {
handleFamilyCenterQRCodeScan(pathname, "NativeCameraScan");
}
});
r0 = true;
break L142;
}
if (LinkingTypes.OAUTH2_AUTHORIZE === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
if (isMidjourneyOnboardingFlow()) {
CreateGuildModalActionCreators.openCreateGuildModal(function(a0) {
if (payload.type === LinkingTypes.OAUTH2_AUTHORIZE) {
ModalActionCreators.popAll();
ModalActionCreators.pushLazy(import("../../oauth2/native/OAuth2AuthorizeModal"), {
...payload.props,
guildId: a0,
callback: authorizeCallback,
dismissOAuthModal: () => {
ModalActionCreators.popWithKey(OAUTH2_AUTHORIZE_MODAL_KEY);
}
}, OAUTH2_AUTHORIZE_MODAL_KEY);
}
});
} else {
openOAuth2Modal({
...payload.props,
callback: authorizeCallback
});
}
});
r0 = true;
break L142;
}
if (LinkingTypes.ONE_TIME_LOGIN === type) {
ModalActionCreators.popAll();
ModalActionCreators.pushLazy(import("../../one_time_login/native/OneTimeLoginModal"), {
token: payload.token
}, "ONE_TIME_LOGIN_MODAL");
r0 = true;
break L142;
}
if (LinkingTypes.REMOTE_AUTH === type) {
remoteAuthFingerprint = payload.remoteAuthFingerprint;
addPostConnectionCallback(remoteAuthFingerprint != null ? () => {
ModalActionCreators.pushLazy(import("../../remote_auth/components/native/RemoteAuthModal"), {
remoteAuthFingerprint
}, "REMOTE_AUTH_MODAL");
} : () => {
NativePermissionUtils.requestPermission(isMetaQuest() ? NativePermissionTypes.HEADSET_CAMERA : NativePermissionTypes.CAMERA).then((result) => {
if (result) {
ModalActionCreators.pushLazy(import("../../../components_native/QRScannerModal"), {
showHelp: true
});
}
}).catch(() => {});
});
r0 = true;
break L142;
}
if (LinkingTypes.PROMOTIONS === type) {
Linking.performURLNavigation(payload.url);
r0 = true;
break L142;
}
if (LinkingTypes.FEATURE_PROMO_URL === type) {
Linking.openURLExternally(payload.promoUrl);
r0 = true;
break L142;
}
if (LinkingTypes.USER_PROFILE === type) {
const r288 = payload.userId != null;
r0 = true;
if (!r288) {
break L142;
}
showUserProfileActionSheetPostConnection({
userId: payload.userId
});
r0 = true;
break L142;
}
if (LinkingTypes.BUILD_OVERRIDE === type) {
const overrideUrl = payload.overrideUrl;
ModalActionCreators.popAll();
ModalActionCreators.pushLazy(import("../../build_overrides/native/BuildOverrideModal"), {
overrideUrl
});
r0 = true;
break L142;
}
if (LinkingTypes.GUILD_EVENT_DETAILS === type) {
addPostConnectionCallback(async () => {
let c30599_2;
c30599_2 = void 0;
ModalActionCreators.popAll();
let c31671_0 = payload.guildId;
let c31671_1 = payload.guildEventId;
if ((await import("../../../stores/GuildStore")).default.getGuild(c31671_0) != null) {
transitionToGuild(c31671_0);
}
let guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(c31671_1);
if (guildScheduledEvent == null) {
guildScheduledEvent = await GuildScheduledEventsActionCreators.fetchGuildEvent(c31671_0, c31671_1);
}
let c31671_2 = guildScheduledEvent;
if (c31671_2 != null) {
openGuildEventDetails({
eventId: c31671_2.id,
event: c31671_2
});
}
});
r0 = true;
break L142;
}
if (LinkingTypes.MOBILE_WEB_HANDOFF === type) {
const { nonce, redirectUrl } = payload;
MobileWebHandoffLinking.redirectWithHandoffToken(`${redirectUrl.pathname}${redirectUrl.search}`, {
nonce,
fingerprint: payload.fingerprint,
skipLoginRedirect: true
});
r0 = true;
break L142;
}
if (LinkingTypes.VOICE_CHANNEL === type) {
addPostConnectionCallback(async () => {
let c30600_0;
L27: {
c30600_0 = void 0;
if (payload.guildId != null && payload.channelId != null && payload.userId != null) {
ModalActionCreators.popAll();
if ((await import("../../../stores/GuildStore")).default.getGuild(payload.guildId) != null) {
transitionToGuild(payload.guildId);
}
transitionToStream_native({
streamType: StreamTypes.GUILD,
ownerId: payload.userId,
guildId: payload.guildId,
channelId: payload.channelId
});
if (!(payload.action === "transfer_cancelled" && payload.via === "xbox")) {
break L27;
}
disconnectRemote();
break L27;
}
if (payload.action === "transfer_cancelled" && payload.via === "xbox") {
disconnectRemote();
}
return void 0;
}
});
r0 = true;
break L142;
}
if (LinkingTypes.ICYMI === type) {
addPostConnectionCallback(() => {
navigateToRootTab({
screen: "icymi"
});
});
r0 = true;
break L142;
}
if (LinkingTypes.GUILD_HOME === type) {
const r4 = payload.guildId != null;
r0 = true;
if (!r4) {
break L142;
}
const r215 = payload.highlightChannelId != null ? payload.highlightMessageId != null ? {
search: stringify({
highlight_channel_id: payload.highlightChannelId,
highlight_message_id: payload.highlightMessageId
})
} : void 0 : void 0;
transitionTo(Routes.CHANNEL(payload.guildId, StaticChannelRoute.GUILD_HOME), r215);
r0 = true;
break L142;
}
if (LinkingTypes.USER_CONNECTIONS_LINK_CALLBACK === type) {
addPostConnectionCallback(() => {
if (payload.callbackCode != null && payload.callbackState != null && payload.provider != null && [PlatformTypes.XBOX, PlatformTypes.PLAYSTATION, PlatformTypes.PLAYSTATION_STAGING, PlatformTypes.CRUNCHYROLL].includes(payload.provider)) {
Dispatcher.dispatch({
type: "USER_CONNECTIONS_LINK_CALLBACK",
provider: payload.provider,
callbackCode: payload.callbackCode,
callbackState: payload.callbackState
});
}
});
r0 = true;
break L142;
}
if (LinkingTypes.USER_CONNECTIONS_CALLBACK === type) {
addPostConnectionCallback(async () => {
let openid_params;
let c30601_0, c30601_1, c30601_2, c30601_3, c30601_6;
let c31672_0, c31672_1;
L27: {
c30601_6 = void 0;
c31672_0 = void 0;
c31672_1 = void 0;
const { provider, searchParams } = payload;
const { code, state, ...rest } = searchParams;
if (state != null) {
const r44 = {
code,
state
};
c30601_1 = rest;
const r47 = $forInKeys(rest);
const r48 = 0;
const length = r47.length;
if (r47 === void 0) {
c30601_3 = length;
c30601_2 = r48;
c30601_1 = rest;
c30601_0 = r47;
openid_params = void 0;
} else {
c30601_3 = length;
c30601_2 = r48;
c30601_1 = rest;
c30601_0 = r47;
let r23 = void 0;
while (true) {
const r18 = c30601_0;
const r19 = c30601_1;
let r20 = c30601_2;
const r21 = c30601_3;
openid_params = r23;
const r56 = r20 < r21 ? r18[r20++] : void 0;
if (r56 === void 0) {
c30601_3 = r21;
c30601_2 = r20;
c30601_1 = r19;
c30601_0 = r18;
break;
}
c30601_3 = r21;
c30601_2 = r20;
c30601_1 = r19;
c30601_0 = r18;
const r61 = r56.startsWith("openid.");
r23 = openid_params;
if (r61) {
const r62 = openid_params == null ? {} : openid_params;
r62[r56] = searchParams[r56];
r23 = r62;
}
}
}
if (openid_params != null) {
r44.openid_params = openid_params;
}
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.CONNECTIONS
});
c31672_0 = await ConnectedAccountsActionCreators.callback(provider, r44);
c31672_1 = URLUtils.toURLSafe(c31672_0.body?.redirect);
if (c31672_1 == null) {
break L27;
}
Linking.openURL(c31672_1.toString());
break L27;
}
return void 0;
}
});
r0 = true;
break L142;
}
if (LinkingTypes.CONNECTIONS === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.CONNECTIONS
});
});
r0 = true;
break L142;
}
if (LinkingTypes.GUILD_SETTINGS === type) {
addPostConnectionCallback(() => {
if (payload.guildId != null) {
GuildSettingsActionCreators.open(payload.guildId, payload.settingsSection, void 0, payload.settingsSubsection);
}
});
r0 = true;
break L142;
}
if (LinkingTypes.ACTIVATE_DEVICE === type) {
ActivateDeviceModalActionCreators.showModal(payload.userCode);
r0 = true;
break L142;
}
if (LinkingTypes.GUILD_SETTINGS_PICKER === type) {
addPostConnectionCallback(() => {
openGuildSettingsPickerModal({
section: payload.settingsSection,
subsection: payload.settingsSubsection,
feature: payload.feature
});
});
r0 = true;
break L142;
}
if (LinkingTypes.SHARE === type) {
const isIOS = _PlatformUtils.isIOS();
r0 = true;
if (!isIOS) {
break L142;
}
ModalActionCreators.popAll();
ModalActionCreators.pushLazy(import("../../share/native/ShareScreenModal"), {
text: payload.text,
channelId: payload.channelId,
shareId: payload.shareId,
attachmentManifest: payload.attachmentManifest
}, SHARE_SCREEN_MODAL_KEY, {
presentation: "modal"
});
r0 = true;
break L142;
}
if (LinkingTypes.CREATE_VOICE_INVITE !== type && LinkingTypes.SEND_VOICE_HANGOUT_WAVE !== type) {
if (LinkingTypes.ACCOUNT_STANDING === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.ACCOUNT,
params: {
initialTab: AccountSettingsTabs.STANDING
}
});
});
r0 = true;
break L142;
}
if (LinkingTypes.MOBILE_NATIVE_UPDATE === type) {
openBuildInstallerUrl(payload.url);
r0 = true;
break L142;
}
if (LinkingTypes.MOBILE_WEB_REDIRECT_CHECKOUT === type) {
deepLinkAction = payload.deepLinkAction;
addPostConnectionCallback(async () => {
let c30602_1;
let c31673_0, c31673_1;
L18: {
L17: {
c30602_1 = void 0;
c31673_0 = void 0;
c31673_1 = void 0;
if (deepLinkAction === MobileWebRedirectCheckoutDeepLinkActions.PREMIUM_CHECKOUT_SUCCESS) {
handleMobileWebCheckoutStatus("succeeded");
break L18;
}
if (deepLinkAction === MobileWebRedirectCheckoutDeepLinkActions.PREMIUM_SUBSCRIPTION_UPDATE) {
fetchSubscriptions();
break L18;
}
if (deepLinkAction !== MobileWebRedirectCheckoutDeepLinkActions.GUILD_BOOST_CHECKOUT_SUCCESS) {
break L18;
}
ModalActionCreators.popAll();
c31673_0 = payload.guildId;
c31673_1 = (await import("../../../stores/GuildStore")).default.getGuild(c31673_0);
if (c31673_1 == null) {
break L17;
}
transitionToGuild(c31673_0);
openGuildActionSheet(c31673_1);
}
return void 0;
}
});
r0 = true;
break L142;
}
if (LinkingTypes.SHOP === type) {
addPostConnectionCallback(() => {
openCollectiblesShopMobile({
analyticsLocations: [AnalyticsLocation.DEEPLINK],
analyticsSource: AnalyticsLocation.DEEPLINK,
screen: payload.screen,
initialProductSkuId: payload.skuId
});
});
r0 = true;
break L142;
}
if (LinkingTypes.AUTHORIZED_APPS === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.AUTHORIZED_APPS
});
});
r0 = true;
break L142;
}
if (LinkingTypes.DAVE_PROTOCOL_VERIFICATION === type) {
addPostConnectionCallback(() => {
SecureFramesPlatformUtils_native.handleSecureFramesUserVerificationLink({
userId: payload.userId,
fingerprint: payload.fingerprint.replaceAll(" ", "+")
});
});
r0 = true;
break L142;
}
if (LinkingTypes.QUESTS === type) {
addPostConnectionCallback(() => {
if (payload.questId != null) {
trackQuestEvent({
questId: payload.questId,
event: AnalyticEvents.QUEST_SHARE_LINK_DEEP_LINKED_INTO_MOBILE_CLIENT,
sourceQuestContent: QuestContent.QUEST_EMBED_MOBILE,
properties: {
referrer_id: payload.referrerId
}
});
}
const sort = payload?.sort;
const filter = payload?.filter;
openQuestHome({
scrollToQuestId: payload.questId,
sort: sort != null ? sort !== "" ? sort : null : null,
filter: filter != null ? filter !== "" ? filter : null : null,
fromContent: QuestContent.QUEST_SHARE_LINK
});
});
r0 = true;
break L142;
}
if (LinkingTypes.QUEST_HOME_PREVIEW === type) {
addPostConnectionCallback(() => {
openUserSettings({
screen: UserSettingsSections.QUESTS,
params: {
previewAdCreativeIds: payload.adCreativeIds
}
});
});
r0 = true;
break L142;
}
if (LinkingTypes.GIFT === type) {
addPostConnectionCallback(() => {
openGiftModal({
analyticsLocations: [AnalyticsLocation.DEEPLINK]
});
});
r0 = true;
break L142;
}
if (LinkingTypes.NITRO_HOME === type) {
addPostConnectionCallback(() => {
let section = payload.section;
if (section == null) {
section = void 0;
}
PremiumNitroNavigationStore.setState({
scrollToSectionId: section
});
openUserSettings({
screen: UserSettingsSections.PREMIUM
});
});
r0 = true;
break L142;
}
if (LinkingTypes.ACTIVITY === type) {
openActivityDMLauncher(payload.applicationId, payload.referrerId, payload.customId, payload.linkId, payload.isDeepLink);
r0 = true;
break L142;
}
if (LinkingTypes.CONNECTED_GAMES === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.CONTENT_AND_SOCIAL,
params: {
tab: MobileSetting.CONNECTED_GAMES
}
});
});
r0 = true;
break L142;
}
if (LinkingTypes.BOOST_MARKETING === type) {
addPostConnectionCallback(() => {
openApplyBoostModal(payload.guildId);
});
r0 = true;
break L142;
}
if (LinkingTypes.BOOST_SETTINGS === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.GUILD_BOOSTING
});
});
r0 = true;
break L142;
}
if (LinkingTypes.QUEST_PREVIEW_TOOL === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
closeVoicePanels();
setTimeout(() => {
openUserSettings({
screen: UserSettingsSections.QUEST_PREVIEW_TOOL_2,
params: {
questId: payload.questId
}
});
}, 1);
});
r0 = true;
break L142;
}
if (LinkingTypes.SUBSCRIPTION_SETTINGS === type) {
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
openUserSettings({
screen: UserSettingsSections.GUILD_ROLE_SUBSCRIPTIONS
});
});
r0 = true;
break L142;
}
if (LinkingTypes.GAME_PROFILE === type) {
gameId = payload.gameId;
addPostConnectionCallback(() => {
ModalActionCreators.popAll();
_GameProfileActionCreators_native.default.openGameProfileModal({
gameId,
source: GameProfileSources.Deeplink,
gameProfileModalChecks: {
shouldOpenGameProfile: true,
gameId
}
});
});
r0 = true;
break L142;
}
const MESSAGE_REQUESTS = LinkingTypes.MESSAGE_REQUESTS;
r0 = false;
if (MESSAGE_REQUESTS !== type) {
break L142;
}
ModalActionCreators.popAll();
rootNavigationRef3 = getRootNavigationRef();
const r3 = rootNavigationRef3 != null;
r0 = true;
if (!r3) {
break L142;
}
if (rootNavigationRef3.isReady()) {
rootNavigationRef3.navigate("message-requests");
r0 = true;
break L142;
}
addPostConnectionCallback(() => {
rootNavigationRef3.navigate("message-requests");
});
r0 = true;
break L142;
}
addPostConnectionCallback(() => {
showInstantInviteActionSheetForChannel(payload.channelId);
});
r0 = true;
break L142;
}
const { guildId, channelId, type: type2 } = payload;
const MESSAGE = LinkingTypes.MESSAGE;
let summaryId = void 0;
let messageId = void 0;
if (type2 === MESSAGE) {
messageId = payload.messageId;
summaryId = payload.summaryId;
}
const r355 = guildId != null && channelId != null;
r0 = true;
if (r355) {
handleContentLinking({
guildId,
channelId,
messageId,
navigationSettings: {
safe,
navigationReplace,
waitForConnection,
skipMessageFetch
},
summaryId
});
r0 = true;
}
}
}
if (r0) {
browserManagerCloseBrowser();
}
return r0;
};
+325
View File
@@ -0,0 +1,325 @@
// Metro module 3881 (f3882).
import ActionSheetStore from "../../action_sheet/native/ActionSheetStore";
import { WebBrowserType } from "../../../Constants";
import Logger from "../../debug/Logger";
import { LINKING_SCHEMAS_VALUES } from "./LinkingSchemas";
import { LINKING_WHITELIST_VALUES } from "./LinkingWhitelist";
import Module3888 from "../../../_bundle/Module3888";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { getBrowserManagerSelectedBrowser, browserManagerOpenUrl } from "./BrowserManager";
import { isIOS } from "../../../utils/PlatformUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import Url from "../../../_bundle/Url_1469";
import parseURL from "../../../utils/native/parseURL";
import handleSupportedURL from "./handleSupportedURL";
function $mk114414($env) {
return function tryHandleUniversalLink(a0) {
let env31324 = {
$parent: $env
};
env31324[0] = a0;
return new Promise((resolve) => {
const r2 = env31324.$parent;
let env31918 = {
$parent: r2
};
env31918[0] = resolve;
(0, r2[1])(r2[2][5]).tryOpenUrlAsUniversalLink(env31324[0]).then(() => {
env31918.$parent[7].info("Universal link opened successfully.");
(0, env31918[0])(true);
}).catch(() => {
env31918.$parent[7].info("URL is not a handled universal link.");
(0, env31918[0])(false);
});
});
};
}
function $mk114415($env) {
return function tryHandleCustomScheme(a0) {
let r63;
const r1 = $env;
let env31325 = {
$parent: $env
};
let r2 = a0;
env31325[0] = a0;
for (const item of LINKING_SCHEMAS_VALUES) {
const { regex, protocol } = item;
const r35 = regex.exec(r2);
const r37 = r35 == null ? void 0 : r35[1];
if (r37 != null) {
const r41 = protocol + r37;
r2 = r41;
env31325[0] = r41;
}
}
const r48 = r2.indexOf("://") !== -1 ? r2.split("://")[0] : null;
if (r48 !== "http" && r48 !== "https") {
c2204_7.info("tryHandleCustomScheme", r2);
r63 = new Promise((resolve) => {
const r2 = env31325.$parent;
let env31919 = {
$parent: r2
};
env31919[0] = resolve;
(0, r2[1])(r2[2][5]).tryOpenScheme(env31325[0]).then(() => {
env31919.$parent[7].info("Custom scheme opened successfully.");
(0, env31919[0])(true);
}).catch(() => {
env31919.$parent[7].info("Custom scheme failed to open.");
(0, env31919[0])(false);
});
});
} else {
r63 = new Promise($mk117842(r1));
}
return r63;
};
}
function $mk114416($env) {
return function tryHandleWhitelistedURL(a0) {
const r0 = $env;
let env31326 = {
$parent: $env
};
env31326[0] = a0;
const _loop = function _loop(c31920_0) {
return env31326[1].exec(env31326[0]) !== null ? {
v: new Promise((c32113_0) => {
env31326.$parent[4].canOpenURL(c31920_0).then((result) => {
const r3 = env31326.$parent;
if (result) {
(0, r3[1])(r3[2][7]).performURLNavigation(env31326[0]);
c32113_0(true);
} else {
r3[7].info("Whitelisted URL, but cannot be opened (app likely not installed).");
c32113_0(false);
}
}).catch((a0) => {
env31326.$parent[7].info("Whitelisted URL encountered an error.", {
error: a0
});
c32113_0(false);
});
})
} : 0;
};
for (const item of LINKING_WHITELIST_VALUES) {
env31326[1] = item.regex;
const r31 = _loop(item.protocol);
if (r31 === 0) {
continue;
}
if (!r31) {
continue;
}
return r31.v;
}
return new Promise($mk117845(r0));
};
}
function $mk117842($env) {
return (a0) => {
c2204_7.info("URL is not a custom scheme.");
a0(false);
};
}
function $mk117845($env) {
return (a0) => {
c2204_7.info("URL is not whitelisted.");
a0(false);
};
}
let c2204_7;
let env2204 = {};
const sanitizeURLPart = function sanitizeURLPart(a0) {
return a0 != null ? a0.replace(/[^\x00-\x7F]+/g, (a0) => encodeURIComponent(a0)) : a0;
};
c2204_7 = new Logger("handleURL");
export default async function handleURL(c24875_0, c24875_1, c24875_2) {
let forceExternalBrowser;
let c24875_3, c24875_4, c24875_5;
let c24875_6 = 0;
const r13 = env2204;
try {
let env29236;
c24875_4 = r13;
const r19 = env29236 = {
$parent: r13
};
c24875_3 = r19;
env29236[2] = void 0;
env29236[3] = void 0;
env29236[0] = c24875_0;
env29236[1] = c24875_1;
let r40 = c24875_2;
if (r40 === void 0) {
r40 = {};
}
L15: {
L12: {
const allowExternal = r40.allowExternal;
if (allowExternal !== void 0) {
env29236[2] = allowExternal;
forceExternalBrowser = r40.forceExternalBrowser;
if (forceExternalBrowser !== void 0) {
break L12;
}
} else {
env29236[2] = true;
forceExternalBrowser = r40.forceExternalBrowser;
if (forceExternalBrowser !== void 0) {
break L12;
}
}
env29236[3] = false;
env29236[5] = void 0;
env29236[6] = void 0;
env29236[7] = void 0;
env29236[8] = void 0;
env29236[9] = void 0;
env29236[4] = function openInBrowser() {
if (Module3888.sanitizeUrl(env29236[0]) != null) {
let SAFARI = WebBrowserType.SAFARI;
if (!(!env29236[0].startsWith("https:") && !env29236[0].startsWith("http:"))) {
let r40 = getBrowserManagerSelectedBrowser();
let r41 = env29236[1];
if (r41 == null) {
r41 = r40;
}
const r42 = env29236[3] && r41 === WebBrowserType.IN_APP;
SAFARI = r41;
if (r42) {
if (r40 === WebBrowserType.IN_APP) {
r40 = isIOS() ? WebBrowserType.SAFARI : WebBrowserType.CHROME;
}
SAFARI = r40;
}
}
if (WebBrowserType.IN_APP === SAFARI) {
browserManagerOpenUrl(env29236[0], WebBrowserType.IN_APP).catch(() => {
presentFailedToast(`${intl.string(t.HryVrx)} ${env29236[0]}`);
});
if (isIOS() && ActionSheetStore.isOpen()) {
ActionSheetActionCreators.hideAllActionSheets();
}
} else if (WebBrowserType.CHROME === SAFARI) {
browserManagerOpenUrl(env29236[0], WebBrowserType.CHROME).catch(() => {
presentFailedToast(`${intl.string(t.HryVrx)} ${env29236[0]}`);
});
} else {
WebBrowserType.SAFARI;
browserManagerOpenUrl(env29236[0], WebBrowserType.SAFARI);
}
} else {
presentFailedToast(intl.string(t.XiqzAp));
}
};
break L15;
}
env29236[3] = forceExternalBrowser;
env29236[5] = void 0;
env29236[6] = void 0;
env29236[7] = void 0;
env29236[8] = void 0;
env29236[9] = void 0;
env29236[4] = function openInBrowser() {
if (Module3888.sanitizeUrl(env29236[0]) != null) {
let SAFARI = WebBrowserType.SAFARI;
if (!(!env29236[0].startsWith("https:") && !env29236[0].startsWith("http:"))) {
let r40 = getBrowserManagerSelectedBrowser();
let r41 = env29236[1];
if (r41 == null) {
r41 = r40;
}
const r42 = env29236[3] && r41 === WebBrowserType.IN_APP;
SAFARI = r41;
if (r42) {
if (r40 === WebBrowserType.IN_APP) {
r40 = isIOS() ? WebBrowserType.SAFARI : WebBrowserType.CHROME;
}
SAFARI = r40;
}
}
if (WebBrowserType.IN_APP === SAFARI) {
browserManagerOpenUrl(env29236[0], WebBrowserType.IN_APP).catch(() => {
presentFailedToast(`${intl.string(t.HryVrx)} ${env29236[0]}`);
});
if (isIOS() && ActionSheetStore.isOpen()) {
ActionSheetActionCreators.hideAllActionSheets();
}
} else if (WebBrowserType.CHROME === SAFARI) {
browserManagerOpenUrl(env29236[0], WebBrowserType.CHROME).catch(() => {
presentFailedToast(`${intl.string(t.HryVrx)} ${env29236[0]}`);
});
} else {
WebBrowserType.SAFARI;
browserManagerOpenUrl(env29236[0], WebBrowserType.SAFARI);
}
} else {
presentFailedToast(intl.string(t.XiqzAp));
}
};
}
await void 0;
if (env29236[3]) {
(0, env29236[4])();
} else {
if (!/^[a-zA-Z0-9+-.]+:/.test(env29236[0])) {
env29236[0] = "https://" + env29236[0];
}
if (/^https?:/i.test(env29236[0])) {
c24875_6 = 1;
env29236[5] = Url.parse(env29236[0]);
const r103 = env29236[5];
r103.pathname = sanitizeURLPart(env29236[5].pathname);
env29236[5].search = sanitizeURLPart(env29236[5].search);
env29236[5].hash = sanitizeURLPart(env29236[5].hash);
env29236[0] = Url.format(env29236[5]);
c24875_6 = 0;
}
env29236[6] = parseURL(env29236[0]).payload;
if (!handleSupportedURL({
payload: env29236[6],
safe: true
})) {
if (env29236[2]) {
const r126 = env29236[0];
env29236[7] = await $mk114414(env2204)(r126);
if (!env29236[7]) {
const r151 = env29236[0];
env29236[8] = await $mk114415(env2204)(r151);
if (!env29236[8]) {
const r176 = env29236[0];
env29236[9] = await $mk114416(env2204)(r176);
if (!env29236[9]) {
(0, env29236[4])();
}
}
}
}
}
}
} catch ($e) {
const r36 = $e;
let r8 = r36;
c24875_5 = r36;
if (c24875_6 !== 0) {
while (true) {
try {
c24875_6 = 0;
} catch (r206) {
r8 = r206;
c24875_5 = r206;
if (c24875_6 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r8;
}
};
@@ -0,0 +1,78 @@
// Metro module 9546 (f9547).
import { triggerHapticFeedback, HapticFeedbackTypes } from "../../haptics/HapticUtils.native";
import { intl, t } from "../../../intl/index.native";
import { presentLinkCopied } from "../../toast/native/ToastUtils";
import { copy } from "../../../utils/ClipboardUtils.native";
import Linking from "../../../lib/native/Linking";
import { showShareActionSheet } from "../../action_sheet/native/showShareActionSheet";
import handleContentLinking from "./handleContentLinking";
import { showSimpleActionSheet } from "../../action_sheet/native/showSimpleActionSheet";
export default function showLongPressURLActionSheet({ urlString, guildId, channelId, messageId, disableHapticFeedback = false }) {
if (!disableHapticFeedback) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
}
const r29 = [];
const r32 = urlString.match(/^(tel|sms|mailto):([^?;]+)/);
let c17283_4 = r32;
if (r32 != null) {
r29.push({
label: intl.string(r32[1] === "mailto" ? t.ZYLVKo : t["3zozoR"]),
onPress: () => {
presentLinkCopied();
copy(c17283_4[2]);
}
});
if (r32[1] === "tel") {
r29.push({
label: intl.string(t["+wbjMW"]),
onPress: () => {
Linking.openURL(urlString.replace("tel:", "sms:"));
}
});
}
}
const options = [{
label: intl.string(t.wuRE8M),
onPress: () => {
Linking.openURL(urlString);
}
}, {
label: intl.string(t.WqhZss),
onPress: () => {
presentLinkCopied();
copy(urlString);
}
}, ...r29, {
label: intl.string(t.Ej3B3Y),
onPress: () => {
showShareActionSheet({
url: urlString
}, "Share Link");
}
}];
if (channelId != null) {
options.unshift({
label: intl.string(t.aW2YlJ),
onPress: () => {
handleContentLinking({
guildId,
channelId,
messageId,
navigationSettings: {
navigationReplace: true,
safe: true
}
});
}
});
}
showSimpleActionSheet({
key: "LongPressUrl",
header: {
title: intl.string(t["5oIOLX"]),
subtitle: urlString
},
options,
hasIcons: false
});
};