generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: MinimizedPlayback, CreateButtonRemover
- Loading branch information
Showing
4 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
package net.revanced.patches | ||
|
||
import net.revanced.patches.ads.VideoAds | ||
import net.revanced.patches.layouts.CreateButtonRemover | ||
import net.revanced.patches.layouts.MinimizedPlayback | ||
|
||
// This object contains all the patches and should be imported when using this library | ||
object Index { | ||
// Array of patches. New patches should be added to the array | ||
val patches = arrayOf( | ||
VideoAds::class | ||
VideoAds::class, | ||
MinimizedPlayback::class, | ||
CreateButtonRemover::class | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/net/revanced/patches/layouts/CreateButtonRemover.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package net.revanced.patches.layouts | ||
|
||
import net.revanced.patcher.cache.Cache | ||
import net.revanced.patcher.patch.Patch | ||
import net.revanced.patcher.patch.PatchResult | ||
import net.revanced.patcher.patch.PatchResultSuccess | ||
import net.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() | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/net/revanced/patches/layouts/MinimizedPlayback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.revanced.patches.layouts | ||
|
||
import net.revanced.patcher.cache.Cache | ||
import net.revanced.patcher.patch.Patch | ||
import net.revanced.patcher.patch.PatchResult | ||
import net.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() | ||
} | ||
} |