diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt index 323499f69..28dba13cf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt @@ -2,8 +2,8 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.api import app.revanced.patches.reddit.customclients.infinity.api.authUtilityUserAgentMethod import app.revanced.patches.reddit.customclients.infinity.api.getClientIdMethod -import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.disablePiracyDetectionPatch import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch import app.revanced.util.returnEarly val spoofClientPatch = spoofClientPatch(redirectUri = "https://127.0.0.1:65023/authorize_callback") { clientIdOption -> diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt index aa8089358..5ad24d59f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt @@ -1,11 +1,11 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy import app.revanced.patcher.extensions.addInstruction -import app.revanced.patcher.patch.bytecodePatch - -val disablePiracyDetectionPatch = bytecodePatch { +import app.revanced.patcher.patch.creatingBytecodePatch +@Suppress("unused", "ObjectPropertyName") +val `Disable piracy detection` by creatingBytecodePatch { apply { - piracyDetectionFingerprint.method.addInstruction(0, "return-void") + piracyDetectionMethod.addInstruction(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/Fingerprints.kt index 76343a530..aaffb09ae 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/Fingerprints.kt @@ -1,21 +1,25 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy -import com.android.tools.smali.dexlib2.Opcode +import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively +import app.revanced.patcher.accessFlags +import app.revanced.patcher.definingClass +import app.revanced.patcher.instructions +import app.revanced.patcher.invoke +import app.revanced.patcher.patch.BytecodePatchContext +import app.revanced.patcher.returnType import com.android.tools.smali.dexlib2.AccessFlags -import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.Opcode -internal val piracyDetectionFingerprint = fingerprint { +internal val BytecodePatchContext.piracyDetectionMethod by gettingFirstMutableMethodDeclaratively { accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC) - returns("V") - opcodes( - Opcode.NEW_INSTANCE, - Opcode.CONST_16, - Opcode.CONST_WIDE_16, - Opcode.INVOKE_DIRECT, - Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID + returnType("V") + instructions( + Opcode.NEW_INSTANCE(), + Opcode.CONST_16(), + Opcode.CONST_WIDE_16(), + Opcode.INVOKE_DIRECT(), + Opcode.INVOKE_VIRTUAL(), + Opcode.RETURN_VOID() ) - custom { _, classDef -> - classDef.endsWith("ProcessLifeCyleListener;") - } -} \ No newline at end of file + definingClass("ProcessLifeCyleListener;"::endsWith) +}