Skip to content

Commit

Permalink
feat(YouTube - Hide ads): Add Hide end screen store banner (ReVance…
Browse files Browse the repository at this point in the history
  • Loading branch information
ILoveOpenSourceApplications authored Jan 27, 2025
1 parent 59db22c commit 5505087
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 39 deletions.
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 @@ -64,6 +64,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

0 comments on commit 5505087

Please sign in to comment.