Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(YouTube Music): Add Settings patch #2708

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

Conversation

oSumAtrIX
Copy link
Member

@oSumAtrIX oSumAtrIX commented Feb 9, 2024

About

WsaClient_ukEwU1uHCr.mp4

This PR adds a patch that adds ReVanced settings to YouTube Music.
This is achieved through recent abstractions regarding settings and resource patches.

The PR works like this:

Add a new settings patch, similar to YouTube, to YouTube Music. It extends existing abstract classes.
Because BaseSettings in integrations has to debug strings by default, the Debugging patch was abstracted in a similar fashion to a BaseDebuggingPatch. YouTube adds an additional debugging preference (Litho buffer logging), which does not exist in YouTube Music yet. Refer to the current implementation.

RE: ReVanced/revanced-integrations#568

Todo

  • Properly SettingsPatch to BaseSettingsPatch similar to BaseSettingsResourcePatch
  • Abstract "ThemeHelper" which is currently responsible in YouTube for selecting the correct theme for the settings screens
  • Implement ThemeHelper in YouTube Music
  • ThemeHelper may be merged into SettingsPatch in some way or another; it is exclusively used for that purpose, IIRC
  • Resolve API breaking changes (Unlikely possible, but I really don't want to bump major again)
  • Implement options for the patches currently existing in YouTube Music
  • For some reason the YouTube Music icon is shown in the settings screen, hide it
  • IDE has messed up indentations in strings.xml, maybe fix them, but IDEs have the option to hide such changes in the diff viewer:
    image

<string name="revanced_debug_toast_on_error_summary_on">Toast shown if error occurs</string>
<string name="revanced_debug_toast_on_error_summary_off">Toast not shown if error occurs</string>
<string name="revanced_debug_toast_on_error_user_dialog_message">Turning off error toasts hides all ReVanced
error notifications.\n\nYou will not be notified of any unexpected events.
Copy link
Contributor

@LisoUseInAIKyrios LisoUseInAIKyrios Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the strings were extracted a month ago, I noticed that if the strings have line wrap spacing and new line characters (actual new line, and not \n), then the strings incorrectly show up in the settings UI with some of that formatting.

I did not take a screen shot of it, but every summary string with \n would incorrectly show a space or two between the \n and the text after it.

Removing the extra line wrapping and indentation fixed the summary text layout.

It's not so pretty, but using no line wrapping may be needed.

Copy link
Contributor

@LisoUseInAIKyrios LisoUseInAIKyrios Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's just an issue with using \n character with indentation immediately before or after it. Maybe it'll work if there's only 1 indentation after the tag such as:

<string name="revanced_debug_toast_on_error_user_dialog_message">
        Turning off error toasts hides all ReVanced error notifications.\n\nYou will not be notified of any unexpected events.</string>

But I haven't looked into this.

@oSumAtrIX oSumAtrIX force-pushed the dev branch 3 times, most recently from d964b8f to fd27725 Compare February 23, 2024 01:55
# Conflicts:
#	src/main/kotlin/app/revanced/patches/youtube/misc/debugging/DebuggingPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsResourcePatch.kt
#	src/main/resources/addresources/values/strings.xml
@YT-Advanced
Copy link

YT-Advanced commented Mar 19, 2024

In YTM v6.43+, Google removed FullStackTraceActivity. However, we can use GoogleApiActivity as a replacement

@LisoUseInAIKyrios
Copy link
Contributor

ThemeHelper is old code when dark mode was not well supported on Android, but things are different now.

Maybe ThemeHelper can be deleted/modified to use the newer Android methods such as here

@oSumAtrIX
Copy link
Member Author

That could work. What about apps for older Android versions?

@LisoUseInAIKyrios
Copy link
Contributor

Actually, the library methods for night mode detection has been around since Android 2.2 (2010 Froyo).

Should be no issue with older devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants