decord/source/modules/quests/native/QuestUtils.native.tsx

485 lines
17 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 11165
// Function ID: 11166
2026-07-29 08:29:29 +00:00
// Name: openRewardClaimBottomSheet
2026-08-08 06:10:11 +00:00
// Dependencies: [5, 19, 11166, 5161, 676, 21, 4271, 11167, 1988, 11169, 10476, 11176, 11182, 7166, 10461, 5164, 4002, 1236, 8445, 8451, 10460, 7181, 10596, 4159, 6016, 500, 3998, 712, 11183, 8762, 4644, 4647, 1481, 2]
2026-07-20 16:05:17 +00:00
// Exports: dismissOverlayScreens, getPrimaryCtaIcon, handleRewardClaimThenView, isHeroVideoSupported, openDiscordQuestsFAQ, openQuestHome, openRewardDetailsBottomSheet, showQuestUnavailableAlert
2026-08-08 06:10:11 +00:00
// Module 11165 (openRewardClaimBottomSheet)
2026-07-23 10:11:24 +00:00
import closure_3 from "jsxProd";
2026-08-08 06:10:11 +00:00
import "module_8451";
2026-07-23 10:11:24 +00:00
import zustandStore from "zustandStore";
import QuestsExperimentLocations from "QuestsExperimentLocations";
import { UserSettingsSections } from "ME";
2026-07-29 08:29:29 +00:00
import jsxProd from "isSponsoredPlayQuest";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c10;
let c5;
2026-07-23 10:11:24 +00:00
let closure_12;
let closure_6;
2026-07-29 08:29:29 +00:00
let error;
let metroImportAll;
let unpackModuleId;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function openRewardClaimBottomSheet(arg0) {
let questContent;
let questContentPosition;
let questId;
let sourceQuestContent;
({ questId, questContent, questContentPosition, sourceQuestContent } = arg0);
2026-08-08 06:10:11 +00:00
return importDefault(4271).openLazy(require(1988) /* asyncRequireImpl */(11169, dependencyMap.paths), closure_6, { questId, questContent, questContentPosition, sourceQuestContent });
2026-07-20 16:05:17 +00:00
}
function viewReward(quest) {
let onSuccess;
let product;
let questContent;
let questContentPosition;
let sourceQuestContent;
quest = quest.quest;
({ product, questContent, questContentPosition, onSuccess, sourceQuestContent } = quest);
2026-08-08 06:10:11 +00:00
let obj = require(10476) /* _getDefaultRewardName */;
2026-07-20 16:05:17 +00:00
if (obj.hasQuestRewardCode(quest.config)) {
2026-07-29 08:29:29 +00:00
obj = { questId: null, questContent: null, questContentPosition: null, sourceQuestContent: null };
obj[0] = quest.id;
obj[1] = questContent;
obj[2] = questContentPosition;
obj[3] = sourceQuestContent;
2026-08-08 06:10:11 +00:00
importDefault(4271).openLazy(tmp(1988)(11169, dependencyMap.paths), closure_6, obj);
const obj7 = importDefault(4271);
2026-07-20 16:05:17 +00:00
} else {
2026-08-08 06:10:11 +00:00
let tmpResult = tmp(10476);
2026-07-29 08:29:29 +00:00
if (tmpResult.hasVirtualCurrencyReward(quest.config)) {
2026-08-08 06:10:11 +00:00
tmpResult = tmp(11176);
2026-07-29 08:29:29 +00:00
obj = { quest: null };
obj[0] = quest;
const result = tmpResult.openQuestOrbsRewardModal(obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj1 = { quest: null, product: null, onSuccess: null };
obj1[0] = quest;
obj1[1] = product;
obj1[2] = onSuccess;
2026-08-08 06:10:11 +00:00
const result1 = tmp(11182).openQuestCollectibleRewardModal(obj1);
const tmpResult1 = tmp(11182);
2026-07-20 16:05:17 +00:00
}
}
}
function _handleRewardClaim() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c5 = 0;
let c6 = 0;
let c4 = 0;
return (function*(arg0) {
if (c6 === 2) {
c6 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-08 06:10:11 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c6 = 2;
if (0 === constants) {
if (arg0 === 1) {
c6 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
const dependencyMap = tmp3;
let callback = tmp5;
let logger;
let obj1 = { location: null };
obj1[0] = constants.QUEST_HOME_MOBILE;
logger = logger(outer1_2[13]).getQuestLogger(obj1);
const obj7 = logger(outer1_2[13]);
let c4 = 1;
const defaultPlatform = logger(outer1_2[10]).getDefaultPlatform(logger.config);
const obj9 = logger(outer1_2[10]);
constants = 2;
c6 = 1;
const obj2 = { value: null, done: false };
obj2[0] = logger(outer1_2[14]).claimQuestReward(logger.id, defaultPlatform, logger(outer1_2[15]).QuestContent.QUEST_HOME_MOBILE);
return obj2;
}
} else if (1 === tmp8) {
c4 = 0;
callback = closure_3;
logger.error("Error claiming reward", callback);
2026-08-07 06:50:47 +00:00
obj1 = callback(4002);
2026-07-29 08:29:29 +00:00
const obj3 = { key: "CLAIM_QUEST_REWARD_ERROR", content: null, icon: null };
const intl = logger(1236).intl;
obj3[1] = intl.string(logger(1236).t.CKsXk3);
2026-08-08 06:10:11 +00:00
obj3[2] = callback(8445);
2026-07-29 08:29:29 +00:00
obj1.open(obj3);
c6 = 3;
return { value: false, done: true };
} else if (arg0 === 1) {
c6 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 0;
c6 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c4 = 0;
c6 = 3;
return { value: true, done: true };
}
} catch (tmp24) {
closure_3 = tmp24;
if (tmp4 === c4) {
c6 = tmp2;
throw tmp24;
} else {
constants = tmp;
}
}
}
})();
});
const _handleRewardClaim = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _handleRewardClaimThenView() {
2026-07-29 08:29:29 +00:00
let self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c3 = 0;
let c4 = 0;
const iter = (function*(arg0) {
let c0;
let c1;
let c2;
let c3;
let c4;
let c5;
let c6;
let c7;
let c8;
if (c4 === 2) {
c4 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-08 06:10:11 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let dependencyMap = tmp4;
let callback = 0;
let lib;
callback = undefined;
dependencyMap = undefined;
c3 = undefined;
c4 = undefined;
c5 = undefined;
c6 = undefined;
c7 = undefined;
c8 = undefined;
({ quest: c0, questContent: c1, questContentPosition: c2, product: c3, hideActionSheet: c4, currentUserHasVerifiedEmailOrPhone: c5, currentUserHasVerifiedEmail: c6, onSuccess: c7, sourceQuestContent: c8 } = lib);
let closure_9;
c3 = 1;
c4 = 1;
2026-08-08 06:10:11 +00:00
return { value: "ct", done: "Array" };
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp4) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
const obj1 = { value: null, done: true };
obj1[0] = arg1;
return obj1;
} else {
if (true === c4) {
2026-08-08 06:10:11 +00:00
let obj3 = callback(4271);
2026-07-29 08:29:29 +00:00
obj3.hideActionSheet();
}
if (c5) {
if (!c6) {
2026-08-08 06:10:11 +00:00
let obj4 = lib(10476);
2026-07-29 08:29:29 +00:00
}
if (obj9.hasQuestRewardCode(lib.config)) {
const obj2 = { questId: null, questContent: null, questContentPosition: null, sourceQuestContent: null };
obj2[0] = lib.id;
obj2[1] = callback;
obj2[2] = dependencyMap;
obj2[3] = c8;
callback2(obj2);
c4 = 3;
return { value: true, done: true };
} else {
c3 = 2;
c4 = 1;
obj3 = { value: null, done: false };
obj3[0] = (function handleRewardClaim(c0) {
const self = this;
const apply = closure_15.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(lib);
return obj3;
}
2026-08-08 06:10:11 +00:00
obj9 = lib(10476);
2026-07-29 08:29:29 +00:00
}
if (!c6) {
2026-08-08 06:10:11 +00:00
let obj5 = callback(8451);
2026-07-29 08:29:29 +00:00
obj5.open();
}
2026-08-07 06:50:47 +00:00
let obj6 = callback(4002);
2026-07-29 08:29:29 +00:00
obj4 = { key: "CLAIM_QUEST_REWARD_ERROR", content: null, icon: null };
const intl = lib(1236).intl;
obj4[1] = intl.string(lib(1236).t["HZlu0+"]);
2026-08-08 06:10:11 +00:00
obj4[2] = callback(8445);
2026-07-29 08:29:29 +00:00
obj6.open(obj4);
c4 = 3;
return { value: false, done: true };
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj5 = { value: null, done: true };
obj5[0] = arg1;
return obj5;
} else {
closure_9 = arg1;
if (closure_9) {
obj = { quest: null, product: null, questContent: null, questContentPosition: null, onSuccess: null, sourceQuestContent: null };
obj[0] = lib;
obj[1] = c3;
obj[2] = callback;
obj[3] = dependencyMap;
obj[4] = c7;
obj[5] = c8;
callback3(obj);
}
c4 = 3;
obj6 = { value: null, done: true };
obj6[0] = closure_9;
return obj6;
}
} catch (tmp58) {
c4 = tmp;
throw tmp58;
}
}
})();
iter.next();
return iter;
});
const _handleRewardClaimThenView = tmp;
let apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
({ QuestsExperimentLocations: c5, QUEST_REWARD_CODE_CLAIM_BOTTOM_SHEET_KEY: closure_6, QUEST_REWARD_DETAILS_BOTTOM_SHEET_KEY: error, QuestVariants: metroImportAll } = QuestsExperimentLocations);
({ jsx: c10, Fragment: unpackModuleId, jsxs: closure_12 } = jsxProd);
2026-07-23 10:11:24 +00:00
let result = require("zustandStore").fileFinishedImporting("modules/quests/native/QuestUtils.native.tsx");
2026-07-20 16:05:17 +00:00
export const openRewardDetailsBottomSheet = function openRewardDetailsBottomSheet(questId) {
2026-08-08 06:10:11 +00:00
return importDefault(4271).openLazy(require(1988) /* asyncRequireImpl */(11167, dependencyMap.paths), closure_7, { questId: questId.questId });
2026-07-20 16:05:17 +00:00
};
export { viewReward };
export const handleRewardClaimThenView = function handleRewardClaimThenView(arg0) {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _handleRewardClaimThenView.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
export const openQuestHome = function openQuestHome(scrollToQuestId) {
scrollToQuestId = scrollToQuestId.scrollToQuestId;
let flag = scrollToQuestId.mergeExistingRoutes;
if (flag === undefined) {
flag = false;
}
let sort = scrollToQuestId.sort;
if (sort === undefined) {
sort = null;
}
let filter = scrollToQuestId.filter;
if (filter === undefined) {
filter = null;
}
2026-07-23 10:11:24 +00:00
let obj = scrollToQuestId(sort[20]);
2026-07-20 16:05:17 +00:00
if (obj.getIsEligibleForQuests()) {
2026-07-29 08:29:29 +00:00
obj = { questId: null, fromContent: null };
obj[0] = scrollToQuestId;
obj[1] = scrollToQuestId.fromContent;
const result = scrollToQuestId(tmp4[21]).setQuestHomeUtmContext(obj);
flag(tmp4[22])();
2026-07-20 16:05:17 +00:00
const _setTimeout = setTimeout;
const timerId = setTimeout(() => {
let obj = scrollToQuestId(sort[23]);
const rootNavigationRef = obj.getRootNavigationRef();
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
2026-07-29 08:29:29 +00:00
obj = { sort: null, filter: null, scrollToQuestId: null };
obj[0] = sort;
obj[1] = filter;
2026-08-06 08:05:19 +00:00
let str = scrollToQuestId;
if (scrollToQuestId == null) {
2026-07-29 08:29:29 +00:00
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = str;
2026-07-23 10:11:24 +00:00
outer1_4.setState(obj);
2026-07-29 08:29:29 +00:00
obj = { screen: null };
obj[0] = outer1_9.QUESTS;
2026-08-06 08:05:19 +00:00
if (flag) {
const obj1 = {};
const merged = Object.assign(obj);
obj1.pop = true;
rootNavigationRef.navigate("settings", obj1);
} else {
scrollToQuestId(sort[24]).openUserSettings(obj);
const tmpResult = scrollToQuestId(sort[24]);
2026-07-20 16:05:17 +00:00
}
}
}
}, 1);
2026-07-29 08:29:29 +00:00
const tmp3Result = scrollToQuestId(tmp4[21]);
2026-07-20 16:05:17 +00:00
}
};
export const isHeroVideoSupported = function isHeroVideoSupported(memo) {
if (obj.isIOS()) {
let tmp2 = tmp;
} else {
tmp2 = tmp;
if (!tmp) {
tmp2 = "video/webm" === memo.mimetype;
}
}
return tmp2;
};
export const openDiscordQuestsFAQ = function openDiscordQuestsFAQ() {
2026-08-07 06:50:47 +00:00
importDefault(3998).openURL("https://support.discord.com/hc/en-us/articles/22225719947543-Discord-Quests-FAQ#h_01HVPBZR5FBM7QBFR9KDBASXP5");
2026-07-20 16:05:17 +00:00
};
export const getPrimaryCtaIcon = function getPrimaryCtaIcon(quest, arg1) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
2026-08-08 06:10:11 +00:00
let obj = require(7181) /* isSponsoredPlayQuest */;
2026-07-20 16:05:17 +00:00
if (obj.canLaunchActivity(quest)) {
const features = quest.config.features;
if (features.includes(constants.MOBILE_ACTIVITY_QUEST)) {
let num = 0;
if (flag) {
2026-07-29 08:29:29 +00:00
num = importDefault(712).space.PX_4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { marginRight: null };
obj[0] = num;
2026-07-20 16:05:17 +00:00
const features2 = quest.config.features;
2026-07-29 08:29:29 +00:00
if (features2.includes(tmp3.CLOUD_GAMING_ACTIVITY)) {
obj = { size: "sm", style: null, color: null };
obj[1] = obj;
obj[2] = importDefault(712).colors.WHITE;
2026-08-08 06:10:11 +00:00
let tmp5Result = tmp5(tmp(11183).CloudIcon, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj1 = { size: "sm", style: null, color: null };
obj1[1] = obj;
obj1[2] = importDefault(712).colors.WHITE;
2026-08-08 06:10:11 +00:00
tmp5Result = tmp5(tmp(8762).GameControllerIcon, obj1);
2026-07-20 16:05:17 +00:00
}
return tmp5Result;
}
2026-07-29 08:29:29 +00:00
tmp3 = constants;
2026-07-20 16:05:17 +00:00
}
};
export const showQuestUnavailableAlert = function showQuestUnavailableAlert() {
2026-08-08 06:10:11 +00:00
let obj = require(4644) /* useAlertStore */;
2026-07-29 08:29:29 +00:00
obj = { title: null, content: null, actions: null };
const intl = require(1236) /* getSystemLocale */.intl;
obj[0] = intl.string(require(1236) /* getSystemLocale */.t.Lhpq2P);
const intl2 = require(1236) /* getSystemLocale */.intl;
obj[1] = intl2.string(require(1236) /* getSystemLocale */.t.iyF4WB);
obj = { children: null };
const obj1 = { text: null, onPress: null };
const intl3 = require(1236) /* getSystemLocale */.intl;
obj1[0] = intl3.string(require(1236) /* getSystemLocale */.t.H0vjGc);
2026-08-08 06:10:11 +00:00
obj1[1] = require(10461) /* _manuallyStartConsoleQuest */.fetchCurrentQuests;
const items = [callback2(require(4647) /* getAlertModalItemKey */.AlertActionButton, obj1), ];
2026-07-29 08:29:29 +00:00
const obj2 = { text: null, variant: "secondary" };
const intl4 = require(1236) /* getSystemLocale */.intl;
obj2[0] = intl4.string(require(1236) /* getSystemLocale */.t["6XS10x"]);
2026-08-08 06:10:11 +00:00
items[1] = callback2(require(4647) /* getAlertModalItemKey */.AlertActionButton, obj2);
2026-07-29 08:29:29 +00:00
obj[0] = items;
obj[2] = callback3(closure_11, obj);
2026-08-08 06:10:11 +00:00
obj.openAlert("quest-unavailable", callback2(require(4647) /* getAlertModalItemKey */.AlertModal, obj));
2026-07-20 16:05:17 +00:00
};
export const dismissOverlayScreens = function dismissOverlayScreens() {
2026-08-08 06:10:11 +00:00
let obj = require(4159) /* getRootNavigationRef */;
2026-07-20 16:05:17 +00:00
const rootNavigationRef = obj.getRootNavigationRef();
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
const rootState = rootNavigationRef.getRootState();
const routes = rootState.routes;
const found = routes.filter((name) => {
let tmp = "you" !== name.name;
if (tmp) {
tmp = "settings" !== name.name;
}
return tmp;
});
if (found.length < rootState.routes.length) {
2026-08-06 08:05:19 +00:00
const CommonActions = require(1481) /* createStandardNavigationFactories */.CommonActions;
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(rootState);
2026-07-29 08:29:29 +00:00
obj.routes = found;
obj.index = found.length - 1;
2026-07-20 16:05:17 +00:00
rootNavigationRef.dispatch(CommonActions.reset(obj));
}
}
}
};