From c7cdda8d9e513a2c4abf6d3871978785b0f24744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=81nis?= <97699850+janisslsm@users.noreply.github.com> Date: Wed, 8 Nov 2023 23:15:03 +0200 Subject: [PATCH] refactor(HideCallButtons): single patch for VC button hiding --- plugins/HideCallButtons/src/index.ts | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/plugins/HideCallButtons/src/index.ts b/plugins/HideCallButtons/src/index.ts index 04532d2..d8eb391 100644 --- a/plugins/HideCallButtons/src/index.ts +++ b/plugins/HideCallButtons/src/index.ts @@ -23,8 +23,8 @@ export default { const UserProfileActions = findByName("UserProfileActions", false); const PrivateChannelButtons = find(x => x?.type?.name == "PrivateChannelButtons"); const ChannelButtons = findByProps("ChannelButtons"); - const FocusedControlsBottomControls = findByName("FocusedControlsBottomControls", false); - + const VideoButton = findByProps("VideoButton"); + // User Profile patches.push(after("default", UserProfileActions, (_, component) => { if(!storage.upHideVideoButton && !storage.upHideVoiceButton) return; @@ -44,22 +44,13 @@ export default { })); // VC - patches.push(after("default", FocusedControlsBottomControls, (_, component) => { + patches.push(after("default", VideoButton, (_, component) => { if(!storage.hideVCVideoButton) return; - const children = component?.props?.children?.props?.children; - if(children === undefined) return; - - var _default = component?.props?.children?.props?.children[1]; - if(_default?.type?.name !== "_default") return; + const buttons = component?.props?.children?.props?.children?.props?.children; + if(buttons === undefined) return; - const p1 = after("type", _default, (_, comp) => { - var buttons = comp?.props?.children?.props?.children?.props?.children; - if(buttons !== undefined) - delete buttons[0]; - - p1(); - }); + delete buttons[0]; })); // Tabs V2 DM Header