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

Add confirmation dialog before deleting downloaded album #197

Merged
merged 16 commits into from
Dec 5, 2023

Conversation

rom4nik
Copy link
Contributor

@rom4nik rom4nik commented Mar 7, 2022

Fixes #165.

For some reason the delete button isn't replaced with download button until dialog is shown again, haven't been able to figure out why. Maybe a race condition between _downloadsHelper.deleteDownloads and _downloadsHelper.isAlbumDownloaded called a little bit too early?

preview.mp4

@jmshrv
Copy link
Owner

jmshrv commented Mar 13, 2022

I'm pretty sure the method I used to switch between the download/delete button was very jank anyway, I'll have a look and see how I did it :)

@rom4nik rom4nik force-pushed the confirm-album-deletion branch from 2486579 to 1a660da Compare May 18, 2022 15:54
@rom4nik
Copy link
Contributor Author

rom4nik commented May 18, 2022

I found a workaround - .whenComplete in DownloadButton runs after confirmation dialog disappears, so if you delay hiding dialog until all downloads get deleted, the button will change icon to trash can as expected. However, dialog staying on screen might be annoying if you want to delete an album with many songs.

@rom4nik rom4nik marked this pull request as ready for review May 18, 2022 16:26
@jmshrv
Copy link
Owner

jmshrv commented May 18, 2022

Just realised a better way of doing this - the delete dialog could just return a bool specifying whether or not the delete was confirmed. Deleting downloads should be fast enough that someone can't go and start the download before the delete is done, but if we want to be super safe we could have the dialog return the deleteDownloads future and the download button could disable itself until that future is complete.

@Chaphasilor
Copy link
Collaborator

Chaphasilor commented Oct 12, 2023

Interestingly I was able to push commits to this PR 😁
I updated the dialog logic, the dialog now accepts two callbacks, onConfirmed and onAborted, that can be used to perform an action based on which button was pressed. Also rebased it so that it can be merged.

Now I'd like to:

  • Make the dialog more generic, to support artists, playlists, etc.
  • Add proper localization for the used strings
  • Use the dialog on the "Downloads" screen as well

Sounds good?

@Chaphasilor Chaphasilor self-assigned this Nov 26, 2023
@Chaphasilor
Copy link
Collaborator

This should be ready for prime time now. @rom4nik if you don't mind, please take another look at my changes and check if there's anything I've missed!

@Chaphasilor
Copy link
Collaborator

I just noticed that I completely glossed over the trash icon not changing back to the download icon after deletion. So I guess I'll take another look at this tomorrow...

@Chaphasilor
Copy link
Collaborator

Okay, should be fine now :)

@rom4nik
Copy link
Contributor Author

rom4nik commented Dec 1, 2023

Looks good to me, thanks for fixing up this PR!

Some things I've noticed:

  1. There's no similar dialog when I'm removing album songs one by one on the Downloads screen, I'm not sure if that's intended.

obraz

  1. No confirmation when I press the delete on artist view.
  2. Delete button in artist view keeps the trashcan icon after deleting songs.
  3. Same issue as 3 and 4 in genre view.

I'm not sure if 2-4 are in scope of this PR, just FYI.

@Chaphasilor
Copy link
Collaborator

  1. Haha I didn't even know you could expand the items to show individual tracks 🙃
    I'll add the confirmation later, including the additional translation strings.

And yes, I considered 2-4 to be out-of-scope. I'll check how much work it would be to add this as well, I only noticed that the artist screen uses some different logic already...

@Chaphasilor
Copy link
Collaborator

Artists and genres used the same code, so I added the dialog to both. That means 1-4 should be fixed now.
Please confirm, then we can merge this :D

@rom4nik
Copy link
Contributor Author

rom4nik commented Dec 4, 2023

Thanks, spotted just two more issues:

  1. Genre delete dialog uses text from artist dialog 😅
  2. At least on my device the confirmation button's text is wrapped into second line - wouldn't it be sufficient to just have Delete on the button, since the dialog text already says that it'll remove downloaded song/album/artist/playlist?

Screenshot_20231204-134935_Finamp

@Chaphasilor
Copy link
Collaborator

Good catch! About the wrapping text, yeah I struggled with this a bit but wanted to emphasize that the genre is not being deleted on the server. How would you feel about "Delete files?"

@Chaphasilor
Copy link
Collaborator

I'm going to merge this once I get home. If there's anything we missed we can fix it in another PR :)

@Chaphasilor Chaphasilor merged commit a67acb9 into jmshrv:main Dec 5, 2023
2 checks passed
@rom4nik rom4nik deleted the confirm-album-deletion branch December 6, 2023 22:28
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.

UX: Confirmation for deleting downladed music
3 participants