mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2025-05-11 13:15:39 +02:00
Merge 89fe41f0e3
into 25e7dc1568
This commit is contained in:
commit
7c02cbbb9d
4 changed files with 12 additions and 18 deletions
|
@ -82,7 +82,7 @@ public class HideAdsPatch {
|
|||
|
||||
// Filter HeaderBlock with known ads until next HeaderBlock.
|
||||
if (currentBlock instanceof HeaderBlock headerBlock) {
|
||||
StyledText headerText = headerBlock.component20();
|
||||
StyledText headerText = headerBlock.getTitle();
|
||||
if (headerText != null) {
|
||||
skipFullHeader = false;
|
||||
for (String blockedHeaderBlock : blockedHeaderBlocks) {
|
||||
|
|
|
@ -3,8 +3,7 @@ package nl.nu.performance.api.client.objects;
|
|||
import nl.nu.performance.api.client.interfaces.Block;
|
||||
|
||||
public class HeaderBlock extends Block {
|
||||
// returns title
|
||||
public final StyledText component20() {
|
||||
public final StyledText getTitle() {
|
||||
throw new UnsupportedOperationException("Stub");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ import app.revanced.patcher.fingerprint
|
|||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val jwUtilCreateAdvertisementFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
|
||||
internal val jwPlayerConfigFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC)
|
||||
custom { methodDef, classDef ->
|
||||
classDef.type == "Lnl/sanomamedia/android/nu/video/util/JWUtil;" && methodDef.name == "createAdvertising"
|
||||
classDef.type == "Lcom/jwplayer/pub/api/configuration/PlayerConfig${'$'}Builder;" && methodDef.name == "advertisingConfig"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,11 @@ package app.revanced.patches.nunl.ads
|
|||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Suppress("unused")
|
||||
|
@ -11,23 +14,15 @@ val hideAdsPatch = bytecodePatch(
|
|||
name = "Hide ads",
|
||||
description = "Hide ads and sponsored articles in list pages and remove pre-roll ads on videos.",
|
||||
) {
|
||||
compatibleWith("nl.sanomamedia.android.nu"("11.0.0", "11.0.1", "11.1.0"))
|
||||
compatibleWith("nl.sanomamedia.android.nu"("11.3.0"))
|
||||
|
||||
dependsOn(sharedExtensionPatch("nunl", mainActivityOnCreateHook))
|
||||
|
||||
execute {
|
||||
// Disable video pre-roll ads.
|
||||
// Whenever the app tries to create an ad via JWUtils.createAdvertising, don't actually tell the underlying JWPlayer library to do so => JWPlayer will not display ads.
|
||||
jwUtilCreateAdvertisementFingerprint.method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
new-instance v0, Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig${'$'}Builder;
|
||||
invoke-direct { v0 }, Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig${'$'}Builder;-><init>()V
|
||||
invoke-virtual { v0 }, Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig${'$'}Builder;->build()Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig;
|
||||
move-result-object v0
|
||||
return-object v0
|
||||
""",
|
||||
)
|
||||
// Whenever the app tries to define the advertising config for JWPlayer, don't set the advertising config and directly return.
|
||||
val iputInstructionIndex = jwPlayerConfigFingerprint.method.indexOfFirstInstructionOrThrow(Opcode.IPUT_OBJECT)
|
||||
jwPlayerConfigFingerprint.method.removeInstructions(iputInstructionIndex, 1)
|
||||
|
||||
// Filter injected content from API calls out of lists.
|
||||
arrayOf(screenMapperFingerprint, nextPageRepositoryImplFingerprint).forEach {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue