diff --git a/plugins/HideGiftButton/src/index.ts b/plugins/HideGiftButton/src/index.ts index 63c9625..0b653cb 100644 --- a/plugins/HideGiftButton/src/index.ts +++ b/plugins/HideGiftButton/src/index.ts @@ -1,16 +1,19 @@ 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"); -// Object.defineProperty(ChatInput.defaultProps, "hideGiftButton", { -// get: () => plugins?.[plugin.id]?.enabled -// }); +let unpatch: () => boolean; export default { onLoad() { - ChatInput.defaultProps.hideGiftButton = true; + const blockList = ["ic_thread_normal_24px", "ic_gift"].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() { - ChatInput.defaultProps.hideGiftButton = false; - } + onUnload: unpatch };