feat(Photomath): Add Hide update popup patch (#2637)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>

BREAKING CHANGE: Some packages have changed locations.
This commit is contained in:
Marko 2024-01-27 02:57:22 +01:00 committed by GitHub
parent d5dde1610f
commit fbbecd33bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 63 additions and 9 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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