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:
oSumAtrIX
2025-03-26 04:24:47 +01:00
committed by GitHub
parent bae80204c4
commit f048c50e56
11 changed files with 125 additions and 52 deletions

View File

@ -0,0 +1,3 @@
dependencies {
compileOnly(project(":extensions:spotify:stub"))
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -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();
}
}
}

View 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
}
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -0,0 +1,5 @@
package com.spotify.remoteconfig.internal;
public final class AccountAttribute {
public Object value_;
}