decord/source/modules/safety_flows/native/SafetyFlowsUtils.tsx

191 lines
6 KiB
TypeScript
Raw Normal View History

// Module ID: 17985
// Function ID: 17986
// Name: SafetyFlowsUtils
// Dependencies: [5, 19, 1371, 17979, 17981, 4839, 17980, 4335, 9696, 1114, 2690, 1483, 17984, 2]
2026-07-29 08:29:29 +00:00
// Exports: getScreensForTaskType, useOnTaskComplete
2026-07-20 16:05:17 +00:00
// Module 17985 (SafetyFlowsUtils)
import util from "util" /* 1114 */;
import _modDef2690 from "module_2690" /* 2690 */;
import ToastActionCreatorsDefault from "ToastActionCreators" /* 4335 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4839 */;
import _modDef9696 from "module_9696" /* 9696 */;
import types from "types" /* 17979 */;
import constants from "constants" /* 17980 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import noop from "module_19" /* 19 */;
import UserStore from "UserStore" /* 1371 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
require = fn;
2026-07-20 16:05:17 +00:00
function fetchAndUpdateTask() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = closure_7.apply;
2026-07-29 08:29:29 +00:00
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
let closure_7 = async function _fetchAndUpdateTask() {
closure_1 = tmp2;
closure_129_0 = closure_0;
closure_129_1 = await require("SafetyFlowsActionCreators").getCurrentTask();
if (null != closure_129_1) {
closure_129_0(closure_129_1);
2026-07-29 08:29:29 +00:00
}
return closure_129_1;
};
function navigateToScreenForTask(arr, task_type) {
if (null == task_type) {
ModalActionCreatorsDefault.popWithKey(constants.SAFETY_FLOWS_MODAL_KEY);
const obj3 = { key: "SAFETY_FLOWS_VERIFY_EMAIL_SUCCESS", icon: _modDef9696, content: null };
const intl = util.intl;
obj3.content = intl.string(_modDef2690["/fHz9S"]);
ToastActionCreatorsDefault.open(obj3);
2026-07-20 16:05:17 +00:00
} else {
task_type = task_type.task_type;
const tmp16 = types.TASK_TYPE_TO_SCREENS[task_type];
2026-07-29 08:29:29 +00:00
let tmp5 = null;
if (null != tmp16) {
let tmp = tmp16;
if (task_type === tmp14(17979).TaskType.EMAIL_VERIFICATION) {
const currentUser = UserStore.getCurrentUser();
2026-07-29 08:29:29 +00:00
let email;
if (currentUser != null) {
email = currentUser.email;
}
tmp = tmp16;
if (null != email) {
const items = [tmp14(17979).SafetyFlowScreens.VERIFY_EMAIL];
2026-07-29 08:29:29 +00:00
tmp = items;
}
}
tmp5 = tmp;
}
if (null != tmp5) {
arr.push(tmp5[0]);
2026-07-20 16:05:17 +00:00
} else {
arr.push(tmp14(17979).SafetyFlowScreens.UPDATE_APP);
2026-07-20 16:05:17 +00:00
}
}
}
const size = fn(2);
const result = size.fileFinishedImporting("modules/safety_flows/native/SafetyFlowsUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getScreensForTaskType = function getScreensForTaskType(task_type) {
const tmp3 = types.TASK_TYPE_TO_SCREENS[task_type];
2026-07-29 08:29:29 +00:00
let tmp4 = null;
if (null != tmp3) {
let tmp5 = tmp3;
if (task_type === tmp(17979).TaskType.EMAIL_VERIFICATION) {
const currentUser = UserStore.getCurrentUser();
2026-07-29 08:29:29 +00:00
let email;
if (currentUser != null) {
email = currentUser.email;
}
tmp5 = tmp3;
if (null != email) {
const items = [tmp(17979).SafetyFlowScreens.VERIFY_EMAIL];
2026-07-29 08:29:29 +00:00
tmp5 = items;
}
}
tmp4 = tmp5;
}
return tmp4;
};
2026-07-20 16:05:17 +00:00
export { fetchAndUpdateTask };
export { navigateToScreenForTask };
export const useOnTaskComplete = function useOnTaskComplete() {
const navigation = require("useNavigation").useNavigation();
2026-07-29 08:29:29 +00:00
_require = navigation;
let obj = require("useNavigation");
const safetyFlowTask = require("SafetyFlowsTaskContext").useSafetyFlowTask();
2026-07-20 16:05:17 +00:00
const task = safetyFlowTask.task;
2026-07-23 10:11:24 +00:00
setTask = safetyFlowTask.setTask;
_require = asyncGeneratorStep(async (data) => {
2026-08-24 06:08:38 +00:00
c3 = 0;
c4 = 0;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +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 value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_2 = tmp2;
closure_1 = tmp5;
closure_129_0 = undefined;
const obj4 = { task_id: closure_1.task_id, flow_id: closure_1.flow_context.flow_id, data };
2026-07-29 08:29:29 +00:00
c3 = 1;
c4 = 1;
const obj5 = { value: data(setTask[4]).completeTask(obj4), done: false };
return obj5;
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp5) {
if (arg0 === 1) {
c4 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c4 = 3;
const obj6 = { value, done: true };
return obj6;
2026-07-29 08:29:29 +00:00
} else {
c3 = 2;
c4 = 1;
const obj8 = { value: fetchAndUpdateTask(closure_2), done: false };
return obj8;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c4 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
closure_129_0 = value;
navigateToScreenForTask(data, closure_129_0);
2026-07-29 08:29:29 +00:00
c4 = 3;
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp15) {
c4 = tmp;
throw tmp15;
}
}
})();
});
2026-07-20 16:05:17 +00:00
const items = [navigation, task, setTask];
return noop.useCallback(function() {
2026-07-29 08:29:29 +00:00
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);
2026-07-20 16:05:17 +00:00
};