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

Feature Request (#1091) - Auto-Download Favorite Tracks #1723

Merged
merged 7 commits into from
Oct 16, 2024

Conversation

u7630748
Copy link
Contributor

@u7630748 u7630748 commented Oct 16, 2024

Description

This PR adds an auto-download feature for favorite tracks, allowing users to build their offline library more conveniently. A new toggle button is introduced in the settings menu to let users choose if they want to automatically download tracks when favoriting them.

fix #1091

Changes Made

  1. Added Toggle Button in Settings:

    • Users can now enable or disable auto-download for favorite tracks.
    • Behavior:
      • Default setting as disable
      • When enabled, all future tracks marked as favorite will be downloaded automatically.
      • Tracks favorited before enabling the toggle will not be downloaded to avoid duplicate downloads.
  2. Updated Language Files:

    • Added "auto-download-favourites": "Auto download favorite track" to all language JSON files.
    • All translations (except ZH_CN and ZH_TW) use English to avoid translation errors.
    • ZH_CN and ZH_TW have been properly translated since I am fluent in these languages.

Testing

image

Screen Recording

Video
Screen.Recording.2024-10-15.at.3.33.54.PM.mov

@nukeop
Copy link
Owner

nukeop commented Oct 16, 2024

Hey, since this is a feature that impacts quite a few things, could you add a test for it? You can check the tests in packages/app/app/containers/FavoritesContainer/FavoritesContainer.tracks.test.tsx for examples. The test could setup the store so that the setting is enabled, and then you could try adding a new favorite track and check that it was added to the downloads queue (so you would only have to tests components in the app package without worrying about the interaction with the backend in main).

Also, please update the failing snapshot (I think you forgot to update it when you added the translated string).

If you need any help with tests, I can help you.

@u7630748
Copy link
Contributor Author

Hey, since this is a feature that impacts quite a few things, could you add a test for it? You can check the tests in packages/app/app/containers/FavoritesContainer/FavoritesContainer.tracks.test.tsx for examples. The test could setup the store so that the setting is enabled, and then you could try adding a new favorite track and check that it was added to the downloads queue (so you would only have to tests components in the app package without worrying about the interaction with the backend in main).

Also, please update the failing snapshot (I think you forgot to update it when you added the translated string).

If you need any help with tests, I can help you.

I will have a try now. Thanks a lot for the comments :)

@u7630748
Copy link
Contributor Author

May I know which file you'd prefer me to add the test to?
packages/app/app/containers/FavoritesContainer/FavoritesContainer.tracks.test.tsx
packages/app/app/containers/DownloadsContainer/DownloadsContainer.test.tsx

@nukeop
Copy link
Owner

nukeop commented Oct 16, 2024

DownloadsContainer doesn't take part in this functionality, so wherever this happens (wherever you want to add a track to favorites from)

@nukeop
Copy link
Owner

nukeop commented Oct 16, 2024

Fantastic work, this is exactly what I had in mind. Thank you for your contribution.

@nukeop nukeop merged commit 9c137f6 into nukeop:master Oct 16, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants