Skip to content

Commit

Permalink
fix(YouTube Music - Hide action bar components): `Hide Download butto…
Browse files Browse the repository at this point in the history
…n` setting not working in YouTube Music 7.25.52
  • Loading branch information
inotia00 authored and anddea committed Dec 21, 2024
1 parent 16ead35 commit 85dfb09
Showing 1 changed file with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public final class ActionButtonsFilter extends Filter {

private final StringFilterGroup actionBarRule;
private final StringFilterGroup bufferFilterPathRule;
private final StringFilterGroup likeDislikeContainer;
private final ByteArrayFilterGroupList bufferButtonsGroupList = new ByteArrayFilterGroupList();
private final ByteArrayFilterGroup downloadButton;

public ActionButtonsFilter() {
actionBarRule = new StringFilterGroup(
Expand All @@ -29,12 +27,17 @@ public ActionButtonsFilter() {
null,
"|ContainerType|button.eml|"
);
likeDislikeContainer = new StringFilterGroup(
final StringFilterGroup downloadButton = new StringFilterGroup(
Settings.HIDE_ACTION_BUTTON_DOWNLOAD,
"music_download_button.eml"
);
final StringFilterGroup likeDislikeContainer = new StringFilterGroup(
Settings.HIDE_ACTION_BUTTON_LIKE_DISLIKE,
"segmented_like_dislike_button.eml"
);
addPathCallbacks(
bufferFilterPathRule,
downloadButton,
likeDislikeContainer
);

Expand All @@ -56,10 +59,6 @@ public ActionButtonsFilter() {
"yt_outline_youtube_mix"
)
);
downloadButton = new ByteArrayFilterGroup(
Settings.HIDE_ACTION_BUTTON_DOWNLOAD,
"music_download_button"
);
}

private boolean isEveryFilterGroupEnabled() {
Expand All @@ -69,7 +68,7 @@ private boolean isEveryFilterGroupEnabled() {
for (ByteArrayFilterGroup group : bufferButtonsGroupList)
if (!group.isEnabled()) return false;

return downloadButton.isEnabled();
return true;
}

@Override
Expand All @@ -81,16 +80,8 @@ public boolean isFiltered(String path, @Nullable String identifier, String allVa
if (matchedGroup == actionBarRule && !isEveryFilterGroupEnabled()) {
return false;
}
if (contentType == FilterContentType.PATH) {
if (matchedGroup == bufferFilterPathRule) {
if (!bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) {
return false;
}
} else if (matchedGroup != likeDislikeContainer) {
if (!downloadButton.check(protobufBufferArray).isFiltered()) {
return false;
}
}
if (matchedGroup == bufferFilterPathRule && !bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) {
return false;
}

return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
Expand Down

0 comments on commit 85dfb09

Please sign in to comment.