mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-04-30 14:44:33 +02:00
fix(Sync): Fix patches by not throwing unnecessarily
This commit is contained in:
parent
0c75929a83
commit
2ee13160d5
@ -10,6 +10,6 @@ val disablePiracyDetectionPatch = bytecodePatch(
|
||||
execute {
|
||||
// Do not throw an error if the fingerprint is not resolved.
|
||||
// This is fine because new versions of the target app do not need this patch.
|
||||
piracyDetectionFingerprint.method.addInstruction(0, "return-void")
|
||||
piracyDetectionFingerprint.methodOrNull?.addInstruction(0, "return-void")
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package app.revanced.patches.reddit.customclients.sync.detection.piracy
|
||||
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.instructions
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.util.getReference
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||
|
||||
internal val piracyDetectionFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
|
||||
@ -16,12 +18,9 @@ internal val piracyDetectionFingerprint = fingerprint {
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
)
|
||||
custom { method, _ ->
|
||||
method.implementation?.instructions?.any {
|
||||
if (it.opcode != Opcode.NEW_INSTANCE) return@any false
|
||||
|
||||
val reference = (it as ReferenceInstruction).reference
|
||||
|
||||
reference.toString() == "Lcom/github/javiersantos/piracychecker/PiracyChecker;"
|
||||
} == true
|
||||
method.implementation ?: return@custom false
|
||||
method.instructions.any {
|
||||
it.getReference<Reference>()?.toString() == "Lcom/github/javiersantos/piracychecker/PiracyChecker;"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user