Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

For #352: Delete a download #15577

Merged
merged 1 commit into from
Nov 4, 2020

Conversation

kglazko
Copy link
Contributor

@kglazko kglazko commented Sep 30, 2020

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@gabrielluong gabrielluong added pr:work-in-progress PRs that are not ready to be reviewed yet and are actively being worked on and removed pr:do-not-land labels Oct 1, 2020
@Amejia481 Amejia481 self-requested a review October 1, 2020 14:03
@Amejia481 Amejia481 self-assigned this Oct 1, 2020
Copy link
Contributor

@eliserichards eliserichards left a comment

Choose a reason for hiding this comment

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

Ok, whew. This is a big PR 😄 I think this is a great start. Let's focus on the simple case of deleting one item at a time and file a followup to handle multi-select. I think that will help us see the next steps more clearly

@kglazko kglazko force-pushed the PreserveViewDownloadsMenus branch 2 times, most recently from 719ce28 to 7fc12ab Compare October 15, 2020 21:59
@kglazko kglazko changed the title WIP: Delete Downloads For #352: Delete a download Oct 15, 2020
@kglazko kglazko marked this pull request as ready for review October 15, 2020 22:16
@kglazko kglazko requested review from a team as code owners October 15, 2020 22:16
@kglazko
Copy link
Contributor Author

kglazko commented Oct 15, 2020

Changes: Delete one, Delete Multi, and Delete All now work. Sometimes there is a weird issue with the UI not updating to show the disappeared downloads right away, need extra eyes to figure out why.

@codecov-io
Copy link

codecov-io commented Oct 15, 2020

Codecov Report

Merging #15577 into master will decrease coverage by 0.12%.
The diff coverage is 11.86%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #15577      +/-   ##
============================================
- Coverage     30.03%   29.91%   -0.13%     
- Complexity     1207     1213       +6     
============================================
  Files           453      454       +1     
  Lines         18516    18686     +170     
  Branches       2548     2571      +23     
============================================
+ Hits           5562     5590      +28     
- Misses        12522    12664     +142     
  Partials        432      432              
Impacted Files Coverage Δ Complexity Δ
...ozilla/fenix/library/downloads/DownloadFragment.kt 11.01% <0.00%> (-17.88%) 1.00 <0.00> (ø)
...ozilla/fenix/library/downloads/DownloadItemMenu.kt 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...rg/mozilla/fenix/library/downloads/DownloadView.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...wnloads/viewholders/DownloadsListItemViewHolder.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...mozilla/fenix/library/downloads/DownloadAdapter.kt 40.90% <20.00%> (-12.94%) 4.00 <1.00> (+1.00) ⬇️
...a/fenix/library/downloads/DownloadFragmentStore.kt 53.48% <36.00%> (+11.38%) 1.00 <0.00> (+1.00)
...illa/fenix/library/downloads/DownloadController.kt 75.00% <100.00%> (+17.85%) 0.00 <0.00> (ø)
...illa/fenix/library/downloads/DownloadInteractor.kt 100.00% <100.00%> (+40.00%) 8.00 <5.00> (+5.00)
...a/org/mozilla/fenix/browser/BaseBrowserFragment.kt 7.25% <0.00%> (-0.70%) 8.00% <0.00%> (-1.00%)
...c/main/java/org/mozilla/fenix/StrictModeManager.kt 83.78% <0.00%> (ø) 7.00% <0.00%> (ø%)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a12d1a...d9d1be5. Read the comment docs.

itemView.download_layout.titleView.text = item.fileName
itemView.download_layout.urlView.text = item.size.toLong().toMegabyteOrKilobyteString()

toggleTopContent(showDeleteButton, mode === DownloadFragmentState.Mode.Normal)
Copy link
Contributor

Choose a reason for hiding this comment

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

= = = ? what does the triple = do :O

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this is necessary here (re: our convo earlier). Let's just leave this as-is for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here you can find some docs around the equality operators, in summary === is comparing based on reference, vs == that compare based on equals, in this case either will work asDownloadFragmentState.Mode.Normal is an object it has only one reference (it's a singleton), I would prefer if we could use == as it will have the same effect and avoid the inherited complexity of ===.

@eliserichards eliserichards added the pr:needs-changes PRs that need some changes/fixes before they can land label Oct 16, 2020
@Amejia481
Copy link
Contributor

Amejia481 commented Oct 20, 2020

@kglazko could we add some test to cover this new functionality? It will help to avoid future regression :)

@Amejia481
Copy link
Contributor

@kglazko are there any UI mockups ?

@gabrielluong gabrielluong removed the pr:work-in-progress PRs that are not ready to be reviewed yet and are actively being worked on label Oct 22, 2020
Copy link
Contributor

@eliserichards eliserichards left a comment

Choose a reason for hiding this comment

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

Following up on our conversation with @boek and @Amejia481 earlier, our action items here are to:

  • add some comments/kdocs to these files explaining how the pending deletion functions (@kglazko)
  • file an issue for refactoring downloads, history, bookmarks, etc to improve clarity and code quality (@eliserichards)

Copy link
Contributor

@eliserichards eliserichards left a comment

Choose a reason for hiding this comment

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

There are a few nits from the last few rounds that still need to be cleaned up, but this is looking fantastic! Once those nits are taken care of I want to come back and do some manual testing (which I'll probably ask your help on)

@kglazko kglazko force-pushed the PreserveViewDownloadsMenus branch 2 times, most recently from b8964bf to 13e0817 Compare November 2, 2020 18:41
@Amejia481 Amejia481 self-requested a review November 3, 2020 21:45
Copy link
Contributor

@Amejia481 Amejia481 left a comment

Choose a reason for hiding this comment

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

It looks good to me!
In a follow up we can increase the code coverage for this feature :)

There is a ktlint issue.

[task 2020-11-02T18:44:32.550Z] > Task :ktlint
[task 2020-11-02T18:44:32.550Z] /builds/worker/checkouts/src/app/src/main/java/org/mozilla/fenix/library/downloads/viewholders/DownloadsListItemViewHolder.kt:21:1: Unused import
[task 2020-11-02T18:44:34.849Z] 
[task 2020-11-02T18:44:34.850Z] > Task :ktlint FAILED
[task 2020-11-02T18:44:34.851Z] 
[task 2020-11-02T18:44:34.851Z] FAILURE: Build failed with an exception.
[task 2020-11-02T18:44:34.851Z] 

@kglazko kglazko removed the request for review from eliserichards November 3, 2020 22:23
@eliserichards
Copy link
Contributor

Yayyyyy! This is ready to go! 🥇

@kglazko kglazko removed the pr:needs-changes PRs that need some changes/fixes before they can land label Nov 4, 2020
@kglazko kglazko merged commit 0ae2689 into mozilla-mobile:master Nov 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants