refactor(photomath): HideUpdatePopupPatch
This commit is contained in:
parent
70328c5a65
commit
be005c533a
2 changed files with 22 additions and 18 deletions
|
|
@ -1,21 +1,25 @@
|
||||||
package app.revanced.patches.photomath.misc.annoyances
|
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.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.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal val hideUpdatePopupFingerprint = fingerprint {
|
internal val BytecodePatchContext.hideUpdatePopupMethod by gettingFirstMutableMethodDeclaratively {
|
||||||
accessFlags(AccessFlags.FINAL, AccessFlags.PUBLIC)
|
accessFlags(AccessFlags.FINAL, AccessFlags.PUBLIC)
|
||||||
returns("V")
|
returnType("V")
|
||||||
opcodes(
|
definingClass("Lcom/microblink/photomath/main/activity/MainActivity;")
|
||||||
Opcode.CONST_HIGH16,
|
instructions(
|
||||||
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.alpha(1.0f)
|
Opcode.CONST_HIGH16(),
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.INVOKE_VIRTUAL(), // ViewPropertyAnimator.alpha(1.0f)
|
||||||
Opcode.CONST_WIDE_16,
|
Opcode.MOVE_RESULT_OBJECT(),
|
||||||
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.setDuration(1000L)
|
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
|
package app.revanced.patches.photomath.misc.annoyances
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||||
import app.revanced.patches.photomath.detection.signature.signatureDetectionPatch
|
import app.revanced.patches.photomath.detection.signature.`Signature detection`
|
||||||
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val hideUpdatePopupPatch = bytecodePatch(
|
val `Hide update popup` by creatingBytecodePatch(
|
||||||
name = "Hide update popup",
|
|
||||||
description = "Prevents the update popup from showing up.",
|
description = "Prevents the update popup from showing up.",
|
||||||
) {
|
) {
|
||||||
dependsOn(signatureDetectionPatch)
|
dependsOn(`Signature detection`)
|
||||||
|
|
||||||
compatibleWith("com.microblink.photomath")
|
compatibleWith("com.microblink.photomath")
|
||||||
|
|
||||||
apply {
|
apply {
|
||||||
hideUpdatePopupFingerprint.method.addInstructions(
|
hideUpdatePopupMethod.addInstructions(
|
||||||
2, // Insert after the null check.
|
2, // Insert after the null check.
|
||||||
"return-void",
|
"return-void",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue