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

217 lines
6.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 17183
// Function ID: 17184
2026-07-29 08:29:29 +00:00
// Name: fetchAndUpdateTask
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 19, 1922, 17177, 17179, 5265, 17178, 4097, 8801, 1236, 2598, 1500, 17182, 2]
2026-07-29 08:29:29 +00:00
// Exports: getScreensForTaskType, useOnTaskComplete
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 17183 (fetchAndUpdateTask)
import getSystemLocale from "getSystemLocale" /* 1236 */;
import messagesProxyDefault from "messagesProxy" /* 2598 */;
import dispatcherDefault from "dispatcher" /* 4097 */;
import _modDef5265 from "module_5265" /* 5265 */;
import registerAssetDefault from "registerAsset" /* 8801 */;
import TaskType from "TaskType" /* 17177 */;
import SAFETY_FLOWS_MODAL_KEY from "SAFETY_FLOWS_MODAL_KEY" /* 17178 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "noop" /* 19 */;
import closure_5 from "mergeGuildAvatar" /* 1922 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function fetchAndUpdateTask() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _fetchAndUpdateTask.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 _fetchAndUpdateTask() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c3 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
2026-08-24 06:08:38 +00:00
closure_1 = tmp2;
2026-08-04 21:03:28 +00:00
const obj2 = callback(table[4]);
closure_1 = yield obj2.getCurrentTask();
if (null != closure_1) {
callback(closure_1);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
return closure_1;
2026-07-29 08:29:29 +00:00
})();
});
2026-08-24 06:08:38 +00:00
closure_7 = tmp;
2026-07-29 08:29:29 +00:00
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
}
2026-07-29 08:29:29 +00:00
function navigateToScreenForTask(closure_1, closure_0) {
if (null == closure_0) {
2026-08-24 06:08:38 +00:00
let obj = _modDef5265;
obj.popWithKey(SAFETY_FLOWS_MODAL_KEY.SAFETY_FLOWS_MODAL_KEY);
2026-07-29 08:29:29 +00:00
obj = { key: "SAFETY_FLOWS_VERIFY_EMAIL_SUCCESS", icon: null, content: null };
2026-08-24 06:08:38 +00:00
obj[1] = registerAssetDefault;
const intl = getSystemLocale.intl;
obj[2] = intl.string(messagesProxyDefault["/fHz9S"]);
dispatcherDefault.open(obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const task_type = closure_0.task_type;
2026-08-24 06:08:38 +00:00
const tmp16 = TaskType.TASK_TYPE_TO_SCREENS[task_type];
2026-07-29 08:29:29 +00:00
let tmp5 = null;
if (null != tmp16) {
let tmp = tmp16;
2026-08-24 06:08:38 +00:00
if (task_type === tmp14(17177).TaskType.EMAIL_VERIFICATION) {
2026-07-29 08:29:29 +00:00
const currentUser = authStore.getCurrentUser();
let email;
if (currentUser != null) {
email = currentUser.email;
}
tmp = tmp16;
if (null != email) {
2026-08-24 06:08:38 +00:00
const items = [tmp14(17177).SafetyFlowScreens.VERIFY_EMAIL];
2026-07-29 08:29:29 +00:00
tmp = items;
}
}
tmp5 = tmp;
}
if (null != tmp5) {
closure_1.push(tmp5[0]);
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_1.push(tmp14(17177).SafetyFlowScreens.UPDATE_APP);
2026-07-20 16:05:17 +00:00
}
}
}
2026-08-24 06:08:38 +00:00
const result = require("set").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) {
2026-08-24 06:08:38 +00:00
const tmp3 = TaskType.TASK_TYPE_TO_SCREENS[task_type];
2026-07-29 08:29:29 +00:00
let tmp4 = null;
if (null != tmp3) {
let tmp5 = tmp3;
2026-08-24 06:08:38 +00:00
if (task_type === tmp(17177).TaskType.EMAIL_VERIFICATION) {
2026-07-29 08:29:29 +00:00
const currentUser = authStore.getCurrentUser();
let email;
if (currentUser != null) {
email = currentUser.email;
}
tmp5 = tmp3;
if (null != email) {
2026-08-24 06:08:38 +00:00
const items = [tmp(17177).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() {
2026-07-29 08:29:29 +00:00
const navigation = _require(setTask[11]).useNavigation();
_require = navigation;
let obj = _require(setTask[11]);
const safetyFlowTask = _require(setTask[12]).useSafetyFlowTask();
2026-07-20 16:05:17 +00:00
const task = safetyFlowTask.task;
2026-07-23 10:11:24 +00:00
setTask = safetyFlowTask.setTask;
2026-07-29 08:29:29 +00:00
_require = undefined;
_require = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c3 = 0;
c4 = 0;
2026-07-29 08:29:29 +00:00
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 {
2026-08-24 06:08:38 +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 {
2026-08-24 06:08:38 +00:00
closure_2 = tmp2;
closure_1 = tmp5;
2026-07-29 08:29:29 +00:00
let callback;
2026-08-24 06:08:38 +00:00
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;
2026-07-29 08:29:29 +00:00
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 };
2026-08-24 06:08:38 +00:00
obj4[0] = closure_2_6(closure_1_2);
2026-07-29 08:29:29 +00:00
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;
2026-08-24 06:08:38 +00:00
closure_2_8(callback, callback);
2026-07-29 08:29:29 +00:00
c4 = 3;
2026-08-24 06:08:38 +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];
2026-07-29 08:29:29 +00:00
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);
2026-07-20 16:05:17 +00:00
};