From 6eb301776e202cf1d923f96cc83ddf6f0430b211 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Fri, 6 Oct 2023 02:36:27 +0200 Subject: [PATCH] fix(YouTube - Hide shorts components): Do not prevent filtering components Previously, the exceptions group prevented filtering the "Notify me" button and in feed surveys. --- .../patches/components/LayoutComponentsFilter.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java b/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java index 39be57c9..4ee419d3 100644 --- a/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java +++ b/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java @@ -20,14 +20,16 @@ public final class LayoutComponentsFilter extends Filter { "&list=" ); private final StringFilterGroup searchResultShelfHeader; + private final StringFilterGroup inFeedSurvey; + private final StringFilterGroup notifyMe; @RequiresApi(api = Build.VERSION_CODES.N) public LayoutComponentsFilter() { exceptions.addPatterns( "home_video_with_context", "related_video_with_context", - "comment_thread", // skip filtering anything in the comments - "|comment.", // skip filtering anything in the comments replies + "comment_thread", // Whitelist comments + "|comment.", // Whitelist comment replies "library_recent_shelf" ); @@ -62,7 +64,7 @@ public final class LayoutComponentsFilter extends Filter { "compact_banner" ); - final var inFeedSurvey = new StringFilterGroup( + inFeedSurvey = new StringFilterGroup( SettingsEnum.HIDE_FEED_SURVEY, "in_feed_survey", "slimline_survey" @@ -158,7 +160,7 @@ public final class LayoutComponentsFilter extends Filter { "shelf_header.eml" ); - final var notifyMe = new StringFilterGroup( + notifyMe = new StringFilterGroup( SettingsEnum.HIDE_NOTIFY_ME_BUTTON, "set_reminder_button" ); @@ -208,6 +210,9 @@ public final class LayoutComponentsFilter extends Filter { @Override public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray, FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) { + + if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey) return true; + if (matchedGroup != custom && exceptions.matches(path)) return false; // Exceptions are not filtered.