diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/quickactions/patch/QuickActionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/quickactions/patch/QuickActionsPatch.kt new file mode 100644 index 000000000..518fb7da7 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/quickactions/patch/QuickActionsPatch.kt @@ -0,0 +1,86 @@ +package app.revanced.patches.youtube.layout.fullscreen.quickactions.patch + +import app.revanced.patcher.annotation.Description +import app.revanced.patcher.annotation.Name +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.extensions.addInstructions +import app.revanced.patcher.extensions.instruction +import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch +import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch +import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch +import app.revanced.util.integrations.Constants.FULLSCREEN + +@Patch +@Name("hide-quick-actions") +@Description("Adds the options to hide quick actions components in the fullscreen.") +@DependsOn( + [ + LithoFilterPatch::class, + PlayerTypeHookPatch::class, + SettingsPatch::class + ] +) +@YouTubeCompatibility +@Version("0.0.1") +class QuickActionsPatch : ResourcePatch { + override fun execute(context: ResourceContext): PatchResult { + + val instructionList = + """ + move-object/from16 v3, p2 + invoke-static {v3, v10}, $FULLSCREEN->hideQuickActionButtons(Ljava/lang/Object;Ljava/nio/ByteBuffer;)Z + move-result v10 + if-eqz v10, :do_not_block + move-object/from16 v15, p1 + invoke-static {v15}, ${LithoFilterPatch.builderMethodDescriptor} + move-result-object v0 + iget-object v0, v0, ${LithoFilterPatch.emptyComponentFieldDescriptor} + return-object v0 + """ + + with(LithoFilterPatch.lithoMethod) { + if (LithoFilterPatch.bufferFingerprintResolved) { + // 18.11.36+ + addInstructions( + 0, """ + move-object/from16 v10, p3 + iget-object v10, v10, ${LithoFilterPatch.objectReference.definingClass}->${LithoFilterPatch.objectReference.name}:${LithoFilterPatch.objectReference.type} + if-eqz v10, :do_not_block + check-cast v10, ${LithoFilterPatch.bufferReference} + iget-object v10, v10, ${LithoFilterPatch.bufferReference}->b:Ljava/nio/ByteBuffer; + """ + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0))) + ) + } else { + val secondParameter = LithoFilterPatch.lithoMethod.parameters[2] + LithoFilterPatch.lithoMethod.addInstructions( + 0, """ + move-object/from16 v10, p3 + iget-object v10, v10, $secondParameter->b:Ljava/nio/ByteBuffer; + """ + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0))) + ) + } + } + + /* + * Add settings + */ + SettingsPatch.addPreference( + arrayOf( + "PREFERENCE: BOTTOM_PLAYER_SETTINGS", + "SETTINGS: HIDE_QUICK_ACTIONS" + ) + ) + + SettingsPatch.updatePatchStatus("hide-quick-actions") + + return PatchResultSuccess() + } +} diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 4dfa7509e..17d9ee733 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -360,6 +360,18 @@ Please do not report any issues you encounter while using this feature."Buttons are shown Buttons are hidden Hide previous & next button + Quick actions container is shown + Quick actions container is hidden + Hide quick actions container + Comment button is shown + Comment button is hidden + Hide comment button + More button is shown + More button is hidden + Hide more button + Related videos are shown + Related videos are hidden + Hide related videos in quick actions Seekbar is shown Seekbar is hidden Hide seekbar @@ -457,6 +469,7 @@ Please do not report any issues you encounter while using this feature."Player flyout panel Player Spoofing protobuf to prevent playback issues + Quick actions components (Experimental) "As this is still an experimental feature, there may be other unknown issues. Are you sure you want to continue though?" "Tricks the dpi to change some layouts to phone layouts. diff --git a/src/main/resources/youtube/settings/values-v21/strings.xml b/src/main/resources/youtube/settings/values-v21/strings.xml index 0741207af..990d90298 100644 --- a/src/main/resources/youtube/settings/values-v21/strings.xml +++ b/src/main/resources/youtube/settings/values-v21/strings.xml @@ -13,6 +13,23 @@ @string/revanced_hide_button_thanks_summary_on @string/revanced_hide_button_thanks_title + @string/revanced_hide_button_dislike_summary_off + @string/revanced_hide_button_dislike_summary_on + @string/revanced_hide_button_dislike_title + @string/revanced_hide_button_like_summary_off + @string/revanced_hide_button_like_summary_on + @string/revanced_hide_button_like_title + @string/revanced_hide_button_live_chat_summary_off + @string/revanced_hide_button_live_chat_summary_on + @string/revanced_hide_button_live_chat_title + @string/revanced_hide_button_playlist_summary_off + @string/revanced_hide_button_playlist_summary_on + @string/revanced_hide_button_playlist_title + @string/revanced_hide_button_share_summary_off + @string/revanced_hide_button_share_summary_on + @string/revanced_hide_button_share_title + + @string/revanced_hide_info_panel_summary_off @string/revanced_hide_info_panel_summary_on @string/revanced_hide_info_panel_title diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 89e9d5f5c..80a49b59a 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -219,6 +219,18 @@ + + @@ -490,6 +502,7 @@ +