-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(songpal): add
remove-notification-badge
patch
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...ain/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.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,31 @@ | ||
package app.revanced.patches.songpal.badge.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import org.jf.dexlib2.AccessFlags | ||
import org.jf.dexlib2.Opcode | ||
|
||
// Located @ com.sony.songpal.mdr.vim.activity.MdrRemoteBaseActivity.e#run (9.5.0) | ||
@FuzzyPatternScanMethod(2) | ||
object ShowNotificationFingerprint : MethodFingerprint( | ||
"V", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
opcodes = listOf( | ||
Opcode.IGET_OBJECT, | ||
Opcode.IGET, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.IGET_OBJECT, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CONST, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.IGET_BOOLEAN, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.CONST, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.RETURN_VOID | ||
) | ||
) |
31 changes: 31 additions & 0 deletions
31
src/main/kotlin/app/revanced/patches/songpal/badge/patch/RemoveNotificationBadgePatch.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,31 @@ | ||
package app.revanced.patches.songpal.badge.patch | ||
|
||
import app.revanced.extensions.toErrorResult | ||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patches.songpal.badge.annotations.BadgeCompatibility | ||
import app.revanced.patches.songpal.badge.fingerprints.ShowNotificationFingerprint | ||
|
||
@Patch | ||
@Name("remove-notification-badge") | ||
@Description("Removes the red notification badge from the activity tab.") | ||
@BadgeCompatibility | ||
@Version("0.0.1") | ||
class RemoveNotificationBadgePatch : BytecodePatch( | ||
listOf(ShowNotificationFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
ShowNotificationFingerprint.result?.mutableMethod?.apply { | ||
addInstructions(0, "return-void") | ||
} ?: return ShowNotificationFingerprint.toErrorResult() | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |