Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(YouTube - Hide ads): Add Hide end screen store banner #4351

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public final class AdsFilter extends Filter {
private final StringFilterGroup playerShoppingShelf;
private final ByteArrayFilterGroup playerShoppingShelfBuffer;

private final StringFilterGroup fullscreenOverlay;
private final ByteArrayFilterGroup endScreenStoreBannerBuffer;

private final StringFilterGroup channelProfile;
private final ByteArrayFilterGroup visitStoreButton;

Expand Down Expand Up @@ -112,11 +115,6 @@ public AdsFilter() {
"expandable_list"
);

channelProfile = new StringFilterGroup(
null,
"channel_profile.eml"
);

playerShoppingShelf = new StringFilterGroup(
null,
"horizontal_shelf.eml"
Expand All @@ -127,6 +125,21 @@ public AdsFilter() {
"shopping_item_card_list.eml"
);

fullscreenOverlay = new StringFilterGroup(
Settings.HIDE_END_SCREEN_STORE_BANNER,
"fullscreen_overlay.eml"
);

endScreenStoreBannerBuffer = new ByteArrayFilterGroup(
null,
"gstatic.com/shopping"
);

channelProfile = new StringFilterGroup(
null,
"channel_profile.eml"
);

visitStoreButton = new ByteArrayFilterGroup(
Settings.HIDE_VISIT_STORE_BUTTON,
"header_store_button"
Expand Down Expand Up @@ -154,6 +167,7 @@ public AdsFilter() {
viewProducts,
selfSponsor,
fullscreenAd,
fullscreenOverlay,
channelProfile,
webLinkPanel,
shoppingLinks,
Expand All @@ -172,6 +186,13 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
return false;
}

if (matchedGroup == fullscreenOverlay) {
if (contentIndex == 0 && endScreenStoreBannerBuffer.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
}

if (exceptions.matches(path))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class Settings extends BaseSettings {

// Ads
public static final BooleanSetting HIDE_BUTTONED_ADS = new BooleanSetting("revanced_hide_buttoned_ads", TRUE);
public static final BooleanSetting HIDE_END_SCREEN_STORE_BANNER = new BooleanSetting("revanced_hide_end_screen_store_banner", FALSE);
public static final BooleanSetting HIDE_FULLSCREEN_ADS = new BooleanSetting("revanced_hide_fullscreen_ads", TRUE);
public static final BooleanSetting HIDE_GENERAL_ADS = new BooleanSetting("revanced_hide_general_ads", TRUE);
public static final BooleanSetting HIDE_GET_PREMIUM = new BooleanSetting("revanced_hide_get_premium", TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ private val hideAdsResourcePatch = resourcePatch {

PreferenceScreen.ADS.addPreferences(
SwitchPreference("revanced_hide_general_ads"),
SwitchPreference("revanced_hide_end_screen_store_banner"),
SwitchPreference("revanced_hide_fullscreen_ads"),
SwitchPreference("revanced_hide_buttoned_ads"),
SwitchPreference("revanced_hide_paid_promotion_label"),
Expand Down
Loading
Loading