@@ -2,32 +2,27 @@ package app.revanced.patches.nunl.ads
2
2
3
3
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
4
4
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
5
+ import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
5
6
import app.revanced.patcher.patch.bytecodePatch
6
7
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
8
+ import app.revanced.util.indexOfFirstInstructionOrThrow
9
+ import com.android.tools.smali.dexlib2.Opcode
7
10
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
8
11
9
12
@Suppress(" unused" )
10
13
val hideAdsPatch = bytecodePatch(
11
14
name = " Hide ads" ,
12
15
description = " Hide ads and sponsored articles in list pages and remove pre-roll ads on videos." ,
13
16
) {
14
- compatibleWith(" nl.sanomamedia.android.nu" (" 11.0.0 " , " 11.0.1 " , " 11.1 .0" ))
17
+ compatibleWith(" nl.sanomamedia.android.nu" (" 11.3 .0" ))
15
18
16
19
dependsOn(sharedExtensionPatch(" nunl" , mainActivityOnCreateHook))
17
20
18
21
execute {
19
22
// Disable video pre-roll ads.
20
- // 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.
21
- jwUtilCreateAdvertisementFingerprint.method.addInstructions(
22
- 0 ,
23
- """
24
- new-instance v0, Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig${' $' } Builder;
25
- invoke-direct { v0 }, Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig${' $' } Builder;-><init>()V
26
- invoke-virtual { v0 }, Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig${' $' } Builder;->build()Lcom/jwplayer/pub/api/configuration/ads/VastAdvertisingConfig;
27
- move-result-object v0
28
- return-object v0
29
- """ ,
30
- )
23
+ // Whenever the app tries to define the advertising config for JWPlayer, don't set the advertising config and directly return.
24
+ val iputInstructionIndex = jwPlayerConfigFingerprint.method.indexOfFirstInstructionOrThrow(Opcode .IPUT_OBJECT )
25
+ jwPlayerConfigFingerprint.method.removeInstructions(iputInstructionIndex, 1 )
31
26
32
27
// Filter injected content from API calls out of lists.
33
28
arrayOf(screenMapperFingerprint, nextPageRepositoryImplFingerprint).forEach {
0 commit comments