mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-09-01 20:16:27 +02:00
fix(general-ads): block remaining ads
This commit is contained in:
parent
c3e302d224
commit
18a749f87d
@ -7,22 +7,47 @@ import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public class GeneralBytecodeAdsPatch {
|
||||
|
||||
//Used by app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
|
||||
public static boolean isAdComponent(StringBuilder pathBuilder) {
|
||||
public static boolean isAdComponent(StringBuilder pathBuilder, String identifier) {
|
||||
var path = pathBuilder.toString();
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Searching for an ad in: " + path);
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, String.format("Searching (ID: %s): %s", identifier, path));
|
||||
|
||||
if (containsAny(path,
|
||||
"home_video_with_context",
|
||||
"related_video_with_context",
|
||||
"search_video_with_context",
|
||||
"menu",
|
||||
"root",
|
||||
"-count",
|
||||
"-space",
|
||||
"-button",
|
||||
"library_recent_shelf",
|
||||
"download_button"
|
||||
)) return false;
|
||||
|
||||
List<String> blockList = new ArrayList<>();
|
||||
|
||||
if (SettingsEnum.ADREMOVER_AD_REMOVAL.getBoolean()) {
|
||||
for (var ad : SettingsEnum.ADREMOVER_CUSTOM.getString().split(",")) {
|
||||
if (ad.isEmpty()) continue;
|
||||
blockList.add(ad);
|
||||
}
|
||||
|
||||
if (SettingsEnum.ADREMOVER_GENERAL_ADS_REMOVAL.getBoolean()) {
|
||||
if (identifier != null && identifier.contains("carousel_ad")) {
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocking: " + identifier);
|
||||
return true;
|
||||
}
|
||||
|
||||
blockList.add("video_display_full_buttoned_layout");
|
||||
blockList.add("_ad");
|
||||
blockList.add("ad_");
|
||||
blockList.add("ads_video_with_context");
|
||||
blockList.add("cell_divider");
|
||||
blockList.add("reels_player_overlay");
|
||||
// could be required
|
||||
// blockList.add("full_width_square_image_layout");
|
||||
blockList.add("shelf_header");
|
||||
blockList.add("watch_metadata_app_promo");
|
||||
blockList.add("video_display_full_layout");
|
||||
@ -79,19 +104,8 @@ public class GeneralBytecodeAdsPatch {
|
||||
blockList.add("channel_guidelines_entry_banner");
|
||||
}
|
||||
|
||||
if (containsAny(path,
|
||||
"home_video_with_context",
|
||||
"related_video_with_context",
|
||||
"search_video_with_context",
|
||||
"menu",
|
||||
"root",
|
||||
"-count",
|
||||
"-space",
|
||||
"-button"
|
||||
)) return false;
|
||||
|
||||
if (anyMatch(blockList, path::contains)) {
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocking ad: " + path);
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocking: " + path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,10 @@ public enum SettingsEnum {
|
||||
ENABLE_WHITELIST("revanced_whitelist_ads_enabled", false, ReturnType.BOOLEAN),
|
||||
|
||||
//Ad settings
|
||||
ADREMOVER_CUSTOM("revanced_adremover_custom_removal", "", ReturnType.STRING, false),
|
||||
HOME_ADS_REMOVAL("revanced_home_ads_removal", true, ReturnType.BOOLEAN, true),
|
||||
VIDEO_ADS_REMOVAL("revanced_video_ads_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_AD_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_GENERAL_ADS_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN, true),
|
||||
|
Loading…
Reference in New Issue
Block a user