mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
feat(YouTube/Hide layout components): Hide YouTube settings menu
settings
This commit is contained in:
@ -5,7 +5,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.PatchException
|
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.shared.litho.LithoFilterPatch
|
import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.AccountListFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.AccountListFingerprint
|
||||||
@ -14,6 +13,7 @@ import app.revanced.patches.youtube.general.components.fingerprints.AccountMenuF
|
|||||||
import app.revanced.patches.youtube.general.components.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.BottomUiContainerFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.BottomUiContainerFingerprint
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.FloatingMicrophoneFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.FloatingMicrophoneFingerprint
|
||||||
|
import app.revanced.patches.youtube.general.components.fingerprints.SettingsMenuFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fingerprints.AccountMenuParentFingerprint
|
import app.revanced.patches.youtube.utils.fingerprints.AccountMenuParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPATIBLE_PACKAGE
|
import app.revanced.patches.youtube.utils.integrations.Constants.COMPATIBLE_PACKAGE
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||||
@ -23,6 +23,7 @@ import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.Accou
|
|||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.patches.youtube.utils.viewgroup.ViewGroupMarginLayoutParamsHookPatch
|
import app.revanced.patches.youtube.utils.viewgroup.ViewGroupMarginLayoutParamsHookPatch
|
||||||
import app.revanced.util.getTargetIndex
|
import app.revanced.util.getTargetIndex
|
||||||
|
import app.revanced.util.getTargetIndexWithFieldReferenceType
|
||||||
import app.revanced.util.getTargetIndexWithMethodReferenceName
|
import app.revanced.util.getTargetIndexWithMethodReferenceName
|
||||||
import app.revanced.util.getWideLiteralInstructionIndex
|
import app.revanced.util.getWideLiteralInstructionIndex
|
||||||
import app.revanced.util.patch.BaseBytecodePatch
|
import app.revanced.util.patch.BaseBytecodePatch
|
||||||
@ -47,7 +48,8 @@ object LayoutComponentsPatch : BaseBytecodePatch(
|
|||||||
AccountMenuParentFingerprint,
|
AccountMenuParentFingerprint,
|
||||||
AccountSwitcherAccessibilityLabelFingerprint,
|
AccountSwitcherAccessibilityLabelFingerprint,
|
||||||
BottomUiContainerFingerprint,
|
BottomUiContainerFingerprint,
|
||||||
FloatingMicrophoneFingerprint
|
FloatingMicrophoneFingerprint,
|
||||||
|
SettingsMenuFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
private const val CUSTOM_FILTER_CLASS_DESCRIPTOR =
|
private const val CUSTOM_FILTER_CLASS_DESCRIPTOR =
|
||||||
@ -135,6 +137,23 @@ object LayoutComponentsPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
// region patch for hide settings menu
|
||||||
|
|
||||||
|
SettingsMenuFingerprint.resultOrThrow().let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = getTargetIndexWithFieldReferenceType("Landroid/support/v7/widget/RecyclerView;")
|
||||||
|
val insertRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static {v$insertRegister}, " +
|
||||||
|
"$GENERAL_CLASS_DESCRIPTOR->hideSettingsMenu(Landroid/support/v7/widget/RecyclerView;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
// region patch for hide snack bar
|
// region patch for hide snack bar
|
||||||
|
|
||||||
BottomUiContainerFingerprint.resultOrThrow().let {
|
BottomUiContainerFingerprint.resultOrThrow().let {
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.general.components.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
|
||||||
|
internal object SettingsMenuFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "Landroid/view/View;",
|
||||||
|
literalSupplier = { 16908351 }
|
||||||
|
)
|
@ -366,6 +366,18 @@ Some components may not be hidden."</string>
|
|||||||
• Disabling this setting loads more ads from the server side.
|
• Disabling this setting loads more ads from the server side.
|
||||||
• You should disable this setting to make video ads visible."</string>
|
• You should disable this setting to make video ads visible."</string>
|
||||||
|
|
||||||
|
<!-- PreferenceScreen: General, PreferenceCategory: General, PreferenceScreen: Settings menu -->
|
||||||
|
<string name="revanced_preference_screen_settings_munu_title">Settings menu</string>
|
||||||
|
<string name="revanced_preference_screen_settings_munu_summary">Hide elements in YouTube settings menu.</string>
|
||||||
|
|
||||||
|
<string name="revanced_hide_settings_menu_title">Hide YouTube settings menu</string>
|
||||||
|
<string name="revanced_hide_settings_menu_summary">Hide elements in YouTube settings menu.</string>
|
||||||
|
<string name="revanced_hide_settings_menu_filter_strings_title">YouTube settings menu filter</string>
|
||||||
|
<string name="revanced_hide_settings_menu_filter_strings_summary">List of YouTube settings menu names to filter separated by a new line.</string>
|
||||||
|
<string name="revanced_hide_settings_menu_filter_strings_hint">"Account
|
||||||
|
Data saving
|
||||||
|
Captions"</string>
|
||||||
|
|
||||||
<!-- PreferenceScreen: General, PreferenceCategory: General, PreferenceScreen: Toolbar -->
|
<!-- PreferenceScreen: General, PreferenceCategory: General, PreferenceScreen: Toolbar -->
|
||||||
<string name="revanced_preference_screen_toolbar_title">Toolbar</string>
|
<string name="revanced_preference_screen_toolbar_title">Toolbar</string>
|
||||||
<string name="revanced_preference_screen_toolbar_summary">Hide or change components located on the toolbar such as toolbar buttons, search bar, header.</string>
|
<string name="revanced_preference_screen_toolbar_summary">Hide or change components located on the toolbar such as toolbar buttons, search bar, header.</string>
|
||||||
|
Reference in New Issue
Block a user