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:
disable-fullscreen-panels
patch
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...nced/patches/youtube/layout/fullscreenpanels/annotations/FullscreenPanelsCompatibility.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 app.revanced.patches.youtube.layout.fullscreenpanels.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.23.35") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class FullscreenPanelsCompatibility |
38 changes: 38 additions & 0 deletions
38
...pp/revanced/patches/youtube/layout/fullscreenpanels/patch/FullscreenPanelsRemoverPatch.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,38 @@ | ||
package app.revanced.patches.youtube.layout.fullscreenpanels.patch | ||
|
||
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.data.implementation.proxy | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.implementation.BytecodePatch | ||
import app.revanced.patcher.patch.implementation.misc.PatchResult | ||
import app.revanced.patcher.patch.implementation.misc.PatchResultError | ||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess | ||
import app.revanced.patcher.util.smali.toInstructions | ||
import app.revanced.patcher.extensions.addInstructions | ||
import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.FullscreenPanelsCompatibility | ||
|
||
@Patch | ||
@Name("disable-fullscreen-panels") | ||
@Description("Disable fullscreen panels") | ||
@FullscreenPanelsCompatibility | ||
@Version("0.0.1") | ||
class FullscreenPanelsRemovalPatch : BytecodePatch(listOf()) { | ||
override fun execute(data: BytecodeData): PatchResult { | ||
val classDef = data.classes.first { it.type.endsWith("FullscreenEngagementPanelOverlay;") } | ||
val method = data.proxy(classDef).resolve().methods.first { it.name == "<init>" } | ||
val implementation = method.implementation!! | ||
|
||
implementation.addInstructions( | ||
implementation.instructions.count() - 1, | ||
""" | ||
const/4 v1, 0x0 | ||
iput-boolean v1, v0, ${classDef.type}->a:Z | ||
""".trimIndent().toInstructions("", 2, true)) | ||
|
||
|
||
return PatchResultSuccess() | ||
} | ||
} |