Skip to content

Commit 1fe3a52

Browse files
authored
feat(Willhaben): Add Hide ads patch (ReVanced#3740)
1 parent 8f3acbe commit 1fe3a52

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

api/revanced-patches.api

+6
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,12 @@ public final class app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnloc
15201520
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
15211521
}
15221522

1523+
public final class app/revanced/patches/willhaben/ads/HideAdsPatch : app/revanced/patcher/patch/BytecodePatch {
1524+
public static final field INSTANCE Lapp/revanced/patches/willhaben/ads/HideAdsPatch;
1525+
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
1526+
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
1527+
}
1528+
15231529
public final class app/revanced/patches/windyapp/misc/unlockpro/UnlockProPatch : app/revanced/patcher/patch/BytecodePatch {
15241530
public static final field INSTANCE Lapp/revanced/patches/windyapp/misc/unlockpro/UnlockProPatch;
15251531
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package app.revanced.patches.willhaben.ads
2+
3+
import app.revanced.patcher.data.BytecodeContext
4+
import app.revanced.patcher.patch.BytecodePatch
5+
import app.revanced.patcher.patch.annotation.CompatiblePackage
6+
import app.revanced.patcher.patch.annotation.Patch
7+
import app.revanced.patches.willhaben.ads.fingerprints.AdResolverFingerprint
8+
import app.revanced.patches.willhaben.ads.fingerprints.WHAdViewInjectorFingerprint
9+
import app.revanced.util.returnEarly
10+
11+
@Patch(
12+
name = "Hide ads",
13+
description = "Hides all in-app ads.",
14+
compatiblePackages = [CompatiblePackage("at.willhaben")]
15+
)
16+
@Suppress("unused")
17+
object HideAdsPatch : BytecodePatch(
18+
fingerprints = setOf(
19+
AdResolverFingerprint,
20+
WHAdViewInjectorFingerprint
21+
)
22+
) {
23+
override fun execute(context: BytecodeContext) {
24+
arrayOf(AdResolverFingerprint, WHAdViewInjectorFingerprint).forEach {
25+
it.returnEarly()
26+
}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package app.revanced.patches.willhaben.ads.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.patcher.fingerprint.MethodFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object AdResolverFingerprint : MethodFingerprint(
8+
"L",
9+
parameters = listOf("L", "L"),
10+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
11+
strings = listOf(
12+
"Google Ad is invalid ",
13+
"Google Native Ad is invalid ",
14+
"Criteo Ad is invalid ",
15+
"Amazon Ad is invalid "
16+
)
17+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package app.revanced.patches.willhaben.ads.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.patcher.fingerprint.MethodFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object WHAdViewInjectorFingerprint : MethodFingerprint(
8+
"V",
9+
parameters = listOf("L", "L", "L", "Z"),
10+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
11+
strings = listOf("successfulAdView"),
12+
customFingerprint = { _, classDef ->
13+
classDef.type == "Lat/willhaben/advertising/WHAdView;"
14+
}
15+
)

0 commit comments

Comments
 (0)