From ca4f9601712d04a4b021ddf20127ab727e86af45 Mon Sep 17 00:00:00 2001 From: xC3FFF0E <78732474+xC3FFF0E@users.noreply.github.com> Date: Fri, 28 Mar 2025 18:52:23 +0800 Subject: [PATCH] fix(Spotify - Unlock Premium): Override additional attributes (#4651) Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> --- extensions/spotify/build.gradle.kts | 13 +++++++++++++ patches/api/patches.api | 4 ++++ .../spotify/layout/theme/CustomThemePatch.kt | 1 + .../spotify/misc/extension/ExtensionPatch.kt | 5 +++++ .../patches/spotify/misc/extension/Hooks.kt | 10 ++++++++++ 5 files changed, 33 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/ExtensionPatch.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt diff --git a/extensions/spotify/build.gradle.kts b/extensions/spotify/build.gradle.kts index 07cce9e23..4a5ce935d 100644 --- a/extensions/spotify/build.gradle.kts +++ b/extensions/spotify/build.gradle.kts @@ -1,3 +1,16 @@ dependencies { + compileOnly(project(":extensions:shared:library")) compileOnly(project(":extensions:spotify:stub")) + compileOnly(libs.annotation) +} + +android { + defaultConfig { + minSdk = 24 + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } } diff --git a/patches/api/patches.api b/patches/api/patches.api index f84f9113e..f933fdf66 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -820,6 +820,10 @@ public final class app/revanced/patches/spotify/misc/UnlockPremiumPatchKt { public static final fun getUnlockPremiumPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/spotify/misc/extension/ExtensionPatchKt { + public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/spotify/misc/fix/SpoofSignaturePatchKt { public static final fun getSpoofSignaturePatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt index 28d48e010..8af9d65fb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt @@ -10,6 +10,7 @@ import org.w3c.dom.Element val customThemePatch = resourcePatch( name = "Custom theme", description = "Applies a custom theme.", + use = false, ) { compatibleWith("com.spotify.music") diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/ExtensionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/ExtensionPatch.kt new file mode 100644 index 000000000..6b95f437a --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/ExtensionPatch.kt @@ -0,0 +1,5 @@ +package app.revanced.patches.spotify.misc.extension + +import app.revanced.patches.shared.misc.extension.sharedExtensionPatch + +val sharedExtensionPatch = sharedExtensionPatch("spotify", spotifyMainActivityOnCreate) diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt new file mode 100644 index 000000000..baed926ea --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/extension/Hooks.kt @@ -0,0 +1,10 @@ +package app.revanced.patches.spotify.misc.extension + +import app.revanced.patches.shared.misc.extension.extensionHook + +internal val spotifyMainActivityOnCreate = extensionHook { + custom { method, classDef -> + classDef.type == "Lcom/spotify/music/SpotifyMainActivity;" && + method.name == "onCreate" + } +}