refactor(photomath): UnlockPlusPatch

This commit is contained in:
Pun Butrach
2026-01-12 17:26:27 +07:00
parent f4a04e7917
commit bce0a745db
2 changed files with 17 additions and 16 deletions

View File

@@ -1,13 +1,16 @@
package app.revanced.patches.photomath.misc.unlock.plus
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.accessFlags
import app.revanced.patcher.definingClass
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 isPlusUnlockedFingerprint = fingerprint {
internal val BytecodePatchContext.isPlusUnlockedMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z")
strings("genius")
custom { _, classDef ->
classDef.endsWith("/User;")
}
}
returnType("Z")
string("genius")
definingClass("/User;"::endsWith)
}

View File

@@ -1,20 +1,18 @@
package app.revanced.patches.photomath.misc.unlock.plus
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.photomath.detection.signature.signatureDetectionPatch
import app.revanced.patches.photomath.misc.unlock.bookpoint.enableBookpointPatch
import app.revanced.patcher.patch.creatingBytecodePatch
import app.revanced.patches.photomath.detection.signature.`Signature detection`
import app.revanced.patches.photomath.misc.unlock.bookpoint.`Enable bookpoint`
@Suppress("unused")
val unlockPlusPatch = bytecodePatch(
name = "Unlock plus",
) {
dependsOn(signatureDetectionPatch, enableBookpointPatch)
val `Unlock plus` by creatingBytecodePatch {
dependsOn(`Signature detection`, `Enable bookpoint`)
compatibleWith("com.microblink.photomath")
apply {
isPlusUnlockedFingerprint.method.addInstructions(
isPlusUnlockedMethod.addInstructions(
0,
"""
const/4 v0, 0x1