mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-05-20 16:27:11 +02:00
feat(NU.nl): Support version 11.3.0
(#4925)
This commit is contained in:
parent
845084d187
commit
bedde60fc1
@ -82,7 +82,7 @@ public class HideAdsPatch {
|
|||||||
|
|
||||||
// Filter HeaderBlock with known ads until next HeaderBlock.
|
// Filter HeaderBlock with known ads until next HeaderBlock.
|
||||||
if (currentBlock instanceof HeaderBlock headerBlock) {
|
if (currentBlock instanceof HeaderBlock headerBlock) {
|
||||||
StyledText headerText = headerBlock.component20();
|
StyledText headerText = headerBlock.getTitle();
|
||||||
if (headerText != null) {
|
if (headerText != null) {
|
||||||
skipFullHeader = false;
|
skipFullHeader = false;
|
||||||
for (String blockedHeaderBlock : blockedHeaderBlocks) {
|
for (String blockedHeaderBlock : blockedHeaderBlocks) {
|
||||||
|
@ -3,8 +3,7 @@ package nl.nu.performance.api.client.objects;
|
|||||||
import nl.nu.performance.api.client.interfaces.Block;
|
import nl.nu.performance.api.client.interfaces.Block;
|
||||||
|
|
||||||
public class HeaderBlock extends Block {
|
public class HeaderBlock extends Block {
|
||||||
// returns title
|
public final StyledText getTitle() {
|
||||||
public final StyledText component20() {
|
|
||||||
throw new UnsupportedOperationException("Stub");
|
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.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal val jwUtilCreateAdvertisementFingerprint = fingerprint {
|
internal val jwPlayerConfigFingerprint = fingerprint {
|
||||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
|
accessFlags(AccessFlags.PUBLIC)
|
||||||
custom { methodDef, classDef ->
|
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.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
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
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@ -11,23 +14,15 @@ val hideAdsPatch = bytecodePatch(
|
|||||||
name = "Hide ads",
|
name = "Hide ads",
|
||||||
description = "Hide ads and sponsored articles in list pages and remove pre-roll ads on videos.",
|
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))
|
dependsOn(sharedExtensionPatch("nunl", mainActivityOnCreateHook))
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
// Disable video pre-roll ads.
|
// 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.
|
// Whenever the app tries to define the advertising config for JWPlayer, don't set the advertising config and directly return.
|
||||||
jwUtilCreateAdvertisementFingerprint.method.addInstructions(
|
val iputInstructionIndex = jwPlayerConfigFingerprint.method.indexOfFirstInstructionOrThrow(Opcode.IPUT_OBJECT)
|
||||||
0,
|
jwPlayerConfigFingerprint.method.removeInstructions(iputInstructionIndex, 1)
|
||||||
"""
|
|
||||||
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
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
|
|
||||||
// Filter injected content from API calls out of lists.
|
// Filter injected content from API calls out of lists.
|
||||||
arrayOf(screenMapperFingerprint, nextPageRepositoryImplFingerprint).forEach {
|
arrayOf(screenMapperFingerprint, nextPageRepositoryImplFingerprint).forEach {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user