Skip to content

Commit

Permalink
feat(Tumblr): Add Disable gift message popup patch
Browse files Browse the repository at this point in the history
  • Loading branch information
leumasme authored and oSumAtrIX committed Sep 14, 2023
1 parent 29f19b9 commit a4d6b4e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;") }
)
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit a4d6b4e

Please sign in to comment.