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.
* move patch 'fenster' to 'swipe-controls' * remove 'injectIntoNamedMethod' function * move updatePlayerType hook into its own patch * refactor 'swipe-controls' patch * add resources for new ui to patch Co-authored-by: TheJeterLP <joey.peter1998@gmail.com>
- Loading branch information
1 parent
ffe68a1
commit b7dba09
Showing
13 changed files
with
225 additions
and
153 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
121 changes: 0 additions & 121 deletions
121
src/main/kotlin/app/revanced/patches/youtube/interaction/fenster/patch/FensterPatch.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...vanced/patches/youtube/interaction/swipecontrols/annotation/SwipeControlsCompatibility.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.interaction.swipecontrols.annotation | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class SwipeControlsCompatibility |
21 changes: 21 additions & 0 deletions
21
...ed/patches/youtube/interaction/swipecontrols/fingerprints/WatchWhileOnStartFingerprint.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,21 @@ | ||
package app.revanced.patches.youtube.interaction.swipecontrols.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod | ||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility | ||
|
||
@Name("watch-while-onStart-fingerprint") | ||
@MatchingMethod( | ||
"LWatchWhileActivity;", "onCreate" | ||
) | ||
@DirectPatternScanMethod | ||
@SwipeControlsCompatibility | ||
@Version("0.0.1") | ||
object WatchWhileOnStartFingerprint : MethodFingerprint( | ||
null, null, null, null, null, { methodDef -> | ||
methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "onStart" | ||
} | ||
) |
42 changes: 42 additions & 0 deletions
42
...kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/SwipeControlsPatch.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,42 @@ | ||
package app.revanced.patches.youtube.interaction.swipecontrols.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.extensions.addInstruction | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.Dependencies | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.impl.BytecodePatch | ||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility | ||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.WatchWhileOnStartFingerprint | ||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch | ||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch | ||
|
||
@Patch | ||
@Name("swipe-controls") | ||
@Description("Adds volume and brightness swipe controls.") | ||
@SwipeControlsCompatibility | ||
@Version("0.0.2") | ||
@Dependencies( | ||
dependencies = [ | ||
IntegrationsPatch::class, | ||
PlayerTypeHookPatch::class, | ||
SwipeControlsResourcesPatch::class | ||
] | ||
) | ||
class SwipeControlsPatch : BytecodePatch( | ||
listOf( | ||
WatchWhileOnStartFingerprint | ||
) | ||
) { | ||
override fun execute(data: BytecodeData): PatchResult { | ||
WatchWhileOnStartFingerprint.result!!.mutableMethod.addInstruction( | ||
0, | ||
"invoke-static { p0 }, Lapp/revanced/integrations/patches/SwipeControlsPatch;->WatchWhileActivity_onStartHookEX(Ljava/lang/Object;)V" | ||
) | ||
return PatchResultSuccess() | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...p/revanced/patches/youtube/interaction/swipecontrols/patch/SwipeControlsResourcesPatch.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 app.revanced.patches.youtube.interaction.swipecontrols.patch | ||
|
||
import app.revanced.extensions.injectResources | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.impl.ResourceData | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.impl.ResourcePatch | ||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility | ||
|
||
@Name("swipe-controls-resource-patch") | ||
@SwipeControlsCompatibility | ||
@Version("0.0.1") | ||
class SwipeControlsResourcesPatch : ResourcePatch() { | ||
override fun execute(data: ResourceData): PatchResult { | ||
val resourcesDir = "swipecontrols" | ||
|
||
data.injectResources( | ||
this.javaClass.classLoader, | ||
resourcesDir, | ||
"drawable", | ||
listOf( | ||
"ic_sc_brightness_auto", | ||
"ic_sc_brightness_manual", | ||
"ic_sc_volume_mute", | ||
"ic_sc_volume_normal" | ||
).map { "$it.xml" } | ||
) | ||
return PatchResultSuccess() | ||
} | ||
} |
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
7 changes: 4 additions & 3 deletions
7
...ngerprints/UpdatePlayerTypeFingerprint.kt → ...ingerprint/UpdatePlayerTypeFingerprint.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
Oops, something went wrong.