generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Tumblr): Add
Disable blog notification reminder
patch
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...ed/patches/tumblr/annoyances/notifications/fingerprints/IsBlogNotifyEnabledFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) |
30 changes: 30 additions & 0 deletions
30
...ced/patches/tumblr/annoyances/notifications/patch/DisableBlogNotificationReminderPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |