chore: migrate to new changes from the patcher
This commit is contained in:
+7
-7
@@ -3,13 +3,13 @@ package app.revanced.patches.youtube.layout.castbutton.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.addInstructions
|
||||
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.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.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@@ -23,7 +23,7 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Swit
|
||||
@CastButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCastButtonPatch : BytecodePatch() {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_cast_button_enabled",
|
||||
@@ -34,11 +34,11 @@ class HideCastButtonPatch : BytecodePatch() {
|
||||
)
|
||||
)
|
||||
|
||||
data.classes.forEach { classDef ->
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
|
||||
val setVisibilityMethod =
|
||||
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }
|
||||
context.proxy(classDef).mutableClass.methods.first { it.name == "setVisibility" }
|
||||
|
||||
setVisibilityMethod.addInstructions(
|
||||
0, """
|
||||
|
||||
Reference in New Issue
Block a user