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

Handle duplicate streams in the "Add to playlist" dialog #9538

Merged
merged 10 commits into from
Jan 29, 2023

Conversation

Jared234
Copy link
Contributor

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Indicator added to the "Add to playlist" dialog to alert users if they are attempting to add a duplicate stream
  • AlertDialog opens if a user tries to add the same stream to the same playlist, allowing them to confirm or cancel their action

This helps prevent users from accidentally adding the same stream multiple times to their playlist, but stills allows them do it if they intend to do so.

Before/After Screenshots/Screen Record

  • Before: The "Add to playlist" dialog did not handle duplicate streams properly. When a user attempted to add a duplicate stream, they were not warned or given any indication that the stream was a duplicate. This allowed users to unknowingly add the same stream multiple times to their playlist.
  • After:
    If a user attempts to add a stream to a playlist twice, the playlist will be grayed out to indicate that it is a duplicate:

Screenshot_20221212-225124

If a user attempts to add a stream to their playlist that is already in the playlist anyway, a dialog will appear to alert them that the stream is a duplicate and ask them if they want to proceed with adding it to the playlist:

Screenshot_20221212-225111

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

@Jared234
Copy link
Contributor Author

I was wondering if it would be possible to rerun the pipeline. All of the tests work locally, and in this pipeline the operation was cancelled without any error messages. I don't think there is a problem with the code, so could you please rerun it @AudricV?

Thank you for your help.

@opusforlife2
Copy link
Collaborator

I don't think the AlertDialog is needed? Since the user has been warned that the item will be duplicated, and there is a visual indication as well, the dialog seems overkill.

Also, for users who intentionally want to add duplicates, this would be an annoying extra step each and every time they go through with it.

Instead of an AlertDialog, I would rather go with a toast saying "Duplicate added", which also informs the user that they did indeed go ahead and add a duplicate, but doesn't need a tap for confirmation. For users who ignore/don't read the warning about the greyed out playlists, the toast would act as a second warning.

@Jared234
Copy link
Contributor Author

I see your point. The only downside to removing this dialog would be that users would not know how many duplicate videos are already in the playlist. At first glance, though, I don't know why anyone would need that information.... So I will change it.

@Jared234
Copy link
Contributor Author

I removed the duplicate dialog and if a video was already at least once in the playlist I replaced the toast message "Playlisted" with "Playlisted duplicate".

@opusforlife2
Copy link
Collaborator

how many duplicate videos are already in the playlist

"Duplicate added x time(s)"

There you go, if needed.

@AudricV AudricV added feature request Issue is related to a feature in the app playlist Anything to do with playlists in the app labels Dec 16, 2022
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thank you! I agree with @opusforlife2 on the fact that a dialog is not needed and a toast is better. Let me know if the changes I requested for the list view are comprehensible.

@Stypox Stypox force-pushed the 4186_warning_duplicates_in_playlist branch from 61a9c79 to ef4a623 Compare January 14, 2023 17:04
@Jared234 Jared234 requested a review from Stypox January 27, 2023 14:49
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

I pushed two more small commits and tested thoroughly. It seems to work well. Thank you!

@Stypox Stypox merged commit ca421c2 into TeamNewPipe:dev Jan 29, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 29, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Stypox Stypox mentioned this pull request Mar 1, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app playlist Anything to do with playlists in the app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show a warning before adding a duplicate video to a playlist
4 participants