From 968dfde7a840622b520303d12957be23fa629ec2 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 12 Jan 2026 15:42:53 +0700 Subject: [PATCH] refactor(boostforreddit): DisableAdsPatch --- .../boostforreddit/ads/DisableAdsPatch.kt | 12 +++++------- .../boostforreddit/ads/Fingerprints.kt | 15 ++++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt index 5ffab44fc..f96c75505 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt @@ -1,17 +1,15 @@ package app.revanced.patches.reddit.customclients.boostforreddit.ads import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.creatingBytecodePatch -@Suppress("unused") -val disableAdsPatch = bytecodePatch( - name = "Disable ads", -) { +@Suppress("unused", "ObjectPropertyName") +val `Disable ads` by creatingBytecodePatch { compatibleWith("com.rubenmayayo.reddit") apply { - arrayOf(maxMediationFingerprint, admobMediationFingerprint).forEach { fingerprint -> - fingerprint.method.addInstructions(0, "return-void") + arrayOf(maxMediationMethod, admobMediationMethod).forEach { method -> + method.addInstructions(0, "return-void") } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/Fingerprints.kt index 618e2f145..475d10bdf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/Fingerprints.kt @@ -1,11 +1,12 @@ package app.revanced.patches.reddit.customclients.boostforreddit.ads -import app.revanced.patcher.fingerprint +import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively +import app.revanced.patcher.patch.BytecodePatchContext -internal val maxMediationFingerprint = fingerprint { - strings("MaxMediation: Attempting to initialize SDK") -} +internal val BytecodePatchContext.maxMediationMethod by gettingFirstMutableMethodDeclaratively( + "MaxMediation: Attempting to initialize SDK" +) -internal val admobMediationFingerprint = fingerprint { - strings("AdmobMediation: Attempting to initialize SDK") -} +internal val BytecodePatchContext.admobMediationMethod by gettingFirstMutableMethodDeclaratively( + "AdmobMediation: Attempting to initialize SDK" +)