From 4e9ff0e29c8357dc25f7ec203e651a6d5ee2628f Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 01:50:40 +0100 Subject: [PATCH] feat(YouTube - Hide Shorts components): Hide like and dislike buttons --- .../patches/components/ShortsFilter.java | 30 ++++++++++++++----- .../youtube/settings/Settings.java | 2 ++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/integrations/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/integrations/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index c0c8d8c51..c3f4c77e5 100644 --- a/integrations/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/integrations/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -27,7 +27,7 @@ public final class ShortsFilter extends Filter { private final StringFilterGroup infoPanel; private final StringFilterGroup shelfHeader; - private final StringFilterGroup videoActionButton; + private final StringFilterGroup actionBar; private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList(); public ShortsFilter() { @@ -94,15 +94,25 @@ public final class ShortsFilter extends Filter { "shorts_info_panel_overview" ); - videoActionButton = new StringFilterGroup( + actionBar = new StringFilterGroup( null, - "ContainerType|shorts_video_action_button" + "shorts_action_bar" ); addPathCallbacks( shortsCompactFeedVideoPath, joinButton, subscribeButton, subscribeButtonPaused, - channelBar, soundButton, infoPanel, videoActionButton + channelBar, soundButton, infoPanel, actionBar + ); + + var shortsLikeButton = new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_LIKE_BUTTON, + "shorts_like_button" + ); + + var shortsDislikeButton = new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_DISLIKE_BUTTON, + "shorts_dislike_button" ); var shortsCommentButton = new ByteArrayFilterGroup( @@ -120,7 +130,13 @@ public final class ShortsFilter extends Filter { "reel_remix_button" ); - videoActionButtonGroupList.addAll(shortsCommentButton, shortsShareButton, shortsRemixButton); + videoActionButtonGroupList.addAll( + shortsLikeButton, + shortsDislikeButton, + shortsCommentButton, + shortsShareButton, + shortsRemixButton + ); } @Override @@ -141,8 +157,8 @@ public final class ShortsFilter extends Filter { return false; } - // Video action buttons (comment, share, remix) have the same path. - if (matchedGroup == videoActionButton) { + // Video action buttons (like, dislike, comment, share, remix) have the same path. + if (matchedGroup == actionBar) { if (videoActionButtonGroupList.check(protobufBufferArray).isFiltered()) return super.isFiltered( identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex ); diff --git a/integrations/java/app/revanced/integrations/youtube/settings/Settings.java b/integrations/java/app/revanced/integrations/youtube/settings/Settings.java index 8d1b83dd5..b19ccd4cf 100644 --- a/integrations/java/app/revanced/integrations/youtube/settings/Settings.java +++ b/integrations/java/app/revanced/integrations/youtube/settings/Settings.java @@ -141,6 +141,8 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_shorts_subscribe_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SUBSCRIBE_BUTTON_PAUSED = new BooleanSetting("revanced_hide_shorts_subscribe_button_paused", FALSE); public static final BooleanSetting HIDE_SHORTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_thanks_button", TRUE); + public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE); + public static final BooleanSetting HIDE_SHORTS_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_dislike_button", FALSE); public static final BooleanSetting HIDE_SHORTS_COMMENTS_BUTTON = new BooleanSetting("revanced_hide_shorts_comments_button", FALSE); public static final BooleanSetting HIDE_SHORTS_REMIX_BUTTON = new BooleanSetting("revanced_hide_shorts_remix_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SHARE_BUTTON = new BooleanSetting("revanced_hide_shorts_share_button", FALSE);