refactor: Migrate to new extension methods for String.toInstruction(...) and String.toInstructions(...) (#45)

This commit is contained in:
Itroublve
2022-06-23 02:22:42 +02:00
committed by GitHub
parent 9094a69be8
commit 579297efa3
13 changed files with 31 additions and 38 deletions
@@ -4,10 +4,10 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.reels.signatures.HideReelsSignature
@@ -23,13 +23,12 @@ class HideReelsPatch : BytecodePatch(
) {
override fun execute(data: BytecodeData): PatchResult {
val result = HideReelsSignature.result!!
val implementation = result.method.implementation!!
// HideReel will hide the reel view before it is being used,
// so we pass the view to the HideReel method
implementation.addInstruction(
result.method.addInstruction(
result.scanResult.endIndex,
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction()
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V"
)
return PatchResultSuccess()