Skip to content

Commit

Permalink
feat(YouTube - Hide player buttons baclground): Add a switch setting …
Browse files Browse the repository at this point in the history
…`Hide player buttons background`
  • Loading branch information
anddea committed Mar 26, 2024
1 parent b7d50ec commit 5271610
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 2 deletions.
14 changes: 12 additions & 2 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -2554,12 +2554,22 @@ public final class app/revanced/patches/youtube/player/musicbutton/fingerprints/
public static final field INSTANCE Lapp/revanced/patches/youtube/player/musicbutton/fingerprints/MusicAppDeeplinkButtonFingerprint;
}

public final class app/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch : app/revanced/patcher/patch/ResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch;
public final class app/revanced/patches/youtube/player/playerbuttonbg/ForceHidePlayerButtonBackgroundPatch : app/revanced/patcher/patch/ResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/ForceHidePlayerButtonBackgroundPatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public final class app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/PlayerPatchFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/fingerprints/PlayerPatchFingerprint;
}

public final class app/revanced/patches/youtube/player/playeroverlay/CustomPlayerOverlayOpacityPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playeroverlay/CustomPlayerOverlayOpacityPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down
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")

}
}
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"
}
)
3 changes: 3 additions & 0 deletions src/main/resources/youtube/settings/host/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ Some components may not be hidden."</string>
<string name="revanced_hide_place_section_summary_off">Place sections are shown.</string>
<string name="revanced_hide_place_section_summary_on">Place sections are hidden.</string>
<string name="revanced_hide_place_section_title">Hide place sections</string>
<string name="revanced_hide_player_button_background_summary_off">Player buttons background is shown.</string>
<string name="revanced_hide_player_button_background_summary_on">Player buttons background is hidden.</string>
<string name="revanced_hide_player_button_background_title">Hide player buttons background</string>
<string name="revanced_hide_player_flyout_panel_ambient_mode_summary_off">Ambient mode menu is shown.</string>
<string name="revanced_hide_player_flyout_panel_ambient_mode_summary_on">Ambient mode menu is hidden.</string>
<string name="revanced_hide_player_flyout_panel_ambient_mode_title">Hide ambient mode menu</string>
Expand Down

0 comments on commit 5271610

Please sign in to comment.