fix: patches not applying
This commit is contained in:
parent
4671357963
commit
1bab532981
1 changed files with 10 additions and 4 deletions
|
|
@ -5,22 +5,28 @@ import { registerIntercept } from "./createElementIntercept";
|
||||||
|
|
||||||
const TAG = "[ServerDrawer]";
|
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(
|
export function patchExpanded(
|
||||||
cleanups: (() => void)[]
|
cleanups: (() => void)[]
|
||||||
): boolean {
|
): boolean {
|
||||||
const mod = find((m) => m?.type?.displayName === "QuestDockContentExpanded" || m?.type?.name === "QuestDockContentExpanded");
|
const mod = find((m) => m?.type?.displayName === "QuestDockContentExpanded" || m?.type?.name === "QuestDockContentExpanded");
|
||||||
if (!mod?.type) {
|
if (!mod?.type) {
|
||||||
console.log(TAG, "WARN: QuestDockContentExpanded not found");
|
console.log(TAG, "WARN: QuestDockContentExpanded not found (will retry)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const orig = mod.type;
|
const orig = mod.type;
|
||||||
|
|
||||||
registerIntercept(orig, ServerDrawerSheet, { gestureContext: QuestDockGestureContext });
|
registerIntercept(orig, ServerDrawerSheet, { gestureContext: getGestureContext() });
|
||||||
|
|
||||||
mod.type = function ServerDrawerPatch() {
|
mod.type = function ServerDrawerPatch() {
|
||||||
return <ServerDrawerSheet gestureContext={QuestDockGestureContext} />;
|
return <ServerDrawerSheet gestureContext={getGestureContext()} />;
|
||||||
};
|
};
|
||||||
cleanups.push(() => { mod.type = orig; });
|
cleanups.push(() => { mod.type = orig; });
|
||||||
console.log(TAG, "PATCH: QuestDockContentExpanded replaced");
|
console.log(TAG, "PATCH: QuestDockContentExpanded replaced");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue