Files
discord-decomp/actions/ModalActionCreators.tsx
T
2026-11-01 12:12:55 +02:00

99 lines
2.8 KiB
TypeScript

// Metro module 4395 (f4396).
import { AppContext } from "../Constants";
import uniqueId from "../_bundle/uniqueId";
import { pushModal, popModal, popModalsAboveKey, popAllModals } from "../modules/main_tabs_v2/helpers/NavigationRouteUtils.native";
import getDeprecatedModalData from "../utils/getDeprecatedModalData";
import Dispatcher from "../Dispatcher";
import { getRootNavigationRef } from "../modules/main_tabs_v2/RootNavigationRef.native";
import ModalDispatchQueue from "../modules/main_tabs_v2/native/modal/ModalDispatchQueue";
const r16 = {
push: function push(a0, a1, key = uniqueId("modal")) {
let appContext = arguments[4];
if (appContext === void 0) {
appContext = AppContext.APP;
}
const r10 = arguments[3];
pushModal({
key,
modal: getDeprecatedModalData(a0, {}, a1, key),
...r10
});
Dispatcher.dispatch({
type: "MODAL_PUSH",
modal: a0,
props: a1,
key,
appContext
});
return key;
},
pushLazy: function pushLazy(a0, c14224_2) {
let r11 = arguments[2];
if (r11 === void 0) {
r11 = uniqueId("modal");
}
let c14224_3 = r11;
let c14224_0 = arguments[3];
const rootNavigationRef = getRootNavigationRef();
return rootNavigationRef != null && rootNavigationRef.isReady() ? (a0 instanceof Promise ? a0.then((result) => result.default) : a0()).then((result) => this.push(result, c14224_2, c14224_3, c14224_0)) : new Promise((c25155_0) => ModalDispatchQueue.enqueue(() => c25155_0(this.pushLazy(a0, c14224_2, c14224_3, c14224_0))));
},
updateAnimation: (a0, a1) => {
Dispatcher.dispatch({
type: "MODAL_UPDATE",
key: a0,
props: {},
partial: true,
animation: a1
});
},
pop: () => {
popModal();
Dispatcher.dispatch({
type: "MODAL_POP"
});
},
popWithKey: (a0, a1) => {
popModal(a0, a1);
Dispatcher.dispatch({
type: "MODAL_POP",
key: a0,
onExited: a1
});
},
popAboveKey: (a0) => popModalsAboveKey(a0),
popAll: () => {
popAllModals();
Dispatcher.dispatch({
type: "MODAL_POP_ALL"
});
Dispatcher.dispatch({
type: "EMAIL_VERIFICATION_MODAL_CLOSE"
});
Dispatcher.dispatch({
type: "GUILD_SETTINGS_CLOSE"
});
Dispatcher.dispatch({
type: "HIDE_ACTION_SHEET"
});
Dispatcher.dispatch({
type: "DISPLAYED_INVITE_CLEAR"
});
Dispatcher.dispatch({
type: "NOTIFICATION_SETTINGS_MODAL_CLOSE"
});
Dispatcher.dispatch({
type: "QUICKSWITCHER_HIDE"
});
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_CLOSE"
});
Dispatcher.dispatch({
type: "CONNECTIONS_GRID_MODAL_HIDE"
});
Dispatcher.dispatch({
type: "USER_PROFILE_MODAL_CLOSE"
});
}
};
export default r16;