feat(Tumblr): Add Disable gift message popup patch

This commit is contained in:
Temm 2023-09-14 00:12:36 +02:00 committed by oSumAtrIX
parent 29f19b9378
commit a4d6b4e5ce
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,9 @@
package app.revanced.patches.tumblr.annoyances.popups.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
// This method is responsible for loading and displaying the visual Layout of the Gift Message Popup.
object ShowGiftMessagePopupFingerprint : MethodFingerprint(
strings = listOf("activity", "anchorView"),
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("GiftMessagePopup;") }
)

View File

@ -0,0 +1,24 @@
package app.revanced.patches.tumblr.annoyances.popups.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tumblr.annoyances.popups.fingerprints.ShowGiftMessagePopupFingerprint
@Patch
@Name("Disable gift message popup")
@Description("Disables the popup suggesting to buy TumblrMart items for other people.")
@Compatibility([Package("com.tumblr")])
class DisableGiftMessagePopupPatch : BytecodePatch(
listOf(ShowGiftMessagePopupFingerprint)
) {
override fun execute(context: BytecodeContext) =
ShowGiftMessagePopupFingerprint.result?.mutableMethod?.addInstructions(0, "return-void")
?: throw ShowGiftMessagePopupFingerprint.exception
}