fix: patches not applying

This commit is contained in:
kmmiio99o 2026-08-01 19:12:02 +02:00
parent 4671357963
commit 1bab532981
No known key found for this signature in database
GPG key ID: DCC0431E10FADBF1

View file

@ -5,22 +5,28 @@ import { registerIntercept } from "./createElementIntercept";
const TAG = "[ServerDrawer]";
const QuestDockGestureContext = find((m) => m?.QuestDockGestureContext)?.QuestDockGestureContext;
let cachedGestureContext: any = null;
function getGestureContext(): any {
if (!cachedGestureContext) {
cachedGestureContext = find((m) => m?.QuestDockGestureContext)?.QuestDockGestureContext ?? null;
}
return cachedGestureContext;
}
export function patchExpanded(
cleanups: (() => void)[]
): boolean {
const mod = find((m) => m?.type?.displayName === "QuestDockContentExpanded" || m?.type?.name === "QuestDockContentExpanded");
if (!mod?.type) {
console.log(TAG, "WARN: QuestDockContentExpanded not found");
console.log(TAG, "WARN: QuestDockContentExpanded not found (will retry)");
return false;
}
const orig = mod.type;
registerIntercept(orig, ServerDrawerSheet, { gestureContext: QuestDockGestureContext });
registerIntercept(orig, ServerDrawerSheet, { gestureContext: getGestureContext() });
mod.type = function ServerDrawerPatch() {
return <ServerDrawerSheet gestureContext={QuestDockGestureContext} />;
return <ServerDrawerSheet gestureContext={getGestureContext()} />;
};
cleanups.push(() => { mod.type = orig; });
console.log(TAG, "PATCH: QuestDockContentExpanded replaced");