Skip to content

Commit 37e59d2

Browse files
fix(YouTube - Hide ads): Hide new type of general ad (#5004)
1 parent 48b2e08 commit 37e59d2

File tree

4 files changed

+28
-35
lines changed

4 files changed

+28
-35
lines changed

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/AdsFilter.java

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,48 +64,45 @@ public AdsFilter() {
6464
"_interstitial"
6565
);
6666

67-
final var buttonedAd = new StringFilterGroup(
68-
Settings.HIDE_BUTTONED_ADS,
67+
final var generalAds = new StringFilterGroup(
68+
Settings.HIDE_GENERAL_ADS,
6969
"_ad_with",
7070
"_buttoned_layout",
71+
"ads_video_with_context",
72+
"banner_text_icon",
73+
"brand_video_shelf",
74+
"brand_video_singleton",
75+
"carousel_footered_layout",
76+
"carousel_headered_layout",
77+
"compact_landscape_image_layout", // Tablet layout search results.
78+
"composite_concurrent_carousel_layout",
79+
"full_width_portrait_image_layout",
80+
"full_width_square_image_carousel_layout",
81+
"full_width_square_image_layout",
82+
"hero_promo_image",
7183
// text_image_button_group_layout, landscape_image_button_group_layout, full_width_square_image_button_group_layout
7284
"image_button_group_layout",
73-
"full_width_square_image_layout",
74-
"video_display_button_group_layout",
7585
"landscape_image_wide_button_layout",
76-
"video_display_carousel_button_group_layout",
77-
"video_display_full_buttoned_short_dr_layout",
78-
"compact_landscape_image_layout", // Tablet layout search results.
79-
"text_image_no_button_layout" // Tablet layout search results.
80-
);
81-
82-
final var generalAds = new StringFilterGroup(
83-
Settings.HIDE_GENERAL_ADS,
84-
"ads_video_with_context",
85-
"banner_text_icon",
86+
"primetime_promo",
87+
"product_details",
8688
"square_image_layout",
87-
"watch_metadata_app_promo",
88-
"video_display_full_layout",
89-
"hero_promo_image",
9089
"statement_banner",
91-
"carousel_footered_layout",
9290
"text_image_button_layout",
93-
"primetime_promo",
94-
"product_details",
95-
"composite_concurrent_carousel_layout",
96-
"carousel_headered_layout",
97-
"full_width_portrait_image_layout",
98-
"brand_video_shelf",
99-
"brand_video_singleton"
91+
"text_image_no_button_layout", // Tablet layout search results.
92+
"video_display_button_group_layout",
93+
"video_display_carousel_button_group_layout",
94+
"video_display_full_buttoned_short_dr_layout",
95+
"video_display_full_layout",
96+
"watch_metadata_app_promo"
10097
);
10198

10299
final var movieAds = new StringFilterGroup(
103100
Settings.HIDE_MOVIES_SECTION,
104101
"browsy_bar",
105102
"compact_movie",
103+
"compact_tvfilm_item",
106104
"horizontal_movie_shelf",
107105
"movie_and_show_upsell_card",
108-
"compact_tvfilm_item",
109106
"offer_module_root"
110107
);
111108

@@ -160,7 +157,6 @@ public AdsFilter() {
160157

161158
addPathCallbacks(
162159
generalAds,
163-
buttonedAd,
164160
merchandise,
165161
viewProducts,
166162
selfSponsor,
@@ -181,17 +177,19 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
181177
}
182178

183179
// Check for the index because of likelihood of false positives.
184-
if (matchedGroup == shoppingLinks && contentIndex != 0) {
180+
if (contentIndex != 0 && matchedGroup == shoppingLinks) {
185181
return false;
186182
}
187183

188-
if (exceptions.matches(path))
184+
if (exceptions.matches(path)) {
189185
return false;
186+
}
190187

191188
if (matchedGroup == fullscreenAd) {
192189
if (path.contains("|ImageType|")) closeFullscreenAd();
193190

194-
return false; // Do not actually filter the fullscreen ad otherwise it will leave a dimmed screen.
191+
// Do not actually filter the fullscreen ad otherwise it will leave a dimmed screen.
192+
return false;
195193
}
196194

197195
if (matchedGroup == channelProfile) {

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class Settings extends BaseSettings {
6868
public static final BooleanSetting FORCE_ORIGINAL_AUDIO = new BooleanSetting("revanced_force_original_audio", FALSE, new ForceOriginalAudioAvailability());
6969

7070
// Ads
71-
public static final BooleanSetting HIDE_BUTTONED_ADS = new BooleanSetting("revanced_hide_buttoned_ads", TRUE);
7271
public static final BooleanSetting HIDE_END_SCREEN_STORE_BANNER = new BooleanSetting("revanced_hide_end_screen_store_banner", TRUE, true);
7372
public static final BooleanSetting HIDE_FULLSCREEN_ADS = new BooleanSetting("revanced_hide_fullscreen_ads", TRUE);
7473
public static final BooleanSetting HIDE_GENERAL_ADS = new BooleanSetting("revanced_hide_general_ads", TRUE);

patches/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ private val hideAdsResourcePatch = resourcePatch {
4646
SwitchPreference("revanced_hide_general_ads"),
4747
SwitchPreference("revanced_hide_end_screen_store_banner"),
4848
SwitchPreference("revanced_hide_fullscreen_ads"),
49-
SwitchPreference("revanced_hide_buttoned_ads"),
5049
SwitchPreference("revanced_hide_paid_promotion_label"),
5150
SwitchPreference("revanced_hide_player_store_shelf"),
5251
SwitchPreference("revanced_hide_self_sponsor_ads"),

patches/src/main/resources/addresources/values/strings.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,6 @@ Limitations
427427

428428
This feature is only available for older devices"</string>
429429
<string name="revanced_hide_fullscreen_ads_summary_off">Fullscreen ads are shown</string>
430-
<string name="revanced_hide_buttoned_ads_title">Hide buttoned ads</string>
431-
<string name="revanced_hide_buttoned_ads_summary_on">Buttoned ads are hidden</string>
432-
<string name="revanced_hide_buttoned_ads_summary_off">Buttoned ads are shown</string>
433430
<string name="revanced_hide_paid_promotion_label_title">Hide paid promotion label</string>
434431
<string name="revanced_hide_paid_promotion_label_summary_on">Paid promotion label is hidden</string>
435432
<string name="revanced_hide_paid_promotion_label_summary_off">Paid promotion label is shown</string>

0 commit comments

Comments
 (0)