feat(YouTube - Debugging): Add setting to block experimental client flags (#6196)

This commit is contained in:
MarcaD
2025-11-08 10:01:46 +02:00
committed by GitHub
parent 81f83690d6
commit 2e9d6959c9
36 changed files with 1174 additions and 281 deletions

View File

@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatchBuilder
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.resourcePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.BasePreference
@@ -13,6 +14,8 @@ import app.revanced.patches.shared.misc.settings.preference.NonInteractivePrefer
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
import app.revanced.util.findInstructionIndicesReversedOrThrow
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
@@ -36,7 +39,27 @@ internal fun enableDebuggingPatch(
description = "Adds options for debugging and exporting ReVanced logs to the clipboard.",
) {
dependsOn(addResourcesPatch)
dependsOn(
addResourcesPatch,
resourcePatch {
execute {
copyResources(
"settings",
ResourceGroup("drawable",
// Action buttons.
"revanced_settings_copy_all.xml",
"revanced_settings_deselect_all.xml",
"revanced_settings_select_all.xml",
// Move buttons.
"revanced_settings_arrow_left_double.xml",
"revanced_settings_arrow_left_one.xml",
"revanced_settings_arrow_right_double.xml",
"revanced_settings_arrow_right_one.xml"
)
)
}
}
)
block()
@@ -64,6 +87,11 @@ internal fun enableDebuggingPatch(
"revanced_debug_logs_clear_buffer",
tag = "app.revanced.extension.shared.settings.preference.ClearLogBufferPreference",
selectable = true
),
NonInteractivePreference(
"revanced_debug_feature_flags_manager",
tag = "app.revanced.extension.shared.settings.preference.FeatureFlagsManagerPreference",
selectable = true
)
)
)

View File

@@ -53,6 +53,7 @@ Second \"item\" text"</string>
<string name="revanced_settings_submenu_title">Settings</string>
<string name="revanced_settings_title" translatable="false">ReVanced</string>
<string name="revanced_settings_confirm_user_dialog_title">Are you sure you want to proceed?</string>
<string name="revanced_settings_save">Save</string>
<string name="revanced_settings_reset">Reset</string>
<string name="revanced_settings_reset_color">Reset color</string>
<string name="revanced_settings_color_invalid">Invalid color</string>
@@ -221,6 +222,14 @@ You will not be notified of any unexpected events."</string>
<string name="revanced_debug_logs_clear_buffer_title">Clear debug logs</string>
<string name="revanced_debug_logs_clear_buffer_summary">Clears all stored ReVanced debug logs</string>
<string name="revanced_debug_logs_clear_toast">Logs cleared</string>
<string name="revanced_debug_feature_flags_manager_title">Feature flags manager</string>
<string name="revanced_debug_feature_flags_manager_summary">Manage boolean feature flags</string>
<string name="revanced_debug_feature_flags_manager_active_header">Active flags (%d)</string>
<string name="revanced_debug_feature_flags_manager_blocked_header">Blocked flags (%d)</string>
<string name="revanced_debug_feature_flags_manager_search_hint">Search flags...</string>
<string name="revanced_debug_feature_flags_manager_toast_saved">Flags saved</string>
<string name="revanced_debug_feature_flags_manager_toast_reset">Flags reset</string>
<string name="revanced_debug_feature_flags_manager_toast_copied">Flags copied to clipboard</string>
</patch>
<patch id="misc.privacy.sanitizeSharingLinksPatch">
<string name="revanced_sanitize_sharing_links_title">Sanitize sharing links</string>

View File

