refactor(joeyforreddit): DisablePiracyDetectionPatch

This commit is contained in:
Pun Butrach
2026-01-12 16:08:28 +07:00
parent b6c1ec7d18
commit 94cc175b55
3 changed files with 24 additions and 20 deletions

View File

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

View File

@@ -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")
}
}

View File

@@ -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;")
}
}
definingClass("ProcessLifeCyleListener;"::endsWith)
}