// Metro module 12764 (f12765). import ConsentStore from "../../../stores/ConsentStore"; import { AnalyticEvents, Consents } from "../../../Constants"; import { GameCommunityUpsellMultiExperiment } from "../../game_community_upsell/native/GameCommunityUpsellExperiment"; import { DetectableAppNames } from "../LocalAppDetectionTypes"; import * as _Module501 from "../../../_bundle/Module501"; import { canOpenUrlScheme } from "../../instant_invite/native/DCDSendUtils"; import AnalyticsUtils from "../../../utils/AnalyticsUtils"; import Dispatcher from "../../../Dispatcher"; let getDetectableApp; const isGameCommunityUpsellMultiExperimentEnabled = function isGameCommunityUpsellMultiExperimentEnabled() { return GameCommunityUpsellMultiExperiment.getConfig({ location: "LocalAppDetectionUtils" }).enabled; }; getDetectableApp = function getDetectableApp(a0) { if (DetectableAppNames.ROBLOX === a0) { return { androidScheme: "roblox", iosScheme: "roblox" }; } if (DetectableAppNames.MINECRAFT === a0) { return { androidScheme: "minecraft", iosScheme: "minecraft", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.FORTNITE === a0) { return { androidScheme: "fortnite", iosScheme: "com.epicgames.fortnite", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.GENSHIN === a0) { return { androidScheme: "genshin", iosScheme: "genshin", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.PUBG_MOBILE === a0) { return { androidScheme: "pubgmobile", iosScheme: "igame1320", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.CALL_OF_DUTY_MOBILE === a0) { return { androidScheme: "codm", iosScheme: "codm", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.CLASH_OF_CLANS === a0) { return { androidScheme: "clashofclans", iosScheme: "clashofclans", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.MOBILE_LEGENDS_BANG_BANG === a0) { return { androidScheme: "mobilelegends", iosScheme: "mobilelegends", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.GARENA_FREE_FIRE === a0) { return { androidScheme: "garenafreefire", iosScheme: "freefire", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.POKEMON_GO === a0) { return { androidScheme: "pokemongo", iosScheme: "pokemongo", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.POKEMON_TCG_POCKET === a0) { return { androidScheme: "pokemontcgp", iosScheme: "pokemontcgp", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.CLASH_ROYALE === a0) { return { androidScheme: "clashroyale", iosScheme: "clashroyale", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.AMONG_US === a0) { return { androidScheme: "amongus", iosScheme: "amongus", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.MONOPOLY_GO === a0) { return { androidScheme: "monopolygo", iosScheme: "monopolygo", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.BRAWL_STARS === a0) { return { androidScheme: "brawlstars", iosScheme: "brawlstars", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.BRAWLHALLA === a0) { return { androidScheme: "brawlhalla", iosScheme: null, predicate: isGameCommunityUpsellMultiExperimentEnabled }; } if (DetectableAppNames.WUTHERING_WAVES === a0) { return { androidScheme: "wutheringwaves", iosScheme: "akioversea", predicate: isGameCommunityUpsellMultiExperimentEnabled }; } }; export async function detectLocalApps(c27367_0) { let r32; let c27367_1, c27367_2, c27367_5; let c27367_6 = 0; let c30583_1, c30583_2, c30583_3, c30583_4, c30583_0; L36: { L34: { try { c30583_1 = void 0; c30583_2 = void 0; c30583_3 = void 0; c30583_4 = void 0; c30583_0 = {}; if (ConsentStore.hasConsented(Consents.PERSONALIZATION)) { c27367_2 = c27367_0; const r59 = c27367_0[Symbol.iterator](); c27367_2 = r59.next; c27367_1 = r59; while (true) { const r61 = c27367_2; let r62 = c27367_1; const r63 = r62 === void 0 ? void 0 : (r32 = r61.call(r62)).done ? r62 = void 0 : r32.value; c27367_1 = r62; if (r62 === void 0) { break; } c27367_6 = 1; c30583_1 = r63; c30583_2 = (0, getDetectableApp)(c30583_1); const isIOS = _Module501.isIOS(); const r76 = c30583_2; c30583_3 = isIOS ? r76.iosScheme : r76.androidScheme; if (c30583_3 != null) { const r84 = c30583_2; const predicate = r84.predicate; if ((predicate == null ? void 0 : predicate.call(r84)) !== false) { let r102 = await canOpenUrlScheme(c30583_3); loop20: while (true) { c30583_4 = r102; c30583_0[c30583_1] = c30583_4; AnalyticsUtils.track(AnalyticEvents.CAN_OPEN_URL_REQUESTED, { scheme: c30583_3, result: c30583_4 }); while (true) { c27367_6 = 0; const r128 = c27367_2; let r129 = c27367_1; const r130 = r129 === void 0 ? void 0 : (r32 = r128.call(r129)).done ? r129 = void 0 : r32.value; c27367_1 = r129; if (r129 === void 0) { Dispatcher.dispatch({ type: "LOCAL_APP_DETECTION_COMPLETE", result: c30583_0 }); break L34; } c27367_6 = 1; c30583_1 = r130; c30583_2 = (0, getDetectableApp)(c30583_1); const isIOS2 = _Module501.isIOS(); const r154 = c30583_2; c30583_3 = isIOS2 ? r154.iosScheme : r154.androidScheme; if (c30583_3 != null) { const r162 = c30583_2; const predicate2 = r162.predicate; if ((predicate2 == null ? void 0 : predicate2.call(r162)) !== false) { r102 = await canOpenUrlScheme(c30583_3); continue loop20; } } c30583_0[c30583_1] = false; } } } } c30583_0[c30583_1] = false; c27367_6 = 0; } } Dispatcher.dispatch({ type: "LOCAL_APP_DETECTION_COMPLETE", result: c30583_0 }); break L36; } catch ($e) { const r40 = $e; let r8 = r40; c27367_5 = r40; if (c27367_6 !== 0) { while (true) { try { const r196 = c27367_5; c27367_6 = 0; const r198 = c27367_1; if (r198 !== void 0 && typeof r198.return === "function") { try { r198.return(); } catch {} } throw r196; } catch (r194) { r8 = r194; c27367_5 = r194; if (c27367_6 === 0) { break; } } } } throw r8; } } return void 0; } }