@@ -0,0 +1,32 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/keyboard_double_arrow_left/materialsymbolsoutlined/keyboard_double_arrow_left_wght200_24px.xml
Changes made: Added custom stroke.
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M11.25,17.3086 L5.94141,12 L11.25,6.69141 L11.957,7.39844 L7.36328,12 L11.957,16.6016 Z M17.3516,17.3086 L12.043,12 L17.3516,6.69141 L18.0586,7.39844 L13.4648,12 L18.0586,16.6016 Z M17.3516,17.3086" />
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M1.80859,23.8086 C0.875313,23.8086,0.1914,23.1246,0.1914,22.1914 L0.191402,1.80859 C0.191402,0.875317,0.875368,0.19141,1.80859,0.19141 L22.1914,0.19141 C23.1247,0.19141,23.8086,0.875376,23.8086,1.80859 L23.8086,22.1914 C23.8086,23.1247,23.1246,23.8086,22.1914,23.8086 Z M1.80859,22.8086 L22.1914,22.8086 C22.5552,22.8086,22.8086,22.5552,22.8086,22.1914 L22.8086,1.80859 C22.8086,1.44477,22.5552,1.19141,22.1914,1.19141 L1.80859,1.19141 C1.44477,1.19141,1.19141,1.4448,1.19141,1.8086 L1.19141,22.1914 C1.19141,22.5552,1.4448,22.8086,1.8086,22.8086 Z" />
</vector>

View File

@@ -0,0 +1,31 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/keyboard_arrow_left/materialsymbolsoutlined/keyboard_arrow_left_wght200_24px.xml
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M14,17.3086 L8.69141,12 L14,6.69141 L14.707,7.39844 L10.1094,12 L14.707,16.6016 Z M14,17.3086" />
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M1.80859,23.8086 C0.875313,23.8086,0.1914,23.1246,0.1914,22.1914 L0.191402,1.80859 C0.191402,0.875317,0.875368,0.19141,1.80859,0.19141 L22.1914,0.19141 C23.1247,0.19141,23.8086,0.875376,23.8086,1.80859 L23.8086,22.1914 C23.8086,23.1247,23.1246,23.8086,22.1914,23.8086 Z M1.80859,22.8086 L22.1914,22.8086 C22.5552,22.8086,22.8086,22.5552,22.8086,22.1914 L22.8086,1.80859 C22.8086,1.44477,22.5552,1.19141,22.1914,1.19141 L1.80859,1.19141 C1.44477,1.19141,1.19141,1.4448,1.19141,1.8086 L1.19141,22.1914 C1.19141,22.5552,1.4448,22.8086,1.8086,22.8086 Z" />
</vector>

View File

@@ -0,0 +1,32 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/keyboard_double_arrow_right/materialsymbolsoutlined/keyboard_double_arrow_right_wght200_24px.xml
Changes made: Added custom stroke.
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M10.5352,12 L5.94141,7.39844 L6.64844,6.69141 L11.957,12 L6.64844,17.3086 L5.94141,16.6016 Z M16.6367,12 L12.043,7.39844 L12.75,6.69141 L18.0586,12 L12.75,17.3086 L12.043,16.6016 Z M16.6367,12" />
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M1.80859,23.8086 C0.875313,23.8086,0.1914,23.1246,0.1914,22.1914 L0.191402,1.80859 C0.191402,0.875317,0.875368,0.19141,1.80859,0.19141 L22.1914,0.19141 C23.1247,0.19141,23.8086,0.875376,23.8086,1.80859 L23.8086,22.1914 C23.8086,23.1247,23.1246,23.8086,22.1914,23.8086 Z M1.80859,22.8086 L22.1914,22.8086 C22.5552,22.8086,22.8086,22.5552,22.8086,22.1914 L22.8086,1.80859 C22.8086,1.44477,22.5552,1.19141,22.1914,1.19141 L1.80859,1.19141 C1.44477,1.19141,1.19141,1.4448,1.19141,1.8086 L1.19141,22.1914 C1.19141,22.5552,1.4448,22.8086,1.8086,22.8086 Z" />
</vector>

View File

