diff --git a/api/revanced-patches.api b/api/revanced-patches.api index 1555a149..8df98dba 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -418,8 +418,14 @@ public final class app/revanced/patches/photomath/detection/signature/SignatureD public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/photomath/misc/unlockplus/UnlockPlusPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/photomath/misc/unlockplus/UnlockPlusPatch; +public final class app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + +public final class app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt new file mode 100644 index 00000000..14755590 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt @@ -0,0 +1,26 @@ +package app.revanced.patches.photomath.misc.annoyances + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch +import app.revanced.patches.photomath.misc.annoyances.fingerprints.HideUpdatePopupFingerprint +import app.revanced.util.exception + +@Patch( + name = "Hide update popup", + description = "Prevents the update popup from showing up.", + dependencies = [SignatureDetectionPatch::class], + compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])] +) +@Suppress("unused") +object HideUpdatePopupPatch : BytecodePatch( + setOf(HideUpdatePopupFingerprint) +) { + override fun execute(context: BytecodeContext) = HideUpdatePopupFingerprint.result?.mutableMethod?.addInstructions( + 2, // Insert after the null check. + "return-void" + ) ?: throw HideUpdatePopupFingerprint.exception +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/fingerprints/HideUpdatePopupFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/fingerprints/HideUpdatePopupFingerprint.kt new file mode 100644 index 00000000..f57666b6 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/fingerprints/HideUpdatePopupFingerprint.kt @@ -0,0 +1,22 @@ +package app.revanced.patches.photomath.misc.annoyances.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode + +internal object HideUpdatePopupFingerprint : MethodFingerprint( + customFingerprint = { _, classDef -> + // The popup is shown only in the main activity + classDef.type == "Lcom/microblink/photomath/main/activity/MainActivity;" + }, + opcodes = listOf( + Opcode.CONST_HIGH16, + Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.alpha(1.0f) + Opcode.MOVE_RESULT_OBJECT, + Opcode.CONST_WIDE_16, + Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.setDuration(1000L) + ), + accessFlags = AccessFlags.FINAL or AccessFlags.PUBLIC, + returnType = "V", +) diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/EnableBookpointPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt similarity index 81% rename from src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/EnableBookpointPatch.kt rename to src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt index f3dc575e..6d12d0e2 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/EnableBookpointPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt @@ -1,11 +1,11 @@ -package app.revanced.patches.photomath.misc.bookpoint +package app.revanced.patches.photomath.misc.unlock.bookpoint import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.photomath.misc.bookpoint.fingerprints.IsBookpointEnabledFingerprint +import app.revanced.patches.photomath.misc.unlock.bookpoint.fingerprints.IsBookpointEnabledFingerprint @Patch(description = "Enables textbook access") internal object EnableBookpointPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt similarity index 85% rename from src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt rename to src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt index 0a60647a..e5ae3c2d 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/fingerprints/IsBookpointEnabledFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.photomath.misc.bookpoint.fingerprints +package app.revanced.patches.photomath.misc.unlock.bookpoint.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/UnlockPlusPatch.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt similarity index 80% rename from src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/UnlockPlusPatch.kt rename to src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt index 15ec53ab..8895696c 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/UnlockPlusPatch.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.photomath.misc.unlockplus +package app.revanced.patches.photomath.misc.unlock.plus import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext @@ -7,8 +7,8 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch -import app.revanced.patches.photomath.misc.bookpoint.EnableBookpointPatch -import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlockedFingerprint +import app.revanced.patches.photomath.misc.unlock.bookpoint.EnableBookpointPatch +import app.revanced.patches.photomath.misc.unlock.plus.fingerprints.IsPlusUnlockedFingerprint @Patch( name = "Unlock plus", diff --git a/src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/fingerprints/IsPlusUnlockedFingerprint.kt b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt similarity index 86% rename from src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/fingerprints/IsPlusUnlockedFingerprint.kt rename to src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt index 72db0e6b..2ab140b1 100644 --- a/src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/fingerprints/IsPlusUnlockedFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/fingerprints/IsPlusUnlockedFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.photomath.misc.unlockplus.fingerprints +package app.revanced.patches.photomath.misc.unlock.plus.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint