refactor(photomath): EnableBookpointPatch

This commit is contained in:
Pun Butrach 2026-01-12 17:25:01 +07:00
parent be005c533a
commit f4a04e7917
2 changed files with 20 additions and 13 deletions

View file

@ -1,14 +1,15 @@
package app.revanced.patches.photomath.misc.unlock.bookpoint package app.revanced.patches.photomath.misc.unlock.bookpoint
import app.revanced.patcher.extensions.replaceInstructions import app.revanced.patcher.extensions.replaceInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.creatingBytecodePatch
val enableBookpointPatch = bytecodePatch( @Suppress("unused")
val `Enable bookpoint` by creatingBytecodePatch(
description = "Enables textbook access", description = "Enables textbook access",
) { ) {
apply { apply {
isBookpointEnabledFingerprint.method.replaceInstructions( isBookpointEnabledMethod.replaceInstructions(
0, 0,
""" """
const/4 v0, 0x1 const/4 v0, 0x1

View file

@ -1,16 +1,22 @@
package app.revanced.patches.photomath.misc.unlock.bookpoint package app.revanced.patches.photomath.misc.unlock.bookpoint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.accessFlags
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.parameterTypes
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import app.revanced.patcher.fingerprint
internal val isBookpointEnabledFingerprint = fingerprint { internal val BytecodePatchContext.isBookpointEnabledMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z") returnType("Z")
parameters() parameterTypes()
strings( instructions(
"NoGeoData", "NoGeoData"(),
"NoCountryInGeo", "NoCountryInGeo"(),
"RemoteConfig", "RemoteConfig"(),
"GeoRCMismatch" "GeoRCMismatch"()
) )
} }