Skip to content

Commit

Permalink
fix(HideCallButtons): fix on latest beta/alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
janisslsm committed Apr 10, 2024
1 parent e706f4f commit f7488ee
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions plugins/HideCallButtons/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ export default {
storage.dmHideVideoButton ??= false;
storage.hideVCVideoButton ??= false;

const videoCallAsset = getAssetIDByName("ic_video");
const voiceCallAsset = getAssetIDByName("ic_audio");
let videoCallAsset = getAssetIDByName("ic_video");
let voiceCallAsset = getAssetIDByName("ic_audio");
const videoAsset = getAssetIDByName("video");
const callAsset = getAssetIDByName("nav_header_connect");
const videoAsset2 = getAssetIDByName("VideoIcon");
const callAsset2 = getAssetIDByName("PhoneCallIcon");

if(videoCallAsset === undefined)
videoCallAsset = videoAsset2;
if(voiceCallAsset === undefined)
voiceCallAsset = callAsset2;

const UserProfileActions = findByName("UserProfileActions", false);
const PrivateChannelButtons = find(x => x?.type?.name == "PrivateChannelButtons");
const ChannelButtons = findByProps("ChannelButtons");
Expand All @@ -32,6 +37,8 @@ export default {
if(!storage.upHideVideoButton && !storage.upHideVoiceButton) return;

let buttons = component?.props?.children?.props?.children[1]?.props?.children;
if(buttons === undefined)
buttons = component?.props?.children[1]?.props?.children;
if(buttons?.props?.children !== undefined)
buttons = buttons?.props?.children;
if(buttons === undefined) return;
Expand All @@ -50,6 +57,13 @@ export default {
delete buttonContainer[idx2];
}
}
if(button?.props?.IconComponent !== undefined)
{
if(storage.upHideVoiceButton)
delete buttons[1];
if(storage.upHideVideoButton)
delete buttons[2];
}
if((button?.props?.icon === voiceCallAsset && storage.upHideVoiceButton) ||
(button?.props?.icon === videoCallAsset && storage.upHideVideoButton))
delete buttons[idx];
Expand Down

0 comments on commit f7488ee

Please sign in to comment.