// Module ID: 17215 // Function ID: 17216 // Name: fetchAndUpdateTask // Dependencies: [5, 19, 1922, 17209, 17211, 4611, 17210, 4098, 10028, 1236, 2599, 1500, 17214, 2] // Exports: getScreensForTaskType, useOnTaskComplete // Module 17215 (fetchAndUpdateTask) import getSystemLocale from "getSystemLocale" /* 1236 */; import messagesProxyDefault from "messagesProxy" /* 2599 */; import dispatcherDefault from "dispatcher" /* 4098 */; import _modDef4611 from "module_4611" /* 4611 */; import registerAssetDefault from "registerAsset" /* 10028 */; import TaskType from "TaskType" /* 17209 */; import SAFETY_FLOWS_MODAL_KEY from "SAFETY_FLOWS_MODAL_KEY" /* 17210 */; import closure_3 from "asyncGeneratorStep" /* 5 */; import closure_4 from "noop" /* 19 */; import closure_5 from "mergeGuildAvatar" /* 1922 */; require = arg1; function fetchAndUpdateTask() { const self = this; const apply = _fetchAndUpdateTask.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } function _fetchAndUpdateTask() { const self = this; const tmp = callback((arg0) => { closure_0 = arg0; c2 = 0; c3 = 0; return (function*(arg0) { closure_1 = tmp2; const obj2 = callback(table[4]); closure_1 = yield obj2.getCurrentTask(); if (null != closure_1) { callback(closure_1); } return closure_1; })(); }); closure_7 = tmp; const apply = tmp.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } function navigateToScreenForTask(closure_1, closure_0) { if (null == closure_0) { let obj = _modDef4611; obj.popWithKey(SAFETY_FLOWS_MODAL_KEY.SAFETY_FLOWS_MODAL_KEY); obj = { key: "SAFETY_FLOWS_VERIFY_EMAIL_SUCCESS", icon: null, content: null }; obj[1] = registerAssetDefault; const intl = getSystemLocale.intl; obj[2] = intl.string(messagesProxyDefault["/fHz9S"]); dispatcherDefault.open(obj); } else { const task_type = closure_0.task_type; const tmp16 = TaskType.TASK_TYPE_TO_SCREENS[task_type]; let tmp5 = null; if (null != tmp16) { let tmp = tmp16; if (task_type === tmp14(17209).TaskType.EMAIL_VERIFICATION) { const currentUser = authStore.getCurrentUser(); let email; if (currentUser != null) { email = currentUser.email; } tmp = tmp16; if (null != email) { const items = [tmp14(17209).SafetyFlowScreens.VERIFY_EMAIL]; tmp = items; } } tmp5 = tmp; } if (null != tmp5) { closure_1.push(tmp5[0]); } else { closure_1.push(tmp14(17209).SafetyFlowScreens.UPDATE_APP); } } } const result = require("set").fileFinishedImporting("modules/safety_flows/native/SafetyFlowsUtils.tsx"); export const getScreensForTaskType = function getScreensForTaskType(task_type) { const tmp3 = TaskType.TASK_TYPE_TO_SCREENS[task_type]; let tmp4 = null; if (null != tmp3) { let tmp5 = tmp3; if (task_type === tmp(17209).TaskType.EMAIL_VERIFICATION) { const currentUser = authStore.getCurrentUser(); let email; if (currentUser != null) { email = currentUser.email; } tmp5 = tmp3; if (null != email) { const items = [tmp(17209).SafetyFlowScreens.VERIFY_EMAIL]; tmp5 = items; } } tmp4 = tmp5; } return tmp4; }; export { fetchAndUpdateTask }; export { navigateToScreenForTask }; export const useOnTaskComplete = function useOnTaskComplete() { const navigation = _require(setTask[11]).useNavigation(); _require = navigation; let obj = _require(setTask[11]); const safetyFlowTask = _require(setTask[12]).useSafetyFlowTask(); const task = safetyFlowTask.task; setTask = safetyFlowTask.setTask; _require = undefined; _require = callback((arg0) => { closure_0 = arg0; c3 = 0; c4 = 0; return (function*(arg0) { if (c4 === 2) { c4 = 3; HermesBuiltin.throwTypeError(); } else if (tmp4 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: "HermesInternal" }; } } 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 { closure_2 = tmp2; closure_1 = tmp5; let callback; obj1 = { task_id: null, flow_id: null, data: null }; obj1[0] = closure_1_1.task_id; obj1[1] = closure_1_1.flow_context.flow_id; obj1[2] = callback; c3 = 1; c4 = 1; const obj2 = { value: null, done: false }; obj2[0] = callback(setTask[4]).completeTask(obj1); return obj2; } } else if (1 === tmp5) { if (arg0 === 1) { c4 = 3; throw arg1; } else if (arg0 === 2) { c4 = 3; const obj3 = { value: null, done: true }; obj3[0] = arg1; return obj3; } else { c3 = 2; c4 = 1; const obj4 = { value: null, done: false }; obj4[0] = closure_2_6(closure_1_2); return obj4; } } else if (arg0 === 1) { c4 = 3; throw arg1; } else if (arg0 === 2) { c4 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { callback = arg1; closure_2_8(callback, callback); c4 = 3; return { value: "HermesInternal", done: "HermesInternal" }; } } catch (tmp15) { c4 = tmp; throw tmp15; } } })(); }); const items = [navigation, task, setTask]; return React.useCallback(function() { const self = this; const apply = closure_0.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }, items); };