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

[Redesign] Delete from Server Button Cleanup #1098

Open
wants to merge 6 commits into
base: redesign
Choose a base branch
from

Conversation

Komodo5197
Copy link

I've cleaned up the logic for the delete from server button on album/playlist screens and moved it all under DownloadButton. We now properly show the lock button on incidental downloads. I've refactored the canDeleteFromServer check into a provider while doing so to make usage cleaner and reduce repeated requests.

Also, I noticed we seemed to be using the 'tracks' directory in the download migration code, so I fixed that.

@@ -24,8 +24,9 @@ import 'jellyfin_api_helper.dart';

part 'downloads_service_backend.g.dart';

const FINAMP_BASE_DOWNLOAD_DIRECTORY =
"songs"; //!!! don't ever change this without implementing a migration, it will break existing downloads
// This is used during migration from the legacy hive download storage and cannot be changed without mitigations
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this generally used for the downloads system still, not just during migrations? The previous warning message seemed a bit more accurate.

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe a mix of both? Add a clear warning, but keep the newly-added details about what it's used for?

Copy link
Author

Choose a reason for hiding this comment

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

It's used to calculate paths for newly downloaded items, but then that gets included in the saved path string, so changing it shouldn't break old downloads, it just creates a new folder for newly added ones.

@Chaphasilor
Copy link
Collaborator

Thanks for adding the fixes! The whole riverpod provider stuff still looks a bit convoluted to me (not your code, just the architecture in general); I can understand the code, but wouldn't have a clue how to properly write them from scratch.
Were you already familiar with them before, or did you find any good resources? I found the docs to be a bit lacking...

@Komodo5197
Copy link
Author

Komodo5197 commented Mar 9, 2025

I wasn't familiar with riverpod, or flutter as a whole, before this. I didn't find anything particularly special, just read the docs and did some experimentation. There's still a lot I don't understand as well - a lot of my use cases are just repeats of the same pattern where I wrap a future in a non-future provider to give it a default value. Also, whatever I was doing with the theme providers hasn't really turned out too well so far.

…ly take BaseItemDtos instead of using the wrapper class. This requires changing the BaseItemDto class so that instances with the same id are considered equal, but I don't believe the default behaviour of checking if the objects are the same instance was used.
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