Hide threads in HideGiftButton
This commit is contained in:
parent
1843ff4e38
commit
b36ff42d59
1 changed files with 10 additions and 7 deletions
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue