feat(YouTube - Hide ads): Add option to hide the 'Visit store' button on channel pages (#622)

This commit is contained in:
oSumAtrIX 2024-04-23 19:31:27 +02:00 committed by GitHub
parent a9da29926a
commit 9de566ca02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -23,6 +23,10 @@ public final class AdsFilter extends Filter {
// endregion
private final StringTrieSearch exceptions = new StringTrieSearch();
private final StringFilterGroup channelProfile;
private final ByteArrayFilterGroup visitStoreButton;
private final StringFilterGroup shoppingLinks;
public AdsFilter() {
@ -100,6 +104,16 @@ public final class AdsFilter extends Filter {
"expandable_list"
);
channelProfile = new StringFilterGroup(
null,
"channel_profile.eml"
);
visitStoreButton = new ByteArrayFilterGroup(
Settings.HIDE_VISIT_STORE_BUTTON,
"header_store_button"
);
final var webLinkPanel = new StringFilterGroup(
Settings.HIDE_WEB_SEARCH_RESULTS,
"web_link_panel"
@ -122,6 +136,7 @@ public final class AdsFilter extends Filter {
viewProducts,
selfSponsor,
fullscreenAd,
channelProfile,
webLinkPanel,
shoppingLinks,
movieAds
@ -140,6 +155,13 @@ public final class AdsFilter extends Filter {
return false; // Do not actually filter the fullscreen ad otherwise it will leave a dimmed screen.
}
if (matchedGroup == channelProfile) {
if (visitStoreButton.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
}
// Check for the index because of likelihood of false positives.
if (matchedGroup == shoppingLinks && contentIndex != 0)
return false;

View File

@ -45,6 +45,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_SHOPPING_LINKS = new BooleanSetting("revanced_hide_shopping_links", TRUE);
public static final BooleanSetting HIDE_SELF_SPONSOR = new BooleanSetting("revanced_hide_self_sponsor_ads", TRUE);
public static final BooleanSetting HIDE_VIDEO_ADS = new BooleanSetting("revanced_hide_video_ads", TRUE, true);
public static final BooleanSetting HIDE_VISIT_STORE_BUTTON = new BooleanSetting("revanced_hide_visit_store_button", TRUE);
public static final BooleanSetting HIDE_WEB_SEARCH_RESULTS = new BooleanSetting("revanced_hide_web_search_results", TRUE);
// Feed