diff --git a/package.json b/package.json index 66bd185..3b8291f 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "build": "node build.mjs" }, "dependencies": { + "@nexpid/vdp-shared": "1.0.1", "@swc/helpers": "^0.4.14" }, "devDependencies": { diff --git a/src/patches/MessageLongPressActionSheet.tsx b/src/patches/MessageLongPressActionSheet.tsx index ae772d4..aab044a 100644 --- a/src/patches/MessageLongPressActionSheet.tsx +++ b/src/patches/MessageLongPressActionSheet.tsx @@ -3,13 +3,12 @@ import { React } from "@vendetta/metro/common"; import { after, before } from "@vendetta/patcher"; import { storage } from "@vendetta/plugin"; import { getAssetIDByName } from "@vendetta/ui/assets"; -import { Forms } from "@vendetta/ui/components"; import { showToast } from "@vendetta/ui/toasts"; +import { findInReactTree } from "@vendetta/utils"; -const LazyActionSheet = findByProps("openLazy", "hideActionSheet"); +import { RedesignRow } from "@nexpid/vdp-shared"; -// Components -const { FormRow, FormIcon } = Forms; +const LazyActionSheet = findByProps("openLazy", "hideActionSheet"); const JSON_CODEBLOCK_PATTERN = /^```(?:json)\n([\s\S]*?)```$/gm @@ -45,7 +44,11 @@ export default function patchMessageLongPressActionSheet() { // Don't add anything if we have no importable rules if (!rules || rules.length == 0) return; - let buttons = res?.props?.children?.props?.children?.props?.children[1]; + const buttons = findInReactTree( + res, + (x) => x?.[0]?.type?.name === "ButtonRow" + ); + if (!buttons) return; for (const rule of rules) { const importRuleCallback = () => { @@ -54,8 +57,8 @@ export default function patchMessageLongPressActionSheet() { LazyActionSheet.hideActionSheet(); }; - const importRuleButton = (} + const importRuleButton = ();