fix(YouTube - Hide ads): Hide new type of general ad (#5004)

This commit is contained in:
ILoveOpenSourceApplications
2025-05-22 22:05:11 +05:30
committed by GitHub
parent 48b2e081ad
commit 37e59d2771
4 changed files with 29 additions and 36 deletions

View File

@ -64,48 +64,45 @@ public final class AdsFilter extends Filter {
"_interstitial"
);
final var buttonedAd = new StringFilterGroup(
Settings.HIDE_BUTTONED_ADS,
"_ad_with",
"_buttoned_layout",
// text_image_button_group_layout, landscape_image_button_group_layout, full_width_square_image_button_group_layout
"image_button_group_layout",
"full_width_square_image_layout",
"video_display_button_group_layout",
"landscape_image_wide_button_layout",
"video_display_carousel_button_group_layout",
"video_display_full_buttoned_short_dr_layout",
"compact_landscape_image_layout", // Tablet layout search results.
"text_image_no_button_layout" // Tablet layout search results.
);
final var generalAds = new StringFilterGroup(
Settings.HIDE_GENERAL_ADS,
"_ad_with",
"_buttoned_layout",
"ads_video_with_context",
"banner_text_icon",
"square_image_layout",
"watch_metadata_app_promo",
"video_display_full_layout",
"hero_promo_image",
"statement_banner",
"brand_video_shelf",
"brand_video_singleton",
"carousel_footered_layout",
"text_image_button_layout",
"carousel_headered_layout",
"compact_landscape_image_layout", // Tablet layout search results.
"composite_concurrent_carousel_layout",
"full_width_portrait_image_layout",
"full_width_square_image_carousel_layout",
"full_width_square_image_layout",
"hero_promo_image",
// text_image_button_group_layout, landscape_image_button_group_layout, full_width_square_image_button_group_layout
"image_button_group_layout",
"landscape_image_wide_button_layout",
"primetime_promo",
"product_details",
"composite_concurrent_carousel_layout",
"carousel_headered_layout",
"full_width_portrait_image_layout",
"brand_video_shelf",
"brand_video_singleton"
"square_image_layout",
"statement_banner",
"text_image_button_layout",
"text_image_no_button_layout", // Tablet layout search results.
"video_display_button_group_layout",
"video_display_carousel_button_group_layout",
"video_display_full_buttoned_short_dr_layout",
"video_display_full_layout",
"watch_metadata_app_promo"
);
final var movieAds = new StringFilterGroup(
Settings.HIDE_MOVIES_SECTION,
"browsy_bar",
"compact_movie",
"compact_tvfilm_item",
"horizontal_movie_shelf",
"movie_and_show_upsell_card",
"compact_tvfilm_item",
"offer_module_root"
);
@ -160,7 +157,6 @@ public final class AdsFilter extends Filter {
addPathCallbacks(
generalAds,
buttonedAd,
merchandise,
viewProducts,
selfSponsor,
@ -181,17 +177,19 @@ public final class AdsFilter extends Filter {
}
// Check for the index because of likelihood of false positives.
if (matchedGroup == shoppingLinks && contentIndex != 0) {
if (contentIndex != 0 && matchedGroup == shoppingLinks) {
return false;
}
if (exceptions.matches(path))
if (exceptions.matches(path)) {
return false;
}
if (matchedGroup == fullscreenAd) {
if (path.contains("|ImageType|")) closeFullscreenAd();
return false; // Do not actually filter the fullscreen ad otherwise it will leave a dimmed screen.
// Do not actually filter the fullscreen ad otherwise it will leave a dimmed screen.
return false;
}
if (matchedGroup == channelProfile) {

View File

@ -68,7 +68,6 @@ public class Settings extends BaseSettings {
public static final BooleanSetting FORCE_ORIGINAL_AUDIO = new BooleanSetting("revanced_force_original_audio", FALSE, new ForceOriginalAudioAvailability());
// 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", TRUE, true);
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);