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:
parent
66a2ee2416
commit
5c5a1e4b8b
9 changed files with 52 additions and 52 deletions
|
|
@ -0,0 +1,18 @@
|
|||
package app.revanced.patches.spotify.misc
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal val accountAttributeFingerprint = fingerprint {
|
||||
custom { _, c -> c.endsWith("internal/AccountAttribute;") }
|
||||
}
|
||||
|
||||
internal val productStateProtoFingerprint = fingerprint {
|
||||
returns("Ljava/util/Map;")
|
||||
custom { _, classDef ->
|
||||
classDef.endsWith("ProductStateProto;")
|
||||
}
|
||||
}
|
||||
|
||||
internal val buildQueryParametersFingerprint = fingerprint {
|
||||
strings("trackRows", "device_type:tablet")
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package app.revanced.patches.spotify.navbar
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.util.literal
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal val addNavBarItemFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returns("V")
|
||||
literal { showBottomNavigationItemsTextId }
|
||||
}
|
||||
|
|
@ -1,50 +1,12 @@
|
|||
package app.revanced.patches.spotify.navbar
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
import app.revanced.patches.shared.misc.mapping.get
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
||||
|
||||
internal var showBottomNavigationItemsTextId = -1L
|
||||
private set
|
||||
internal var premiumTabId = -1L
|
||||
private set
|
||||
|
||||
private val premiumNavbarTabResourcePatch = resourcePatch {
|
||||
dependsOn(resourceMappingPatch)
|
||||
|
||||
execute {
|
||||
premiumTabId = resourceMappings["id", "premium_tab"]
|
||||
|
||||
showBottomNavigationItemsTextId = resourceMappings[
|
||||
"bool",
|
||||
"show_bottom_navigation_items_text",
|
||||
]
|
||||
}
|
||||
}
|
||||
import app.revanced.patches.spotify.misc.unlockPremiumPatch
|
||||
|
||||
@Deprecated("Superseded by unlockPremiumPatch", ReplaceWith("unlockPremiumPatch"))
|
||||
@Suppress("unused")
|
||||
val premiumNavbarTabPatch = bytecodePatch(
|
||||
name = "Premium navbar tab",
|
||||
description = "Hides the premium tab from the navigation bar.",
|
||||
) {
|
||||
dependsOn(premiumNavbarTabResourcePatch)
|
||||
|
||||
compatibleWith("com.spotify.music")
|
||||
|
||||
// If the navigation bar item is the premium tab, do not add it.
|
||||
execute {
|
||||
addNavBarItemFingerprint.method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const v1, $premiumTabId
|
||||
if-ne p5, v1, :continue
|
||||
return-void
|
||||
:continue
|
||||
nop
|
||||
""",
|
||||
)
|
||||
}
|
||||
dependsOn(unlockPremiumPatch)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue