mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-06-12 05:07:45 +02:00
feat(Spotify): Add Unlock premium
patch (#4644)
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Co-authored-by: Brosssh <tiabroch@gmail.com>
This commit is contained in:
3
extensions/spotify/build.gradle.kts
Normal file
3
extensions/spotify/build.gradle.kts
Normal file
@ -0,0 +1,3 @@
|
||||
dependencies {
|
||||
compileOnly(project(":extensions:spotify:stub"))
|
||||
}
|
1
extensions/spotify/src/main/AndroidManifest.xml
Normal file
1
extensions/spotify/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
||||
<manifest/>
|
@ -0,0 +1,37 @@
|
||||
package app.revanced.extension.spotify.misc;
|
||||
|
||||
import com.spotify.remoteconfig.internal.AccountAttribute;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @noinspection unused
|
||||
*/
|
||||
public final class UnlockPremiumPatch {
|
||||
private static final Map<String, Object> OVERRIDES = Map.of(
|
||||
// Disables player and app ads.
|
||||
"ads", false,
|
||||
// Works along on-demand, allows playing any song without restriction.
|
||||
"player-license", "premium",
|
||||
// Disables shuffle being initially enabled when first playing a playlist.
|
||||
"shuffle", false,
|
||||
// Allows playing any song on-demand, without a shuffled order.
|
||||
"on-demand", true,
|
||||
// Allows adding songs to queue and removes the smart shuffle mode restriction,
|
||||
// allowing to pick any of the other modes.
|
||||
"pick-and-shuffle", false,
|
||||
// Disables shuffle-mode streaming-rule, which forces songs to be played shuffled
|
||||
// and breaks the player when other patches are applied.
|
||||
"streaming-rules", "",
|
||||
// Enables premium UI in settings and removes the premium button in the nav-bar.
|
||||
"nft-disabled", "1"
|
||||
);
|
||||
|
||||
public static void overrideAttribute(Map<String, AccountAttribute> attributes) {
|
||||
for (var entry : OVERRIDES.entrySet()) {
|
||||
var attribute = Objects.requireNonNull(attributes.get(entry.getKey()));
|
||||
attribute.value_ = entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
17
extensions/spotify/stub/build.gradle.kts
Normal file
17
extensions/spotify/stub/build.gradle.kts
Normal file
@ -0,0 +1,17 @@
|
||||
plugins {
|
||||
id(libs.plugins.android.library.get().pluginId)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.revanced.extension"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 26
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
}
|
1
extensions/spotify/stub/src/main/AndroidManifest.xml
Normal file
1
extensions/spotify/stub/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
||||
<manifest/>
|
@ -0,0 +1,5 @@
|
||||
package com.spotify.remoteconfig.internal;
|
||||
|
||||
public final class AccountAttribute {
|
||||
public Object value_;
|
||||
}
|
Reference in New Issue
Block a user