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

Make MultiSelectEpisodesHelper not a singleton #1579

Merged
merged 4 commits into from
Dec 13, 2023

Conversation

mchowning
Copy link
Contributor

@mchowning mchowning commented Nov 30, 2023

Description

This is a follow-up to #1316. That PR contained quite a few changes, and we found other ways to address the ANRs and the worst multi-select issues, so we didn't move forward with it. We still had quite a few multi-select issues though. In particular, in my testing I observed that multi-select state was getting shared (which would cause things like the toolbar displaying the wrong number of selected items, and other multiselect bugs).

I initially tried porting over a few of the changes from #1316, but I found that they were introducing regressions. It turned out that just simply making the MultiSelectEpisodesHelper a singleton solved most of the multi-select issues I see.

This almost fixes #98, but there is still a multiselect issue with bookmarks that I'm seeing. I'm not trying to address the one remaining multi-select issue in this PR just to keep this PR small and focused.

Testing Instructions

1. Watch for ANR regressions

I think it's very unlikely that this change would cause any ANR issues, but given that we had some ANR issues the last time we made significant changes to multiselect, please keep an eye out for any unexpected slowness as you test this change

2. Mult-Select Improvement

I tested this by turning on multiselect in the first screen, navigating to the second screen, and verifying that the second screen was not put into a multiselect state. When running through these tests, make sure you clear multiselect state from the relevant screens before testing (speaking from experience, it's easy to forget to do that and then to think a subsequent test is failing when it really isn't).

Let me know if there are any other test scenarios we should be covering here.

2.1. For each test:

  1. Make sure both the start and end screens are not in multi-select mode
  2. Enter multiselection on the start screen
  3. Navigate to the end screen
  4. Verify that the end screen is not in a multi-select state

2.2. Before these changes

  1. 🔴 Podcast Bookmarks → Full Screen Player Bookmarks
  2. 🟢 Full Screen Player Bookmarks → Podcast Bookmarks
  3. 🔴 Podcast Screen → Up Next
  4. 🔴 Up Next → Podcast Screen
  5. 🔴 Downloads/Starred/Listening-History → Up Next
  6. 🔴 Up Next → Downloads/Starred/Listening-History
  7. 🔴 Files → Up Next
  8. 🔴 Up Next → Files
  9. 🟢 Downloads/Starred/Listening-History → Podcast
  10. 🟢 Podcast → Downloads/Starred/Listening-History
  11. 🟢 Files → Podcast
  12. 🟢 Podcast → Files
  13. 🟢 Viewing a podcast on Discover tab → Viewing a podcast on Podcasts tab

2.3. Expected Results After These Changes

  1. 🔴 Podcast Bookmarks → Full Screen Player Bookmarks
  2. 🟢 Full Screen Player Bookmarks → Podcast Bookmarks
  3. 🟢 Podcast Screen → Up Next
  4. 🟢 Up Next → Podcast Screen
  5. 🟢 Downloads/Starred/Listening-History → Up Next
  6. 🟢 Up Next → Downloads/Starred/Listening-History
  7. 🟢 Files → Up Next
  8. 🟢 Up Next → Files
  9. 🟢 Downloads/Starred/Listening-History → Podcast
  10. 🟢 Podcast → Downloads/Starred/Listening-History
  11. 🟢 Files → Podcast
  12. 🟢 Podcast → Files
  13. 🟢 Viewing a podcast on Discover tab → Viewing a podcast on Podcasts tab

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews

@mchowning mchowning added this to the 7.54 milestone Nov 30, 2023
@mchowning mchowning added the [Type] Bug Not functioning as intended. label Nov 30, 2023
@mchowning mchowning marked this pull request as ready for review November 30, 2023 21:33
@mchowning mchowning requested a review from a team as a code owner November 30, 2023 21:33
@CookieyedCodes
Copy link

Reminder I do find that upnext & downloads haveing a multiselect being shared quite helpful 😅

@mchowning
Copy link
Contributor Author

I haven't forgotten @CookieyedCodes . 🙂 If the up next queue showed whether each episode downloaded or not, would you still need to use multiselect shared across the two screens?

@CookieyedCodes
Copy link

Gud gud 😊 @mchowning ,
Upnext dose show wether an episode is downloaded or not tho & to me that clear enough 😅
Screenshot_2023-11-30-22-37-29-92_28ad70af3b47247953fcd94176b9a9c1.jpg

I am mainly useing it to distinguish between what podcasts are in upnext & what are not, ie if I'm deciding if something is to be added to the que & is quicker then hunt & pecking the blue icon under downloads 😅

@mchowning mchowning modified the milestones: 7.54, 7.55 Dec 11, 2023
Copy link
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

This is working well in my testing. 👍

One issue I noticed:

Earlier MultiSelectEpisodesHelper inside MainActivity was used to dismiss the multi-select toolbar from the UpNext dialog instead of dismissing the dialog itself on a back gesture. It is redundant now as both do not share multi-select state.

Video from this PR

upnext_back_nav_now.mp4

Video from the app in production

upnext_back_nav_expected.mp4

I tried to fix this behavior in these commits:
f018992
38b1711

It also fixed the back behavior for multi-select toolbar on Episode Details and bookmarks from the Files bottom sheet. We can cherry-pick the changes here or I can create a new PR if you want.

mchowning and others added 4 commits December 12, 2023 10:30
This will cause back stack issues for bottom sheet dialog fragments with multi select. That means, if a bottom sheet dialog fragment is multi selecting, then on back press, it will just dismiss the dialog rather than closing the multi-select toolbar.

This is fixed in the next commit.
@mchowning mchowning force-pushed the fix/multiselect-shared-state branch from 3694267 to 11a22f2 Compare December 12, 2023 15:32
@mchowning mchowning changed the base branch from main to release/7.54 December 12, 2023 15:32
@mchowning
Copy link
Contributor Author

One issue I noticed:

Earlier MultiSelectEpisodesHelper inside MainActivity was used to dismiss the multi-select toolbar from the UpNext dialog instead of dismissing the dialog itself on a back gesture. It is redundant now as both do not share multi-select state.

I tried to fix this behavior in these commits...
f018992
38b1711

It also fixed the back behavior for multi-select toolbar on Episode Details and bookmarks from the Files bottom sheet. We can cherry-pick the changes here or I can create a new PR if you want.

Good catch and those changes look great. I've added them to this PR.

@mchowning
Copy link
Contributor Author

mchowning commented Dec 12, 2023

You mentioned on Slack that you were interested in adding this to 7.54 since it's going to be a longer code freeze. I've updated the PR to build on release/7.54 and updated the PR to target release/7.54. I'll hold off on merging this just to give you a chance to make sure that this still looks still looks good to you with the changes I've made.

The changes I've made since your review are:

  1. Cherry-picked the changes from my PR to be on top of release/7.54 instead of main
  2. Cherry-picked your two commits onto this branch
  3. Resolved a merge conflict in the CHANGELOG.md file
  4. Updated the PR to target release/7.54

@ashiagr ashiagr merged commit 335fd30 into release/7.54 Dec 13, 2023
10 checks passed
@ashiagr ashiagr deleted the fix/multiselect-shared-state branch December 13, 2023 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Not functioning as intended.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-Select not always clearing
3 participants