Skip to content

Commit

Permalink
feat(Tumblr): Add Disable blog notification reminder 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 bb6983b commit 29f19b9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.revanced.patches.tumblr.annoyances.notifications.fingerprints

import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

// The BlogNotifyCtaDialog asks you if you want to enable notifications for a blog.
// It shows whenever you visit a certain blog for the second time and disables itself
// if it was shown a total of 3 times (stored in app storage).
// This targets the BlogNotifyCtaDialog.isEnabled() method to let it always return false.
object IsBlogNotifyEnabledFingerprint : MethodFingerprint(strings = listOf("isEnabled --> ", "blog_notify_enabled"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package app.revanced.patches.tumblr.annoyances.notifications.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.notifications.fingerprints.IsBlogNotifyEnabledFingerprint

@Patch
@Name("Disable blog notification reminder")
@Description("Disables the reminder to enable notifications for blogs you visit.")
@Compatibility([Package("com.tumblr")])
class DisableBlogNotificationReminderPatch : BytecodePatch(
listOf(IsBlogNotifyEnabledFingerprint)
) {
override fun execute(context: BytecodeContext) =
IsBlogNotifyEnabledFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
# Return false for BlogNotifyCtaDialog.isEnabled() method.
const/4 v0, 0x0
return v0
"""
) ?: throw IsBlogNotifyEnabledFingerprint.exception
}

0 comments on commit 29f19b9

Please sign in to comment.