132 lines
4.9 KiB
TypeScript
132 lines
4.9 KiB
TypeScript
// Metro module 4529 (f4530).
|
|
import ActionSheetActionCreators from "../../modules/action_sheet/native/ActionSheetActionCreators";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { dismissAlert, openAlert } from "../../design/components/AlertModal/native/useAlertStore.native";
|
|
import { intl, t } from "../../intl/index.native";
|
|
import { isMobileVisualRefreshEnabled } from "../../modules/themes/experiments/MobileVisualRefreshExperiment";
|
|
import { AlertModal, AlertActionButton } from "../../design/components/AlertModal/native/AlertModal.native";
|
|
import { getAlertButtonVariant } from "../../components_native/common/Alert";
|
|
let c2735_6 = null;
|
|
let c2735_7 = 0;
|
|
const r23 = {
|
|
openLazy: (a0) => {
|
|
const { importer: importer2, hideActionSheet = true } = a0;
|
|
let c14303_0 = hideActionSheet;
|
|
let isDismissable2 = a0.isDismissable;
|
|
if (isDismissable2 === void 0) {
|
|
isDismissable2 = false;
|
|
}
|
|
const isDismissable = isDismissable2;
|
|
return importer2().then((result) => {
|
|
if (c14303_0) {
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "ALERT_OPEN",
|
|
alert: result,
|
|
isDismissable
|
|
});
|
|
});
|
|
},
|
|
close: () => {
|
|
const r4 = c2735_6;
|
|
if (r4 != null) {
|
|
c2735_6 = null;
|
|
dismissAlert(r4);
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "ALERT_CLOSE"
|
|
});
|
|
},
|
|
show: function show(a0) {
|
|
const { hideActionSheet = true, isDismissable: isDismissable2, confirmText: confirmText2 = intl.string(t.BddRzS) } = a0;
|
|
let confirmText, c14304_1, c14304_2, onConfirm2, onCancel2, c14304_5;
|
|
L56: {
|
|
confirmText = confirmText2;
|
|
const { hideActionSheet: _hideActionSheet, isDismissable, confirmText: _confirmText, ...rest } = a0;
|
|
c14304_1 = rest;
|
|
c14304_2 = void 0;
|
|
onConfirm2 = void 0;
|
|
onCancel2 = void 0;
|
|
c14304_5 = void 0;
|
|
if (isMobileVisualRefreshEnabled("AlertActionCreators")) {
|
|
const r43 = {
|
|
...rest,
|
|
confirmText,
|
|
isDismissable: isDismissable2
|
|
};
|
|
const { body, confirmText: confirmText3 } = r43;
|
|
const r1 = body != null && typeof body !== "string" && !Array.isArray(body);
|
|
if (!(r43.title == null || r43.title === "" || confirmText3 != null && typeof confirmText3 !== "string" || r1 || r43.footer != null || r43.helpText != null || r43.renderConfirmButton != null || r43.renderConfirmIcon != null || r43.renderConfirmRightIcon != null || r43.noDefaultButtons === true || r43.secondaryConfirmText != null || r43.onConfirmSecondary != null || r43.isConfirmButtonDisabled === true || r43.confirming != null || r43.style != null || r43.fillCancelText === true || r43.autoCloseOnConfirm === false || r43.onClose != null)) {
|
|
if (hideActionSheet) {
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}
|
|
if (c2735_6 != null) {
|
|
dismissAlert(c2735_6);
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "ALERT_CLOSE"
|
|
});
|
|
const r102 = +c2735_7;
|
|
c2735_7 = r102 + 1;
|
|
const r105 = "legacy-alert-" + r102;
|
|
c14304_2 = r105;
|
|
c2735_6 = r105;
|
|
const { title, body: body2, children, confirmColor, cancelText } = rest;
|
|
onConfirm2 = rest.onConfirm;
|
|
onCancel2 = rest.onCancel;
|
|
c14304_5 = false;
|
|
openAlert(r105, <AlertModal title={title} content={body2} extraContent={children} actions={<>
|
|
<AlertActionButton variant={getAlertButtonVariant(confirmColor)} text={confirmText} onPress={function onPress() {
|
|
c14304_5 = true;
|
|
if (onConfirm2 != null) {
|
|
onConfirm2();
|
|
}
|
|
}} />
|
|
{cancelText != null ? <AlertActionButton variant="secondary" text={cancelText} onPress={function onPress() {
|
|
c14304_5 = true;
|
|
if (onCancel2 != null) {
|
|
onCancel2();
|
|
}
|
|
}} /> : null}
|
|
</>} />, () => {
|
|
if (!c14304_5 && onCancel2 != null) {
|
|
onCancel2();
|
|
}
|
|
if (c2735_6 === c14304_2) {
|
|
c2735_6 = null;
|
|
}
|
|
}, {
|
|
dismissable: isDismissable2 === true
|
|
});
|
|
break L56;
|
|
}
|
|
}
|
|
if (c2735_6 != null) {
|
|
dismissAlert(c2735_6);
|
|
c2735_6 = null;
|
|
}
|
|
this.openLazy({
|
|
importer: () => import("../../components_native/common/Alert").then(({ default: Component }) => (a0) => <Component {...a0} {...c14304_1} confirmText={confirmText} />),
|
|
hideActionSheet,
|
|
isDismissable: isDismissable2
|
|
});
|
|
}
|
|
},
|
|
confirm: function confirm(c14305_0) {
|
|
return new Promise((c25242_0) => {
|
|
this.show({
|
|
onConfirm: () => {
|
|
c25242_0(true);
|
|
},
|
|
cancelText: intl.string(t["ETE/oC"]),
|
|
onCancel: () => {
|
|
c25242_0(false);
|
|
},
|
|
...c14305_0
|
|
});
|
|
});
|
|
}
|
|
};
|
|
export default r23;
|