mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
refactor: Rename net.revanced
to app.revanced
BREAKING CHANGE: Package name was changed from "net.revanced" to "app.revanced"
This commit is contained in:
23
src/main/kotlin/app/revanced/patches/Index.kt
Normal file
23
src/main/kotlin/app/revanced/patches/Index.kt
Normal file
@ -0,0 +1,23 @@
|
||||
package app.revanced.patches
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patches.ads.VideoAds
|
||||
import app.revanced.patches.layouts.CreateButtonRemover
|
||||
import app.revanced.patches.layouts.MinimizedPlayback
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Index contains all the patches and should be imported when using this library.
|
||||
*/
|
||||
@Suppress("Unused")
|
||||
object Index {
|
||||
/**
|
||||
* Array of patches.
|
||||
* New patches should be added to the array.
|
||||
*/
|
||||
val patches: Array<KClass<out Patch>> = arrayOf(
|
||||
VideoAds::class,
|
||||
MinimizedPlayback::class,
|
||||
CreateButtonRemover::class
|
||||
)
|
||||
}
|
41
src/main/kotlin/app/revanced/patches/ads/VideoAds.kt
Normal file
41
src/main/kotlin/app/revanced/patches/ads/VideoAds.kt
Normal file
@ -0,0 +1,41 @@
|
||||
package app.revanced.patches.ads
|
||||
|
||||
import app.revanced.patcher.cache.Cache
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.Signature
|
||||
import app.revanced.patcher.writer.ASMWriter.insertAt
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
import org.objectweb.asm.tree.MethodInsnNode
|
||||
import org.objectweb.asm.tree.VarInsnNode
|
||||
|
||||
class VideoAds : Patch("VideoAds") {
|
||||
override fun execute(cache: Cache): PatchResult {
|
||||
val showVideoAdsMethodData = cache.methods["show-video-ads"].findParentMethod(
|
||||
Signature(
|
||||
"method",
|
||||
Type.VOID_TYPE,
|
||||
Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL,
|
||||
arrayOf(Type.BOOLEAN_TYPE),
|
||||
null
|
||||
)
|
||||
) ?: return PatchResultError("Could not find required method to patch")
|
||||
|
||||
showVideoAdsMethodData.method.instructions.insertAt(
|
||||
0,
|
||||
VarInsnNode(Opcodes.ISTORE, 1),
|
||||
MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"fi/vanced/libraries/youtube/whitelisting/Whitelist",
|
||||
"shouldShowAds",
|
||||
Type.getMethodDescriptor(Type.BOOLEAN_TYPE)
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package app.revanced.patches.layouts
|
||||
|
||||
import app.revanced.patcher.cache.Cache
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.writer.ASMWriter.insertAt
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.tree.MethodInsnNode
|
||||
import org.objectweb.asm.tree.VarInsnNode
|
||||
|
||||
class CreateButtonRemover : Patch("create-button-remover") {
|
||||
override fun execute(cache: Cache): PatchResult {
|
||||
val patchData = cache.methods["create-button-patch"]
|
||||
|
||||
patchData.method.instructions.insertAt(
|
||||
patchData.scanData.endIndex - 1,
|
||||
VarInsnNode(
|
||||
Opcodes.ALOAD,
|
||||
6
|
||||
),
|
||||
MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"fi/razerman/youtube/XAdRemover",
|
||||
"hideCreateButton",
|
||||
"(Landroid/view/View;)V"
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.layouts
|
||||
|
||||
import app.revanced.patcher.cache.Cache
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
||||
class MinimizedPlayback : Patch("minimized-playback") {
|
||||
override fun execute(cache: Cache): PatchResult {
|
||||
cache.methods["minimized-playback-manager"].method.instructions.clear()
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user