mirror of
https://github.com/revanced/revanced-patches
synced 2024-09-01 20:15:45 +02:00
feat(Tumblr): Add Disable blog notification reminder
patch
This commit is contained in:
parent
bb6983bf66
commit
29f19b9378
@ -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"))
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user