feat(Spotify - Unlock Premium): Disable the "Spotify Premium" upsell experiment in context menus

This commit is contained in:
oSumAtrIX 2025-03-27 01:40:43 +01:00
parent 43b2a1e158
commit 9a10ee4d22
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 14 additions and 0 deletions

View File

@ -16,3 +16,8 @@ internal val productStateProtoFingerprint = fingerprint {
internal val buildQueryParametersFingerprint = fingerprint { internal val buildQueryParametersFingerprint = fingerprint {
strings("trackRows", "device_type:tablet") strings("trackRows", "device_type:tablet")
} }
internal val contextMenuExperimentsFingerprint = fingerprint {
parameters("L")
strings("remove_ads_upsell_enabled")
}

View File

@ -1,9 +1,11 @@
package app.revanced.patches.spotify.misc package app.revanced.patches.spotify.misc
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Suppress("unused") @Suppress("unused")
val unlockPremiumPatch = bytecodePatch( val unlockPremiumPatch = bytecodePatch(
@ -32,5 +34,12 @@ val unlockPremiumPatch = bytecodePatch(
// Add the query parameter trackRows to show popular tracks in the artist page. // Add the query parameter trackRows to show popular tracks in the artist page.
val addQueryParameterIndex = buildQueryParametersFingerprint.stringMatches!!.first().index - 1 val addQueryParameterIndex = buildQueryParametersFingerprint.stringMatches!!.first().index - 1
buildQueryParametersFingerprint.method.replaceInstruction(addQueryParameterIndex, "nop") buildQueryParametersFingerprint.method.replaceInstruction(addQueryParameterIndex, "nop")
// Disable the "Spotify Premium" upsell experiment in context menus.
with(contextMenuExperimentsFingerprint) {
val moveIsEnabledIndex = stringMatches!!.first().index + 2
val isUpsellEnabledRegister = method.getInstruction<OneRegisterInstruction>(moveIsEnabledIndex).registerA
method.replaceInstruction(moveIsEnabledIndex, "const/4 v$isUpsellEnabledRegister, 0")
}
} }
} }