From cdec438fd4f4939462ad5467d460b51679276d06 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 12 Jan 2026 15:59:23 +0700 Subject: [PATCH] refactor(joeyforreddit): DisableAdsPatch --- .../joeyforreddit/ads/DisableAdsPatch.kt | 9 ++++----- .../joeyforreddit/ads/Fingerprints.kt | 14 +++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt index 25db4840b..e93bc20c4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt @@ -2,18 +2,17 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.ads import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.creatingBytecodePatch import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.disablePiracyDetectionPatch -@Suppress("unused") -val disableAdsPatch = bytecodePatch( - name = "Disable ads", -) { +@Suppress("unused", "ObjectPropertyName") +val `Disable ads` by creatingBytecodePatch { dependsOn(disablePiracyDetectionPatch) compatibleWith("o.o.joey") apply { - isAdFreeUserFingerprint.method.addInstructions( + isAdFreeUserMethod.addInstructions( 0, """ const/4 v0, 0x1 diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/Fingerprints.kt index 465faf120..da1c7a574 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/Fingerprints.kt @@ -1,10 +1,14 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.ads +import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively +import app.revanced.patcher.accessFlags +import app.revanced.patcher.patch.BytecodePatchContext +import app.revanced.patcher.returnType +import app.revanced.patcher.string import com.android.tools.smali.dexlib2.AccessFlags -import app.revanced.patcher.fingerprint -internal val isAdFreeUserFingerprint = fingerprint { +internal val BytecodePatchContext.isAdFreeUserMethod by gettingFirstMutableMethodDeclaratively { accessFlags(AccessFlags.PUBLIC) - returns("Z") - strings("AD_FREE_USER") -} \ No newline at end of file + returnType("Z") + string("AD_FREE_USER") +}