From da4b301a75e1c8559af8ec42dfcefc230e23ebf0 Mon Sep 17 00:00:00 2001 From: Rico040 <93081680+Rico040@users.noreply.github.com> Date: Fri, 3 May 2024 23:15:07 +1000 Subject: [PATCH] more reliable approch? --- plugins/hideappbutton/src/index.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/plugins/hideappbutton/src/index.ts b/plugins/hideappbutton/src/index.ts index 96d0eb9..9a6d649 100644 --- a/plugins/hideappbutton/src/index.ts +++ b/plugins/hideappbutton/src/index.ts @@ -1,19 +1,15 @@ +import { logger } from "@vendetta"; import { findByName } from "@vendetta/metro"; import { after } from "@vendetta/patcher"; -import { getAssetIDByName } from "@vendetta/ui/assets"; -import { findInReactTree } from "@vendetta/utils"; const ChatInput = findByName("ChatInput"); -let unpatch: () => boolean; +const patch = after("render", ChatInput.prototype, (...args) => { + try { + args[1].props.children[2].props.children.props.children[1].props.isAppLauncherEnabled = false; + } catch (e) { + logger.error("Failed to hide voice message button", e); + } +}); -export default { - onLoad() { - const blockList = ["ic_thread_normal_24px", "AppsIcon"].map(n => getAssetIDByName(n)); - unpatch = after("render", ChatInput.prototype, (_, ret) => { - const input = findInReactTree(ret, t => "forceAnimateButtons" in t.props && t.props.actions); - input.props.actions = input.props.actions.filter(a => !blockList.includes(a.source)); - }); - }, - onUnload: unpatch -}; \ No newline at end of file +export const onUnload = () => patch(); \ No newline at end of file