forked from inotia00/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube - Hide player buttons baclground): Add a switch setting …
…`Hide player buttons background`
- Loading branch information
Showing
4 changed files
with
109 additions
and
2 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
84 changes: 84 additions & 0 deletions
84
...lin/app/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch.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,84 @@ | ||
package app.revanced.patches.youtube.player.playerbuttonbg | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.PlayerPatchFingerprint | ||
import app.revanced.patches.youtube.utils.integrations.Constants.INTEGRATIONS_PATH | ||
import app.revanced.patches.youtube.utils.playerbutton.PlayerButtonHookPatch | ||
import app.revanced.patches.youtube.utils.settings.SettingsPatch | ||
import app.revanced.util.exception | ||
|
||
@Patch( | ||
name = "Hide player buttons background", | ||
description = "Adds an option to hide player buttons background. Exclude \"Force hide player buttons background\".", | ||
dependencies = [ | ||
PlayerButtonHookPatch::class, | ||
SettingsPatch::class | ||
], | ||
compatiblePackages = [ | ||
CompatiblePackage( | ||
"com.google.android.youtube", | ||
[ | ||
"18.25.40", | ||
"18.27.36", | ||
"18.29.38", | ||
"18.30.37", | ||
"18.31.40", | ||
"18.32.39", | ||
"18.33.40", | ||
"18.34.38", | ||
"18.35.36", | ||
"18.36.39", | ||
"18.37.36", | ||
"18.38.44", | ||
"18.39.41", | ||
"18.40.34", | ||
"18.41.39", | ||
"18.42.41", | ||
"18.43.45", | ||
"18.44.41", | ||
"18.45.43", | ||
"18.46.45", | ||
"18.48.39", | ||
"18.49.37", | ||
"19.01.34", | ||
"19.02.39", | ||
"19.03.36", | ||
"19.04.38", | ||
"19.05.35", | ||
"19.05.36" | ||
] | ||
) | ||
], | ||
use = false | ||
) | ||
@Suppress("unused") | ||
object HidePlayerButtonBackgroundPatch : BytecodePatch( | ||
setOf(PlayerPatchFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
|
||
PlayerPatchFingerprint.result?.mutableMethod?.addInstruction( | ||
0, | ||
"invoke-static {p0}, " + | ||
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" + | ||
"hidePlayerButtonBackground(Landroid/view/View;)V" | ||
) ?: throw PlayerPatchFingerprint.exception | ||
|
||
/** | ||
* Add settings | ||
*/ | ||
SettingsPatch.addPreference( | ||
arrayOf( | ||
"PREFERENCE: PLAYER_SETTINGS", | ||
"SETTINGS: HIDE_PLAYER_BUTTON_BACKGROUND" | ||
) | ||
) | ||
|
||
SettingsPatch.updatePatchStatus("Hide player buttons background") | ||
|
||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/PlayerPatchFingerprint.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,10 @@ | ||
package app.revanced.patches.youtube.player.playerbuttonbg.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
object PlayerPatchFingerprint : MethodFingerprint( | ||
customFingerprint = { methodDef, _ -> | ||
methodDef.definingClass == "Lapp/revanced/integrations/youtube/patches/player/PlayerPatch;" | ||
&& methodDef.name == "hidePlayerButton" | ||
} | ||
) |
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