From 37ef795322842ff51f2463a6678a9562b6ff5c23 Mon Sep 17 00:00:00 2001 From: whitehai11 Date: Thu, 3 Sep 2026 20:50:40 +0200 Subject: [PATCH] fix(YouTube): Fix Custom settings strings misplacement and disable broken array-based list preferences The Custom settings strings added in 97b4fc5b5 were accidentally placed under the Twitch settings patch block instead of YouTube's, which broke resource compilation entirely. Moved them to the correct block and added the missing _summary_on/_summary_off pairs for the switch preferences. Also comments out 3 ListPreferences (playback speed, video quality, startup tab) that reference "${key}_entries"/"${key}_entry_values" array resources: the addresources/values/strings.xml pipeline only extracts elements and silently drops /, so these preferences had no backing entries and broke patching. Re-enabling them needs real ArrayResource wiring through ListPreference(entries=, entryValues=). Found by running the patches through revanced-cli against a real YouTube 21.34.248 APK. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01NXRsEcWGqDhsCbfEdrfCdE --- .../youtube/misc/settings/SettingsPatch.kt | 34 ++++++---- .../resources/addresources/values/strings.xml | 66 ++++++++++--------- 2 files changed, 58 insertions(+), 42 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt index b6fc77853..2dc602bf3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt @@ -238,17 +238,27 @@ val settingsPatch = bytecodePatch( SwitchPreference( "revanced_custom_hide_shorts", ), - ListPreference( - key = "revanced_custom_default_playback_speed", - tag = "app.revanced.extension.shared.settings.preference.SortedListPreference", - ), + // TEMPORARILY DISABLED FOR TESTING (revanced-cli verification pass): this + // ListPreference references "${key}_entries"/"${key}_entry_values" array + // resources that don't exist anywhere and can't be added via addresources/ + // values/strings.xml, since patches/strings-processing.gradle.kts only + // extracts elements (see its `"string" -> transform(...)` case + // vs. the `else -> walk children` fallthrough that silently drops / + // ). Needs a real app.revanced.util.resource.ArrayResource + // wired through the ListPreference(entries=, entryValues=) constructor + // (see patches/.../shared/misc/settings/preference/ListPreference.kt) or + // another array-resource source before this can ship. + // ListPreference( + // key = "revanced_custom_default_playback_speed", + // tag = "app.revanced.extension.shared.settings.preference.SortedListPreference", + // ), SwitchPreference( "revanced_custom_remember_playback_speed", ), - ListPreference( - key = "revanced_custom_default_video_quality", - tag = "app.revanced.extension.shared.settings.preference.SortedListPreference", - ), + // ListPreference( + // key = "revanced_custom_default_video_quality", + // tag = "app.revanced.extension.shared.settings.preference.SortedListPreference", + // ), SwitchPreference( "revanced_custom_remember_video_quality", ), @@ -264,10 +274,10 @@ val settingsPatch = bytecodePatch( inputType = InputType.TEXT_CAP_CHARACTERS, tag = "app.revanced.extension.shared.settings.preference.TextInputPreference", ), - ListPreference( - key = "revanced_custom_startup_tab", - tag = "app.revanced.extension.shared.settings.preference.SortedListPreference", - ), + // ListPreference( + // key = "revanced_custom_startup_tab", + // tag = "app.revanced.extension.shared.settings.preference.SortedListPreference", + // ), SwitchPreference( "revanced_custom_clean_urls", ), diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index 993a57ea5..e0f09589b 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -241,6 +241,42 @@ However, enabling this will also log some user data such as your IP address."Restore old settings menus Old settings menus are shown Old settings menus are not shown + + Custom + Reset Custom Settings + Restore custom preferences to defaults + Force AMOLED + True black is used in the YouTube UI + True black is not used in the YouTube UI + Pure Black Player + Player background is pure black + Player background is not pure black + Disable Ambient Mode + Ambient Mode is prevented from activating + Ambient Mode can activate + Hide Shorts + Shorts UI entries are removed + Shorts UI entries are shown + Default Playback Speed + Remember Playback Speed + Playback speed is remembered across videos + Playback speed is not remembered across videos + Default Video Quality + Remember Video Quality + Video quality is remembered across videos + Video quality is not remembered across videos + Force Highest Available Quality + Highest quality option is preferred + Highest quality option is not preferred + Debug Video Information + Technical video details are shown + Technical video details are hidden + Custom App Name + Change the visible application name + Default Startup Tab + Clean YouTube URLs + Tracking parameters are removed from shared links + Tracking parameters are not removed from shared links Disable Shorts background play @@ -1945,36 +1981,6 @@ Video playback with AV1 may stutter or drop frames." Debug logging Debug logs are enabled Debug logs are disabled - - Custom - Reset Custom Settings - Restore custom preferences to defaults - Force AMOLED - Use true black in the YouTube UI - Pure Black Player - Make player background pure black - Disable Ambient Mode - Prevent Ambient Mode from activating - Hide Shorts - Remove Shorts UI entries - Default Playback Speed - Select default playback speed - Remember Playback Speed - Remember speed across videos - Default Video Quality - Select default video quality - Remember Video Quality - Remember quality across videos - Force Highest Available Quality - Prefer highest quality option - Debug Video Information - Show technical video details - Custom App Name - Change the visible application name - Default Startup Tab - Select startup tab - Clean YouTube URLs - Remove tracking parameters from shared links