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

106 lines
2.8 KiB
TypeScript

// Metro module 10924 (f10925).
import { createContext, useRef, useContext, useMemo } from "react";
import { useSharedValue } from "../../reanimated/ReanimatedRexport";
import { AppLauncherEntrypoint } from "../AppLauncherTypes";
import { useDefaultAppLauncherWidth } from "./hooks/useDefaultAppLauncherWidth";
function $mk85922($env) {
return () => {
if ($env[0]) {
return void 0;
}
throw new Error("use useRequiredAppLauncherContext and provide a ChatInputRef");
};
}
function $mk85923($env) {
return () => {
if ($env[0]) {
return void 0;
}
throw new Error("use useRequiredAppLauncherContext and provide a ChatInputRef");
};
}
function $mk85924($env) {
return () => {
if ($env[0]) {
return void 0;
}
throw new Error("use useRequiredAppLauncherContext and provide a ChatInputRef");
};
}
let c7356_3 = {
DISMISSED: 0,
0: "DISMISSED",
COMMAND: 1,
1: "COMMAND",
ACTIVITY: 2,
2: "ACTIVITY",
BACK: 3,
3: "BACK",
OAUTH_MODAL: 4,
4: "OAUTH_MODAL"
};
const r25 = {
GESTURE: 0,
0: "GESTURE",
KEYBOARD: 1,
1: "KEYBOARD",
APP_VIEW: 2,
2: "APP_VIEW",
COMMAND_VIEW: 3,
3: "COMMAND_VIEW",
OTHER: 4,
4: "OTHER"
};
const context = createContext(void 0);
export { c7356_3 as AppLauncherKeyboardCloseReason };
export { r25 as AppLauncherBottomSheetExpandReason };
export { context as AppLauncherContext };
export function useAppLauncherChatInputRefDummy(a0) {
let env18369;
const r3 = env18369 = {};
env18369[0] = a0.noop;
return useRef({
getApplicationCommandManager: $mk85922(r3),
openCustomKeyboard: $mk85923(r3),
closeCustomKeyboard: $mk85924(r3)
});
}
export function useRequiredAppLauncherContext() {
const context2 = useContext(context);
if (context2 == null) {
throw new Error("AppLauncherContext not found, must be used within AppLauncherNavigator");
}
return context2;
}
export function useAppLauncherContext() {
let env18371;
const ref = useRef(c7356_3.DISMISSED);
const ref2 = useRef(void 0);
const sharedValue = useSharedValue(-1);
const sharedValue2 = useSharedValue(0);
const TEXT = AppLauncherEntrypoint.TEXT;
const defaultAppLauncherWidth = useDefaultAppLauncherWidth(TEXT);
const r31 = env18371 = {};
env18371[0] = false;
const ref3 = useRef({
getApplicationCommandManager: $mk85922(r31),
openCustomKeyboard: $mk85923(r31),
closeCustomKeyboard: $mk85924(r31)
});
const memo = useMemo(() => ({
keyboardCloseReasonRef: ref,
bottomSheetIndex: sharedValue,
bottomSheetPosition: sharedValue2,
bottomSheetExpandReasonRef: ref2,
chatInputRef: ref3,
width: defaultAppLauncherWidth,
entrypoint: TEXT,
onActivityItemSelected: void 0
}), [defaultAppLauncherWidth, TEXT, ref3, sharedValue, sharedValue2]);
let r44 = useContext(context);
if (r44 == null) {
r44 = memo;
}
return r44;
}