Skip to content

Commit

Permalink
fix(YouTube - Custom Branding): Patch fails when selecting some custo…
Browse files Browse the repository at this point in the history
…m icons
  • Loading branch information
Francesco146 committed Jul 10, 2024
1 parent 63dfdc7 commit 3660723
Show file tree
Hide file tree
Showing 26 changed files with 120 additions and 434 deletions.
5 changes: 3 additions & 2 deletions remove_unused_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def search_in_files(directories, name_values):
# Ignore dot directories and the build directory
dirs[:] = [d for d in dirs if not d.startswith('.') and d != 'build']
for file in files:
if file == 'strings.xml' or not file.endswith(allowed_extensions):
if file in ('strings.xml', 'missing_strings.xml') or not file.endswith(allowed_extensions):
continue
file_path = os.path.join(root, file)
try:
Expand Down Expand Up @@ -68,7 +68,8 @@ def remove_unused_strings(xml_file_paths, unused_names):

# Find and remove elements with unused 'name' attributes
for element in root.findall(".//*[@name]"):
if element.get('name') in unused_names:
name_attr = element.get('name')
if name_attr in unused_names and not name_attr.startswith("revanced_icon_"):
root.remove(element)

# Write the updated XML back to the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatc
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.settings.ResourceUtils.updatePatchStatusIcon
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.ResourceGroup
import app.revanced.util.*
import app.revanced.util.Utils.trimIndentMultiline
import app.revanced.util.copyFile
import app.revanced.util.copyResources
import app.revanced.util.copyXmlNode
import app.revanced.util.patch.BaseResourcePatch
import app.revanced.util.underBarOrThrow

