mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-07 12:47:02 +01:00
feat(general-ads): block carousel ad
This commit is contained in:
parent
c548f1651a
commit
26c208e9ed
@ -1,5 +1,7 @@
|
|||||||
package app.revanced.integrations.patches;
|
package app.revanced.integrations.patches;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ final class LithoBlockRegister {
|
|||||||
|
|
||||||
public class GeneralBytecodeAdsPatch {
|
public class GeneralBytecodeAdsPatch {
|
||||||
private final static LithoBlockRegister pathBlockRegister = new LithoBlockRegister();
|
private final static LithoBlockRegister pathBlockRegister = new LithoBlockRegister();
|
||||||
|
private final static ComponentRule identifierBlock;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
var comments = new ComponentRule(SettingsEnum.ADREMOVER_COMMENTS_REMOVAL, "comments_");
|
var comments = new ComponentRule(SettingsEnum.ADREMOVER_COMMENTS_REMOVAL, "comments_");
|
||||||
@ -80,7 +83,6 @@ public class GeneralBytecodeAdsPatch {
|
|||||||
"_ad",
|
"_ad",
|
||||||
"ad_",
|
"ad_",
|
||||||
"ads_video_with_context",
|
"ads_video_with_context",
|
||||||
"carousel_ad_with_detailed_metadata",
|
|
||||||
"cell_divider",
|
"cell_divider",
|
||||||
"reels_player_overlay",
|
"reels_player_overlay",
|
||||||
"shelf_header",
|
"shelf_header",
|
||||||
@ -114,14 +116,17 @@ public class GeneralBytecodeAdsPatch {
|
|||||||
channelGuidelines
|
channelGuidelines
|
||||||
};
|
};
|
||||||
for (var block : blocks) pathBlockRegister.addBlock(block);
|
for (var block : blocks) pathBlockRegister.addBlock(block);
|
||||||
|
|
||||||
|
// Block for the ComponentContext.identifier field
|
||||||
|
identifierBlock = new ComponentRule(SettingsEnum.ADREMOVER_GENERAL_ADS_REMOVAL, "carousel_ad");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Used by app.revanced.patches.youtube.ad.general.bytecode.patch.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();
|
var path = pathBuilder.toString();
|
||||||
if (path.isEmpty()) return false;
|
if (path.isEmpty()) return false;
|
||||||
|
|
||||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, String.format("Searching: %s", path));
|
LogHelper.debug(GeneralBytecodeAdsPatch.class, String.format("Searching (ID: %s): %s", identifier, path));
|
||||||
// Do not block on these
|
// Do not block on these
|
||||||
if (Extensions.containsAny(path,
|
if (Extensions.containsAny(path,
|
||||||
"home_video_with_context",
|
"home_video_with_context",
|
||||||
@ -141,6 +146,11 @@ public class GeneralBytecodeAdsPatch {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (identifierBlock.isBlocked(identifier)){
|
||||||
|
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocked: " + identifier);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user