refactor(joeyforreddit): DisableAdsPatch

This commit is contained in:
Pun Butrach
2026-01-12 15:59:23 +07:00
parent 555b6fe3ca
commit cdec438fd4
2 changed files with 13 additions and 10 deletions

View File

@@ -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

View File

@@ -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")
}
returnType("Z")
string("AD_FREE_USER")
}