From d1ceca39984f7933b28d81802d04bb3ead327595 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 1 Jun 2024 19:52:43 +0400 Subject: [PATCH] feat(YouTube Music): Support version `7.03` (#3272) --- .../patches/music/ad/video/HideMusicVideoAds.kt | 13 ++++++++++++- .../music/audio/codecs/CodecsUnlockPatch.kt | 13 ++++++++++++- .../EnableExclusiveAudioPlayback.kt | 13 ++++++++++++- .../permanentrepeat/PermanentRepeatPatch.kt | 15 +++++++++++++-- .../fingerprints/RepeatTrackFingerprint.kt | 13 ++++++------- .../permanentshuffle/PermanentShufflePatch.kt | 13 ++++++++++++- .../music/layout/compactheader/HideCategoryBar.kt | 13 ++++++++++++- .../minimizedplayback/MinimizedPlaybackPatch.kt | 13 ++++++++++++- .../music/layout/premium/HideGetPremiumPatch.kt | 13 ++++++++++++- .../upgradebutton/RemoveUpgradeButtonPatch.kt | 13 ++++++++++++- .../androidauto/BypassCertificateChecksPatch.kt | 13 ++++++++++++- .../patches/music/misc/gms/GmsCoreSupportPatch.kt | 13 ++++++++++++- 12 files changed, 139 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt index 6f533c2f9..eddec5b90 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt @@ -11,7 +11,18 @@ import app.revanced.util.exception @Patch( name = "Hide music video ads", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], ) @Suppress("unused") object HideMusicVideoAds : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt index 0c1cbebc6..8559376cd 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/CodecsUnlockPatch.kt @@ -11,7 +11,18 @@ import com.android.tools.smali.dexlib2.Opcode @Patch( description = "Adds more audio codec options. The new audio codecs usually result in better audio quality.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Deprecated("This patch is no longer needed as the feature is now enabled by default.") object CodecsUnlockPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt index 79f3fc0f1..3b3a7637b 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt @@ -11,7 +11,18 @@ import app.revanced.util.exception @Patch( name = "Enable exclusive audio playback", description = "Enables the option to play audio without video.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object EnableExclusiveAudioPlayback : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt index 257f43eef..73e7c4587 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt @@ -13,7 +13,18 @@ import app.revanced.patches.music.interaction.permanentrepeat.fingerprints.Repea @Patch( name = "Permanent repeat", description = "Permanently remember your repeating preference even if the playlist ends or another track is played.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], use = false ) @Suppress("unused") @@ -23,7 +34,7 @@ object PermanentRepeatPatch : BytecodePatch( override fun execute(context: BytecodeContext) { RepeatTrackFingerprint.result?.let { val startIndex = it.scanResult.patternScanResult!!.endIndex - val repeatIndex = startIndex + 3 + val repeatIndex = startIndex + 1 it.mutableMethod.apply { addInstructionsWithLabels( diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt index 4567f0fe7..8d71fa629 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/fingerprints/RepeatTrackFingerprint.kt @@ -6,17 +6,16 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode internal object RepeatTrackFingerprint : MethodFingerprint( - "V", - AccessFlags.PUBLIC or AccessFlags.FINAL, - listOf("L", "L"), - listOf( - Opcode.CHECK_CAST, - Opcode.INVOKE_INTERFACE, + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = listOf("L", "L"), + opcodes = listOf( Opcode.IGET_OBJECT, Opcode.IGET_OBJECT, Opcode.SGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, Opcode.IF_NEZ - ) + ), + strings = listOf("w_st") ) diff --git a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt index 88dff320e..72ac52dd4 100644 --- a/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt @@ -12,7 +12,18 @@ import app.revanced.util.exception name = "Permanent shuffle", description = "Permanently remember your shuffle preference " + "even if the playlist ends or another track is played.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], use = false, ) @Suppress("unused") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt index 0cc8e9493..9db0a9ca7 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt @@ -13,7 +13,18 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Hide category bar", description = "Hides the category bar at the top of the homepage.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ], use = false, ) @Suppress("unused") diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt index f2ec33523..918e08f2f 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt @@ -13,7 +13,18 @@ import app.revanced.util.exception @Patch( name = "Minimized playback", description = "Unlocks options for picture-in-picture and background playback.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object MinimizedPlaybackPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt index 4475dafce..50fc512cb 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt @@ -16,7 +16,18 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( name = "Hide 'Get Music Premium' label", description = "Hides the \"Get Music Premium\" label from the account menu and settings.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object HideGetPremiumPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt index fed2cc6db..feca2a3b9 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt @@ -22,7 +22,18 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference @Patch( name = "Remove upgrade button", description = "Removes the upgrade tab from the pivot bar.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object RemoveUpgradeButtonPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt index a06203de5..d09055396 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt @@ -12,7 +12,18 @@ import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificate @Patch( name = "Bypass certificate checks", description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.", - compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ] + ) + ] ) @Suppress("unused") object BypassCertificateChecksPatch : BytecodePatch(setOf(CheckCertificateFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt index 3c99992fc..311aeb11f 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt @@ -23,7 +23,18 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( mainActivityOnCreateFingerprint = MusicActivityOnCreateFingerprint, integrationsPatchDependency = IntegrationsPatch::class, gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch, - compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")), + compatiblePackages = setOf( + CompatiblePackage( + "com.google.android.apps.youtube.music", + setOf( + "6.45.54", + "6.51.53", + "7.01.53", + "7.02.52", + "7.03.52", + ) + ) + ), fingerprints = setOf( ServiceCheckFingerprint, GooglePlayUtilityFingerprint,