From e27c316bd2a55b5335ab4fd6698f7db1603beb68 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Thu, 19 Oct 2023 08:08:04 +0900 Subject: [PATCH] fix(YouTube/Hide handle): handle is not hidden in You tab --- .../youtube/general/handle/HideHandlePatch.kt | 16 ++++++++++++---- ...countSwitcherAccessibilityLabelFingerprint.kt | 2 +- .../youtube/settings/host/values/strings.xml | 6 +++--- .../youtube/settings/xml/revanced_prefs.xml | 6 +++--- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/handle/HideHandlePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/handle/HideHandlePatch.kt index 39ba6ef3c..7d32706d5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/handle/HideHandlePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/handle/HideHandlePatch.kt @@ -7,16 +7,19 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction 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.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint +import app.revanced.patches.youtube.general.handle.fingerprints.AccountSwitcherAccessibilityLabelFingerprint +import app.revanced.patches.youtube.utils.litho.LithoFilterPatch import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.util.integrations.Constants.GENERAL +import app.revanced.util.integrations.Constants.PATCHES_PATH import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Hide handle", - description = "Hides the handle in the account switcher.", + description = "Hides the handle in the account switcher and You tab.", dependencies = [ + LithoFilterPatch::class, SettingsPatch::class, SharedResourceIdPatch::class ], @@ -44,6 +47,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction object HideHandlePatch : BytecodePatch( setOf(AccountSwitcherAccessibilityLabelFingerprint) ) { + private const val FILTER_CLASS_DESCRIPTOR = + "$PATCHES_PATH/ads/HandlesFilter;" + override fun execute(context: BytecodeContext) { AccountSwitcherAccessibilityLabelFingerprint.result?.let { @@ -53,20 +59,22 @@ object HideHandlePatch : BytecodePatch( addInstructions( targetIndex + 2, """ - invoke-static {v$targetRegister}, $GENERAL->hideEmailAddress(I)I + invoke-static {v$targetRegister}, $GENERAL->hideHandle(I)I move-result v$targetRegister """ ) } } ?: throw AccountSwitcherAccessibilityLabelFingerprint.exception + LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) + /** * Add settings */ SettingsPatch.addPreference( arrayOf( "PREFERENCE: GENERAL_SETTINGS", - "SETTINGS: HIDE_EMAIL_ADDRESS" + "SETTINGS: HIDE_HANDLE" ) ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/handle/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/general/handle/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt index efa8a42a9..86a7c11aa 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/handle/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/handle/fingerprints/AccountSwitcherAccessibilityLabelFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.general.personalinformation.fingerprints +package app.revanced.patches.youtube.general.handle.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.AccountSwitcherAccessibility diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index a8f0e6b04..a80cebeb9 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -299,9 +299,6 @@ Only available to some users who can use the speed overlay" Crowdfunding box is shown Crowdfunding box is hidden Hide crowdfunding box - Email address (handle) is shown - Email address (handle) is hidden - Hide email address (handle) Emoji picker is shown Emoji picker is hidden Hide emoji picker @@ -345,6 +342,9 @@ Only available to some users who can use the speed overlay" Gray separators are shown Gray separators are hidden Hide gray separator + Handle is shown + Handle is hidden + Hide handle Home button is shown Home button is hidden Hide home button diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index ab20a9455..ad8f39c65 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -179,12 +179,12 @@ - - + +