Skip to content

Commit

Permalink
refactor(HideCallButtons): single patch for VC button hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
janisslsm committed Nov 8, 2023
1 parent 5272378 commit c7cdda8
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions plugins/HideCallButtons/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit c7cdda8

Please sign in to comment.