fix(YouTube Music - Hide action bar components): Hide Download button setting not working in YouTube Music 7.25.52

This commit is contained in:
inotia00 2024-12-21 11:50:42 +09:00
parent f894327f0d
commit d0d18310f8

View File

@ -14,9 +14,7 @@ public final class ActionButtonsFilter extends Filter {
private final StringFilterGroup actionBarRule; private final StringFilterGroup actionBarRule;
private final StringFilterGroup bufferFilterPathRule; private final StringFilterGroup bufferFilterPathRule;
private final StringFilterGroup likeDislikeContainer;
private final ByteArrayFilterGroupList bufferButtonsGroupList = new ByteArrayFilterGroupList(); private final ByteArrayFilterGroupList bufferButtonsGroupList = new ByteArrayFilterGroupList();
private final ByteArrayFilterGroup downloadButton;
public ActionButtonsFilter() { public ActionButtonsFilter() {
actionBarRule = new StringFilterGroup( actionBarRule = new StringFilterGroup(
@ -29,12 +27,17 @@ public final class ActionButtonsFilter extends Filter {
null, null,
"|ContainerType|button.eml|" "|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, Settings.HIDE_ACTION_BUTTON_LIKE_DISLIKE,
"segmented_like_dislike_button.eml" "segmented_like_dislike_button.eml"
); );
addPathCallbacks( addPathCallbacks(
bufferFilterPathRule, bufferFilterPathRule,
downloadButton,
likeDislikeContainer likeDislikeContainer
); );
@ -56,10 +59,6 @@ public final class ActionButtonsFilter extends Filter {
"yt_outline_youtube_mix" "yt_outline_youtube_mix"
) )
); );
downloadButton = new ByteArrayFilterGroup(
Settings.HIDE_ACTION_BUTTON_DOWNLOAD,
"music_download_button"
);
} }
private boolean isEveryFilterGroupEnabled() { private boolean isEveryFilterGroupEnabled() {
@ -69,7 +68,7 @@ public final class ActionButtonsFilter extends Filter {
for (ByteArrayFilterGroup group : bufferButtonsGroupList) for (ByteArrayFilterGroup group : bufferButtonsGroupList)
if (!group.isEnabled()) return false; if (!group.isEnabled()) return false;
return downloadButton.isEnabled(); return true;
} }
@Override @Override
@ -81,17 +80,9 @@ public final class ActionButtonsFilter extends Filter {
if (matchedGroup == actionBarRule && !isEveryFilterGroupEnabled()) { if (matchedGroup == actionBarRule && !isEveryFilterGroupEnabled()) {
return false; return false;
} }
if (contentType == FilterContentType.PATH) { if (matchedGroup == bufferFilterPathRule && !bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) {
if (matchedGroup == bufferFilterPathRule) {
if (!bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) {
return false; return false;
} }
} else if (matchedGroup != likeDislikeContainer) {
if (!downloadButton.check(protobufBufferArray).isFiltered()) {
return false;
}
}
}
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex); return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
} }