Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
fix(YouTube - Hide shorts components): Do not prevent filtering compo…
Browse files Browse the repository at this point in the history
…nents

Previously, the exceptions group prevented filtering the "Notify me" button and in feed surveys.
  • Loading branch information
oSumAtrIX committed Oct 6, 2023
1 parent ed65717 commit 6eb3017
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);

Expand Down Expand Up @@ -62,7 +64,7 @@ public LayoutComponentsFilter() {
"compact_banner"
);

final var inFeedSurvey = new StringFilterGroup(
inFeedSurvey = new StringFilterGroup(
SettingsEnum.HIDE_FEED_SURVEY,
"in_feed_survey",
"slimline_survey"
Expand Down Expand Up @@ -158,7 +160,7 @@ public LayoutComponentsFilter() {
"shelf_header.eml"
);

final var notifyMe = new StringFilterGroup(
notifyMe = new StringFilterGroup(
SettingsEnum.HIDE_NOTIFY_ME_BUTTON,
"set_reminder_button"
);
Expand Down Expand Up @@ -208,6 +210,9 @@ public LayoutComponentsFilter() {
@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.

Expand Down

0 comments on commit 6eb3017

Please sign in to comment.