Files
discord-decomp/modules/safety_flows/openSafetyFlow.native.tsx
T
2026-11-01 12:12:55 +02:00

86 lines
2.8 KiB
TypeScript

// Metro module 16702 (f16703).
import UserRequiredActionStore from "../../stores/UserRequiredActionStore";
import { UserRequiredActions } from "../../Constants";
import { TaskType, SafetyFlowScreens, TASK_TYPE_TO_SCREENS } from "./types";
import ModalActionCreators from "../../actions/ModalActionCreators";
import { SAFETY_FLOWS_MODAL_KEY } from "./constants";
import { getCurrentTask } from "./SafetyFlowsActionCreators";
import "../../_bundle/asyncRequire";
function $mk117440($env) {
return function getInitialScreenForTask(a0) {
return a0.task_type === TaskType.AGE_VERIFICATION ? SafetyFlowScreens.AGE_VERIFICATION : a0.task_type === TaskType.PARENTAL_CONSENT_CONNECTION ? SafetyFlowScreens.PARENTAL_CONSENT_CONNECTION : TASK_TYPE_TO_SCREENS[a0.task_type] != null ? SafetyFlowScreens.OVERVIEW : SafetyFlowScreens.UPDATE_APP;
};
}
let env12033 = {};
export async function openSafetyFlow(c28497_0) {
let action, c28497_2, c28497_3, c28497_4;
let c28497_5 = 0;
const r11 = env12033;
L21: {
L16: {
try {
let env31101;
c28497_3 = r11;
const r33 = env31101 = {
$parent: r11
};
c28497_2 = r33;
env31101[0] = void 0;
let r15 = c28497_0;
if (r15 === void 0) {
r15 = {};
}
env31101[0] = r15.requiredAction;
env31101[1] = void 0;
env31101[2] = void 0;
await void 0;
action = env31101[0];
if (action == null) {
action = UserRequiredActionStore.getAction();
}
if (action === UserRequiredActions.REQUIRE_SAFETY_FLOWS) {
c28497_5 = 1;
env31101[1] = await getCurrentTask();
if (env31101[1] == null) {
c28497_5 = 0;
break L21;
}
const r99 = env31101[1];
env31101[2] = $mk117440(env12033)(r99);
ModalActionCreators.pushLazy(import("./native/SafetyFlowsModal"), {
task: env31101[1],
initialScreen: env31101[2]
}, SAFETY_FLOWS_MODAL_KEY);
c28497_5 = 0;
} else {
ModalActionCreators.popWithKey(SAFETY_FLOWS_MODAL_KEY);
}
} catch ($e) {
const r31 = $e;
let r8 = r31;
c28497_4 = r31;
if (c28497_5 !== 0) {
while (true) {
try {
c28497_5 = 0;
ModalActionCreators.pushLazy(import("./native/SafetyFlowsModal"), {
task: null,
initialScreen: SafetyFlowScreens.ERROR
}, SAFETY_FLOWS_MODAL_KEY);
break L16;
} catch (r127) {
r8 = r127;
c28497_4 = r127;
if (c28497_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}