From da03d6563e6caf2fddee0415f28434523d5a3b22 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Tue, 12 Dec 2023 18:27:31 +0900 Subject: [PATCH] feat(YouTube/Hide navigation buttons): remove `Open library(You) on app startup` settings --- .../NavigationButtonsPatch.kt | 27 ++++++------------- .../utils/resourceid/SharedResourceIdPatch.kt | 2 -- .../youtube/settings/host/values/strings.xml | 3 --- .../youtube/settings/xml/revanced_prefs.xml | 1 - 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/NavigationButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/NavigationButtonsPatch.kt index f51e9d86c..dbfb9275a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/NavigationButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/navigation/navigationbuttons/NavigationButtonsPatch.kt @@ -14,7 +14,6 @@ import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.Pi import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint import app.revanced.patches.youtube.utils.integrations.Constants.NAVIGATION import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.AvatarImageWithTextTab import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ImageOnlyTab import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.util.exception @@ -100,22 +99,17 @@ object NavigationButtonsPatch : BytecodePatch( } /** - * Create, You Button + * Create Button */ parentResult.mutableMethod.apply { - mapOf( - CREATE_BUTTON_HOOK to ImageOnlyTab, - YOU_BUTTON_HOOK to AvatarImageWithTextTab - ).forEach { (hook, resourceId) -> - val insertIndex = implementation!!.instructions.let { - val scanStart = getWideLiteralInstructionIndex(resourceId) + val insertIndex = implementation!!.instructions.let { + val scanStart = getWideLiteralInstructionIndex(ImageOnlyTab) - scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction -> - instruction.opcode == Opcode.INVOKE_VIRTUAL - } - } + 2 - injectHook(hook, insertIndex) - } + scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction -> + instruction.opcode == Opcode.INVOKE_VIRTUAL + } + } + 2 + injectHook(CREATE_BUTTON_HOOK, insertIndex) } } ?: throw PivotBarCreateButtonViewFingerprint.exception @@ -168,11 +162,6 @@ object NavigationButtonsPatch : BytecodePatch( "->" + "hideCreateButton(Landroid/view/View;)V" - private const val YOU_BUTTON_HOOK = - "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" + - "->" + - "hideYouButton(Landroid/view/View;)V" - /** * Injects an instruction into insertIndex of the hook. * @param hook The hook to insert. diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt index d1a085688..3aa8fbb5b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt @@ -22,7 +22,6 @@ object SharedResourceIdPatch : ResourcePatch() { var AppRelatedEndScreenResults: Long = -1 var AutoNavPreviewStub: Long = -1 var AutoNavToggle: Long = -1 - var AvatarImageWithTextTab: Long = -1 var BackgroundCategory: Long = -1 var Bar: Long = -1 var BarContainerHeight: Long = -1 @@ -103,7 +102,6 @@ object SharedResourceIdPatch : ResourcePatch() { AppRelatedEndScreenResults = find(LAYOUT, "app_related_endscreen_results") AutoNavPreviewStub = find(ID, "autonav_preview_stub") AutoNavToggle = find(ID, "autonav_toggle") - AvatarImageWithTextTab = find(LAYOUT, "avatar_image_with_text_tab") BackgroundCategory = find(STRING, "pref_background_and_offline_category") Bar = find(LAYOUT, "bar") BarContainerHeight = find(DIMEN, "bar_container_height") diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 7e3009b03..dc16a8355 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -694,9 +694,6 @@ Some videos, including those from channels you subscribe to, may not be hidden e Layout Miscellaneous Navigation - Library(You) is not opened at app startup. - Library(You) is opened at app startup. - Open library(You) on app startup Others Overlay button Tap to toggle always repeat states. diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 79213634e..e1b349540 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -525,7 +525,6 @@ - SETTINGS: HIDE_NAVIGATION_BUTTONS -->