mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-19 00:53:57 +00:00
refactor(photomath): HideUpdatePopupPatch
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
package app.revanced.patches.photomath.misc.annoyances
|
||||
|
||||
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.definingClass
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val hideUpdatePopupFingerprint = fingerprint {
|
||||
internal val BytecodePatchContext.hideUpdatePopupMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.FINAL, AccessFlags.PUBLIC)
|
||||
returns("V")
|
||||
opcodes(
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.alpha(1.0f)
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CONST_WIDE_16,
|
||||
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.setDuration(1000L)
|
||||
returnType("V")
|
||||
definingClass("Lcom/microblink/photomath/main/activity/MainActivity;")
|
||||
instructions(
|
||||
Opcode.CONST_HIGH16(),
|
||||
Opcode.INVOKE_VIRTUAL(), // ViewPropertyAnimator.alpha(1.0f)
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
Opcode.CONST_WIDE_16(),
|
||||
Opcode.INVOKE_VIRTUAL(), // ViewPropertyAnimator.setDuration(1000L)
|
||||
)
|
||||
custom { method, _ ->
|
||||
// The popup is shown only in the main activity
|
||||
method.definingClass == "Lcom/microblink/photomath/main/activity/MainActivity;"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package app.revanced.patches.photomath.misc.annoyances
|
||||
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.photomath.detection.signature.signatureDetectionPatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.photomath.detection.signature.`Signature detection`
|
||||
|
||||
|
||||
@Suppress("unused")
|
||||
val hideUpdatePopupPatch = bytecodePatch(
|
||||
name = "Hide update popup",
|
||||
val `Hide update popup` by creatingBytecodePatch(
|
||||
description = "Prevents the update popup from showing up.",
|
||||
) {
|
||||
dependsOn(signatureDetectionPatch)
|
||||
dependsOn(`Signature detection`)
|
||||
|
||||
compatibleWith("com.microblink.photomath")
|
||||
|
||||
apply {
|
||||
hideUpdatePopupFingerprint.method.addInstructions(
|
||||
hideUpdatePopupMethod.addInstructions(
|
||||
2, // Insert after the null check.
|
||||
"return-void",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user