nuclear icon indicating copy to clipboard operation
nuclear copied to clipboard

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

Open u7630748 opened this issue 1 year ago • 4 comments

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

Watch the demo video

u7630748 avatar Oct 16 '24 06:10 u7630748

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.

nukeop avatar Oct 16 '24 09:10 nukeop

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 avatar Oct 16 '24 10:10 u7630748

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

u7630748 avatar Oct 16 '24 11:10 u7630748

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

nukeop avatar Oct 16 '24 12:10 nukeop

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

nukeop avatar Oct 16 '24 19:10 nukeop