@@ -0,0 +1,31 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/keyboard_arrow_right/materialsymbolsoutlined/keyboard_arrow_right_wght200_24px.xml
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M13.293,12 L8.69141,7.39844 L9.39844,6.69141 L14.707,12 L9.39844,17.3086 L8.69141,16.6016 Z M13.293,12" />
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M1.80859,23.8086 C0.875313,23.8086,0.1914,23.1246,0.1914,22.1914 L0.191402,1.80859 C0.191402,0.875317,0.875368,0.19141,1.80859,0.19141 L22.1914,0.19141 C23.1247,0.19141,23.8086,0.875376,23.8086,1.80859 L23.8086,22.1914 C23.8086,23.1247,23.1246,23.8086,22.1914,23.8086 Z M1.80859,22.8086 L22.1914,22.8086 C22.5552,22.8086,22.8086,22.5552,22.8086,22.1914 L22.8086,1.80859 C22.8086,1.44477,22.5552,1.19141,22.1914,1.19141 L1.80859,1.19141 C1.44477,1.19141,1.19141,1.4448,1.19141,1.8086 L1.19141,22.1914 C1.19141,22.5552,1.4448,22.8086,1.8086,22.8086 Z" />
</vector>

View File

@@ -0,0 +1,28 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/copy_all/materialsymbolsoutlined/copy_all_wght200_24px.xml
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M4,17.4219 L4,16.1914 L5.23047,16.1914 L5.23047,17.4219 Z M4,13.8477 L4,12.6172 L5.23047,12.6172 L5.23047,13.8477 Z M4,10.2695 L4,9.03906 L5.23047,9.03906 L5.23047,10.2695 Z M7.57813,21 L7.57813,19.7695 L8.80859,19.7695 L8.80859,21 Z M9.30859,17.3086 C8.84766,17.3086,8.46484,17.1523,8.15625,16.8438 C7.84766,16.5352,7.69141,16.1523,7.69141,15.6914 L7.69141,4.61719 C7.69141,4.15625,7.84766,3.76953,8.15625,3.46094 C8.46484,3.15234,8.84766,3,9.30859,3 L17.3828,3 C17.8438,3,18.2305,3.15234,18.5391,3.46094 C18.8477,3.76953,19,4.15625,19,4.61719 L19,15.6914 C19,16.1523,18.8477,16.5352,18.5391,16.8438 C18.2305,17.1523,17.8438,17.3086,17.3828,17.3086 Z M9.30859,16.3086 L17.3828,16.3086 C17.5391,16.3086,17.6797,16.2422,17.8086,16.1172 C17.9375,15.9883,18,15.8477,18,15.6914 L18,4.61719 C18,4.46094,17.9375,4.32031,17.8086,4.19141 C17.6797,4.0625,17.5391,4,17.3828,4 L9.30859,4 C9.15234,4,9.01172,4.0625,8.88281,4.19141 C8.75781,4.32031,8.69141,4.46094,8.69141,4.61719 L8.69141,15.6914 C8.69141,15.8477,8.75781,15.9883,8.88281,16.1172 C9.01172,16.2422,9.15234,16.3086,9.30859,16.3086 Z M11.1523,21 L11.1523,19.7695 L12.3828,19.7695 L12.3828,21 Z M5.23047,21 C4.89063,21,4.60156,20.8789,4.36328,20.6367 C4.12109,20.3984,4,20.1094,4,19.7695 L5.23047,19.7695 Z M14.7305,21 L14.7305,19.7695 L15.9609,19.7695 C15.9609,20.1133,15.8398,20.4063,15.6016,20.6445 C15.3594,20.8828,15.0703,21,14.7305,21 Z M4,6.69141 C4,6.35547,4.12109,6.0625,4.36328,5.82422 C4.60156,5.58203,4.89063,5.46094,5.23047,5.46094 L5.23047,6.69141 Z M13.3477,10.1523 Z M13.3477,10.1523" />
</vector>

View File

@@ -0,0 +1,28 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/deselect/materialsymbolsoutlined/deselect_wght200_24px.xml
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M19.832,21.2539 L14.8867,16.3086 L7.69141,16.3086 L7.69141,9.11328 L2.74609,4.16797 L3.45313,3.45313 L20.5469,20.5469 Z M8.69141,15.3086 L13.8867,15.3086 L8.69141,10.1133 Z M16.3086,13.4844 L15.3086,12.4844 L15.3086,8.69141 L11.5156,8.69141 L10.5156,7.69141 L16.3086,7.69141 Z M5.23047,18.7695 L5.23047,20 C4.89063,20,4.60156,19.8789,4.36328,19.6367 C4.12109,19.3984,4,19.1094,4,18.7695 Z M4,16.3086 L4,15.0781 L5.23047,15.0781 L5.23047,16.3086 Z M4,12.6172 L4,11.3828 L5.23047,11.3828 L5.23047,12.6172 Z M4,8.92188 L4,7.69141 L5.23047,7.69141 L5.23047,8.92188 Z M7.69141,20 L7.69141,18.7695 L8.92188,18.7695 L8.92188,20 Z M7.69141,5.23047 L7.69141,4 L8.92188,4 L8.92188,5.23047 Z M11.3828,20 L11.3828,18.7695 L12.6172,18.7695 L12.6172,20 Z M11.3828,5.23047 L11.3828,4 L12.6172,4 L12.6172,5.23047 Z M15.0781,20 L15.0781,18.7695 L16.3086,18.7695 L16.3086,20 Z M15.0781,5.23047 L15.0781,4 L16.3086,4 L16.3086,5.23047 Z M18.7695,16.3086 L18.7695,15.0781 L20,15.0781 L20,16.3086 Z M18.7695,12.6172 L18.7695,11.3828 L20,11.3828 L20,12.6172 Z M18.7695,8.92188 L18.7695,7.69141 L20,7.69141 L20,8.92188 Z M18.7695,5.23047 L18.7695,4 C19.1094,4,19.3984,4.12109,19.6367,4.36328 C19.8789,4.60156,20,4.89063,20,5.23047 Z M18.7695,5.23047" />
</vector>

View File

@@ -0,0 +1,28 @@
<!--
https://github.com/google/material-design-icons/blob/bb04090f930e272697f2a1f0d7b352d92dfeee43/symbols/android/select_all/materialsymbolsoutlined/select_all_wght200_24px.xml
Copyright 2022 Google
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/textColorPrimary"
android:pathData="M7.69141,16.3086 L7.69141,7.69141 L16.3086,7.69141 L16.3086,16.3086 Z M8.69141,15.3086 L15.3086,15.3086 L15.3086,8.69141 L8.69141,8.69141 Z M5.23047,18.7695 L5.23047,20 C4.89063,20,4.60156,19.8789,4.36328,19.6367 C4.12109,19.3984,4,19.1094,4,18.7695 Z M4,16.3086 L4,15.0781 L5.23047,15.0781 L5.23047,16.3086 Z M4,12.6172 L4,11.3828 L5.23047,11.3828 L5.23047,12.6172 Z M4,8.92188 L4,7.69141 L5.23047,7.69141 L5.23047,8.92188 Z M5.23047,5.23047 L4,5.23047 C4,4.89063,4.12109,4.60156,4.36328,4.36328 C4.60156,4.12109,4.89063,4,5.23047,4 Z M7.69141,20 L7.69141,18.7695 L8.92188,18.7695 L8.92188,20 Z M7.69141,5.23047 L7.69141,4 L8.92188,4 L8.92188,5.23047 Z M11.3828,20 L11.3828,18.7695 L12.6172,18.7695 L12.6172,20 Z M11.3828,5.23047 L11.3828,4 L12.6172,4 L12.6172,5.23047 Z M15.0781,20 L15.0781,18.7695 L16.3086,18.7695 L16.3086,20 Z M15.0781,5.23047 L15.0781,4 L16.3086,4 L16.3086,5.23047 Z M18.7695,20 L18.7695,18.7695 L20,18.7695 C20,19.1133,19.8789,19.4063,19.6367,19.6445 C19.3984,19.8828,19.1094,20,18.7695,20 Z M18.7695,16.3086 L18.7695,15.0781 L20,15.0781 L20,16.3086 Z M18.7695,12.6172 L18.7695,11.3828 L20,11.3828 L20,12.6172 Z M18.7695,8.92188 L18.7695,7.69141 L20,7.69141 L20,8.92188 Z M18.7695,5.23047 L18.7695,4 C19.1094,4,19.3984,4.12109,19.6367,4.36328 C19.8789,4.60156,20,4.89063,20,5.23047 Z M18.7695,5.23047" />
</vector>