diff --git a/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt b/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt new file mode 100644 index 000000000..b6131554d --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/songpal/badge/fingerprints/ShowNotificationFingerprint.kt @@ -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 + ) +) diff --git a/src/main/kotlin/app/revanced/patches/songpal/badge/patch/RemoveNotificationBadgePatch.kt b/src/main/kotlin/app/revanced/patches/songpal/badge/patch/RemoveNotificationBadgePatch.kt new file mode 100644 index 000000000..3c1626867 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/songpal/badge/patch/RemoveNotificationBadgePatch.kt @@ -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() + } +}