nuclear
nuclear copied to clipboard
Feature Request (#1091) - Auto-Download Favorite Tracks
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
-
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.
-
Updated Language Files:
- Added
"auto-download-favourites": "Auto download favorite track"to all language JSON files. - All translations (except
ZH_CNandZH_TW) use English to avoid translation errors. - ZH_CN and ZH_TW have been properly translated since I am fluent in these languages.
- Added
Testing
Screen Recording
Video
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.
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.tsxfor 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 theapppackage without worrying about the interaction with the backend inmain).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 :)
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
DownloadsContainer doesn't take part in this functionality, so wherever this happens (wherever you want to add a track to favorites from)
Fantastic work, this is exactly what I had in mind. Thank you for your contribution.