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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 36 deletions

View File

@ -64,48 +64,45 @@ public final class AdsFilter extends Filter {
"_interstitial" "_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( final var generalAds = new StringFilterGroup(
Settings.HIDE_GENERAL_ADS, Settings.HIDE_GENERAL_ADS,
"_ad_with",
"_buttoned_layout",
"ads_video_with_context", "ads_video_with_context",
"banner_text_icon", "banner_text_icon",
"square_image_layout", "brand_video_shelf",
"watch_metadata_app_promo", "brand_video_singleton",
"video_display_full_layout",
"hero_promo_image",
"statement_banner",
"carousel_footered_layout", "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", "primetime_promo",
"product_details", "product_details",
"composite_concurrent_carousel_layout", "square_image_layout",
"carousel_headered_layout", "statement_banner",
"full_width_portrait_image_layout", "text_image_button_layout",
"brand_video_shelf", "text_image_no_button_layout", // Tablet layout search results.
"brand_video_singleton" "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( final var movieAds = new StringFilterGroup(
Settings.HIDE_MOVIES_SECTION, Settings.HIDE_MOVIES_SECTION,
"browsy_bar", "browsy_bar",
"compact_movie", "compact_movie",
"compact_tvfilm_item",
"horizontal_movie_shelf", "horizontal_movie_shelf",
"movie_and_show_upsell_card", "movie_and_show_upsell_card",
"compact_tvfilm_item",
"offer_module_root" "offer_module_root"
); );
@ -160,7 +157,6 @@ public final class AdsFilter extends Filter {
addPathCallbacks( addPathCallbacks(
generalAds, generalAds,
buttonedAd,
merchandise, merchandise,
viewProducts, viewProducts,
selfSponsor, selfSponsor,
@ -181,17 +177,19 @@ public final class AdsFilter extends Filter {
} }
// Check for the index because of likelihood of false positives. // Check for the index because of likelihood of false positives.
if (matchedGroup == shoppingLinks && contentIndex != 0) { if (contentIndex != 0 && matchedGroup == shoppingLinks) {
return false; return false;
} }
if (exceptions.matches(path)) if (exceptions.matches(path)) {
return false; return false;
}
if (matchedGroup == fullscreenAd) { if (matchedGroup == fullscreenAd) {
if (path.contains("|ImageType|")) closeFullscreenAd(); 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) { 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()); public static final BooleanSetting FORCE_ORIGINAL_AUDIO = new BooleanSetting("revanced_force_original_audio", FALSE, new ForceOriginalAudioAvailability());
// Ads // 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_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_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_GENERAL_ADS = new BooleanSetting("revanced_hide_general_ads", TRUE);

View File

@ -46,7 +46,6 @@ private val hideAdsResourcePatch = resourcePatch {
SwitchPreference("revanced_hide_general_ads"), SwitchPreference("revanced_hide_general_ads"),
SwitchPreference("revanced_hide_end_screen_store_banner"), SwitchPreference("revanced_hide_end_screen_store_banner"),
SwitchPreference("revanced_hide_fullscreen_ads"), SwitchPreference("revanced_hide_fullscreen_ads"),
SwitchPreference("revanced_hide_buttoned_ads"),
SwitchPreference("revanced_hide_paid_promotion_label"), SwitchPreference("revanced_hide_paid_promotion_label"),
SwitchPreference("revanced_hide_player_store_shelf"), SwitchPreference("revanced_hide_player_store_shelf"),
SwitchPreference("revanced_hide_self_sponsor_ads"), SwitchPreference("revanced_hide_self_sponsor_ads"),

View File

@ -427,9 +427,6 @@ Limitations
This feature is only available for older devices"</string> This feature is only available for older devices"</string>
<string name="revanced_hide_fullscreen_ads_summary_off">Fullscreen ads are shown</string> <string name="revanced_hide_fullscreen_ads_summary_off">Fullscreen ads are shown</string>
<string name="revanced_hide_buttoned_ads_title">Hide buttoned ads</string>
<string name="revanced_hide_buttoned_ads_summary_on">Buttoned ads are hidden</string>
<string name="revanced_hide_buttoned_ads_summary_off">Buttoned ads are shown</string>
<string name="revanced_hide_paid_promotion_label_title">Hide paid promotion label</string> <string name="revanced_hide_paid_promotion_label_title">Hide paid promotion label</string>
<string name="revanced_hide_paid_promotion_label_summary_on">Paid promotion label is hidden</string> <string name="revanced_hide_paid_promotion_label_summary_on">Paid promotion label is hidden</string>
<string name="revanced_hide_paid_promotion_label_summary_off">Paid promotion label is shown</string> <string name="revanced_hide_paid_promotion_label_summary_off">Paid promotion label is shown</string>