@Suppress("unused")
object CustomBrandingIconPatch : BaseResourcePatch(
Expand Down
33 changes: 4 additions & 29 deletions src/main/resources/youtube/settings/host/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="accessibility_settings_edu_opt_in_text">Enable accessibility controls for the video player?</string>
<string name="accessibility_settings_edu_opt_out_text">Your controls are modified because an accessibility service is on.</string>
Expand All @@ -17,8 +17,6 @@ Tap on the continue button and disable battery optimizations."</string>
<string name="gms_core_settings_summary">Enable cloud messaging to receive notifications.</string>
<string name="gms_core_settings_title">Open GmsCore</string>
<string name="gms_core_toast_not_installed_message">GmsCore is not installed. Install it.</string>
<string name="revanced_alt_thumbnail_alternative_domain_enable_summary">This option allows you to replace the domain from which YouTube receives original avatars, images of community publications, etc.</string>
<string name="revanced_alt_thumbnail_alternative_domain_enable_title">Use alternative domain for all original pictures</string>
<string name="revanced_alt_thumbnail_alternative_domain_summary">The domain to fetch images from.\nNote: Only enter the domain name, i.e., without the \"https\:\/\/\" prefix.</string>
<string name="revanced_alt_thumbnail_alternative_domain_title">Alternative domain</string>
<string name="revanced_alt_thumbnail_dearrow_about_summary">"DeArrow provides crowd-sourced thumbnails for YouTube videos. These thumbnails are often more relevant than those provided by YouTube.
Expand Down Expand Up @@ -516,7 +514,6 @@ Words with uppercase letters in the middle must be entered with the casing (ie:
<string name="revanced_hide_keyword_content_subscriptions_title">Hide subscription videos by keywords</string>
<string name="revanced_hide_keyword_toast_invalid_broad">Keyword \'%1$s\' will hide all videos.</string>
<string name="revanced_hide_keyword_toast_invalid_common">Invalid keyword. Cannot use: \'%s\' as a filter</string>
<string name="revanced_hide_keyword_toast_invalid_keyword">Invalid keyword. \'%1$s\' is less than %2$d characters.</string>
<string name="revanced_hide_latest_posts_summary_off">Latest posts are shown.</string>
<string name="revanced_hide_latest_posts_summary_on">Latest posts are hidden.</string>
<string name="revanced_hide_latest_posts_title">Hide latest posts</string>
Expand All @@ -532,8 +529,6 @@ Words with uppercase letters in the middle must be entered with the casing (ie:
<string name="revanced_hide_live_chat_replay_button_summary_off">Live chat replay button is shown.\n\nIt appears in fullscreen when closing live chat.</string>
<string name="revanced_hide_live_chat_replay_button_summary_on">Live chat replay button is hidden.\n\nIt appears in fullscreen when closing live chat.</string>
<string name="revanced_hide_live_chat_replay_button_title">Hide live chat replay button</string>
<string name="revanced_hide_low_views_video_summary">Hide videos with less than 1,000 views from home feeds that have been uploaded from unsubscribed channels.</string>
<string name="revanced_hide_low_views_video_title">Hide low views video</string>
<string name="revanced_hide_medical_panel_summary_off">Medical panels are shown.</string>
<string name="revanced_hide_medical_panel_summary_on">Medical panels are hidden.</string>
<string name="revanced_hide_medical_panel_title">Hide medical panels</string>
Expand Down Expand Up @@ -921,11 +916,14 @@ Settings → Autoplay → Autoplay next video"</string>
<string name="revanced_hide_web_search_results_title">Hide web search results</string>
<string name="revanced_icon_afn_blue">Afn Blue</string>
<string name="revanced_icon_afn_red">Afn Red</string>
<string name="revanced_icon_custom">Custom</string>
<string name="revanced_icon_default">Stock</string>
<string name="revanced_icon_mmt">MMT</string>
<string name="revanced_icon_mmt_blue">MMT Blue</string>
<string name="revanced_icon_mmt_green">MMT Green</string>
<string name="revanced_icon_mmt_yellow">MMT Yellow</string>
<string name="revanced_icon_revancify_blue">Revancify Blue</string>
<string name="revanced_icon_revancify_red">Revancify Red</string>
<string name="revanced_icon_revancify_yellow">Revancify Yellow</string>
<string name="revanced_icon_vanced_black">Vanced Black</string>
<string name="revanced_icon_vanced_light">Vanced Light</string>
Expand Down Expand Up @@ -1084,9 +1082,7 @@ A different codec will be applied after about 20 seconds of buffering."</string>
<string name="revanced_remember_video_quality_last_selected_summary_off">Quality changes only apply to the current video.</string>
<string name="revanced_remember_video_quality_last_selected_summary_on">Quality changes apply to all videos.</string>
<string name="revanced_remember_video_quality_last_selected_title">Remember video quality changes</string>
<string name="revanced_remember_video_quality_mobile">Changing default mobile data quality to %s.</string>
<string name="revanced_remember_video_quality_none">Failed to set video quality.</string>
<string name="revanced_remember_video_quality_wifi">Changing default Wi-Fi quality to %s.</string>
<string name="revanced_remove_viewer_discretion_dialog_summary">"Removes the viewer discretion dialog.
This does not bypass the age restriction. It just accepts it automatically."</string>
<string name="revanced_remove_viewer_discretion_dialog_title">Remove viewer discretion dialog</string>
Expand All @@ -1111,10 +1107,6 @@ Tap and hold to open YouTube settings."</string>
<string name="revanced_restore_old_video_quality_menu_summary_off">Old video quality menu is not shown.</string>
<string name="revanced_restore_old_video_quality_menu_summary_on">Old video quality menu is shown.</string>
<string name="revanced_restore_old_video_quality_menu_title">Restore old video quality menu</string>
<string name="revanced_return_shorts_channel_name_fetch_summary_off">"Use YouTube's built-in channel name."</string>
<string name="revanced_return_shorts_channel_name_fetch_summary_on">"Use the channel name taken from RSS feed.
It may take longer to fetch the channel name."</string>
<string name="revanced_return_shorts_channel_name_fetch_title">Fetch from rss feed</string>
<string name="revanced_ryd_about">About</string>
<string name="revanced_ryd_attribution_summary">Dislike data is provided by the Return YouTube Dislike API. Tap here to learn more.</string>
<string name="revanced_ryd_attribution_title">ReturnYouTubeDislike.com</string>
Expand Down Expand Up @@ -1383,13 +1375,10 @@ If later turned off, it is recommended to clear the app data to prevent UI bugs.
<string name="revanced_spoof_client_general_title">General</string>
<string name="revanced_spoof_client_livestream_title">Live streams</string>
<string name="revanced_spoof_client_options_entry_android">Android</string>
<string name="revanced_spoof_client_options_entry_android_embedded_player">Android Embedded Player</string>
<string name="revanced_spoof_client_options_entry_android_testsuite">Android Testsuite</string>
<string name="revanced_spoof_client_options_entry_android_unplugged">Android TV</string>
<string name="revanced_spoof_client_options_entry_android_vr">Android VR</string>
<string name="revanced_spoof_client_options_entry_ios">iOS</string>
<string name="revanced_spoof_client_options_entry_tvhtml5_simply_embedded_player">TV HTML5</string>
<string name="revanced_spoof_client_options_entry_web">Web</string>
<string name="revanced_spoof_client_shorts_title">Shorts, Clips</string>
<string name="revanced_spoof_client_stats_for_nerds_summary_off">Spoofed client is hidden in Stats for nerds.</string>
<string name="revanced_spoof_client_stats_for_nerds_summary_on">Spoofed client is shown in Stats for nerds.</string>
Expand Down Expand Up @@ -1434,19 +1423,6 @@ Side effects include:
• Watch history does not work with a brand account.
• Live streams cannot play as audio-only.
• Live streams not available on Android 8.0."</string>
<string name="revanced_spoof_client_use_ios_summary_off">"Client is currently spoofed to Android VR. (iOS client is used for Clips or Shorts)

Side effects include:
• Player swipe gestures do not work.
• Kids videos do not playback.
• Paused videos can randomly resume."</string>
<string name="revanced_spoof_client_use_ios_summary_on">"Client is currently spoofed to iOS.

Side effects include:
• Playback speed menu is missing.
• Live streams cannot play as audio only.
• Live streams not available on Android 8.0.
• Higher video qualities may be missing."</string>
<string name="revanced_spoof_client_use_ios_title">iOS</string>
<string name="revanced_spoof_client_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_device_dimensions_summary">"Spoofs the device dimensions to the maximum value.
Expand Down Expand Up @@ -1478,7 +1454,6 @@ Limitations:
<string name="revanced_swipe_overlay_rect_size_invalid_toast">Swipeable area size cannot be more than 50. Reset to default value.</string>
<string name="revanced_swipe_overlay_rect_size_summary">Percentage of swipeable screen area.\n\nNote: This will also change the size of the screen area for the double-tap-to-seek gesture.</string>
<string name="revanced_swipe_overlay_rect_size_title">Swipe overlay screen size</string>
<string name="revanced_swipe_overlay_rect_size_warning">Swipeable area size cannot be more than %s%%. Reset to default value.</string>
<string name="revanced_swipe_overlay_text_size_summary">The text size for swipe overlay.</string>
<string name="revanced_swipe_overlay_text_size_title">Swipe overlay text size</string>
<string name="revanced_swipe_overlay_timeout_summary">The amount of milliseconds the overlay is visible.</string>
Expand Down
Loading

0 comments on commit 3660723

Please sign in to comment.