chore: migrate to new changes from the patcher
This commit is contained in:
@ -3,14 +3,14 @@ package app.revanced.patches.spotify.audio.bytecode.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
||||
@ -36,7 +36,7 @@ class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
||||
|
||||
// Replace constant that contains the capture policy parameter for AudioAttributesBuilder.setAllowedCapturePolicy()
|
||||
|
@ -2,16 +2,12 @@ package app.revanced.patches.spotify.audio.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||
|
||||
@Name("disable-capture-restriction-audio-driver-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lcom/spotify/playback/playbacknative/AudioDriver;", "constructAudioAttributes"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
|
||||
@DisableCaptureRestrictionCompatibility
|
||||
@Version("0.0.1")
|
||||
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
||||
|
@ -3,23 +3,21 @@ package app.revanced.patches.spotify.audio.resource.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.ResourceData
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Name("disable-capture-restriction-resource-patch")
|
||||
@Description("Sets allowAudioPlaybackCapture in manifest to true.")
|
||||
@DisableCaptureRestrictionCompatibility
|
||||
@Version("0.0.1")
|
||||
class DisableCaptureRestrictionResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
class DisableCaptureRestrictionResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
// create an xml editor instance
|
||||
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||
context.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||
// get the application node
|
||||
val applicationNode = dom
|
||||
.file
|
||||
|
@ -3,14 +3,10 @@ package app.revanced.patches.spotify.layout.theme.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.ResourceData
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||
import app.revanced.patches.spotify.layout.theme.annotations.ThemeCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import org.w3c.dom.Element
|
||||
@ -21,9 +17,9 @@ import org.w3c.dom.Element
|
||||
@Description("Applies a custom theme.")
|
||||
@ThemeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ThemePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
data.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||
class ThemePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
|
||||
for (i in 0 until resourcesNode.childNodes.length) {
|
||||
|
@ -3,14 +3,14 @@ package app.revanced.patches.spotify.premium_navbar_tab.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility
|
||||
import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabFingerprint
|
||||
import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabParentFingerprint
|
||||
@ -29,9 +29,9 @@ class PremiumNavbarTabPatch : BytecodePatch(
|
||||
AddPremiumNavbarTabParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val parentResult = AddPremiumNavbarTabParentFingerprint.result!!
|
||||
AddPremiumNavbarTabFingerprint.resolve(data, parentResult.classDef)
|
||||
AddPremiumNavbarTabFingerprint.resolve(context, parentResult.classDef)
|
||||
|
||||
val result = AddPremiumNavbarTabFingerprint.result!!
|
||||
|
||||
@ -39,7 +39,8 @@ class PremiumNavbarTabPatch : BytecodePatch(
|
||||
val methodInstructions = method.implementation!!.instructions
|
||||
val lastInstructionIdx = methodInstructions.size - 1
|
||||
|
||||
val premiumTabId = ResourceMappingResourcePatch.resourceMappings.single{it.type == "id" && it.name == "premium_tab"}.id
|
||||
val premiumTabId =
|
||||
ResourceMappingResourcePatch.resourceMappings.single { it.type == "id" && it.name == "premium_tab" }.id
|
||||
|
||||
var removeAmount = 2
|
||||
// 2nd const remove method
|
||||
|
Reference in New Issue
Block a user