-
Notifications
You must be signed in to change notification settings - Fork 1.3k
For #15931: Sort Downloads from newest to oldest #15939
For #15931: Sort Downloads from newest to oldest #15939
Conversation
No Taskcluster jobs started for this pull requestThe `allowPullRequests` configuration for this repository (in `.taskcluster.yml` on the
default branch) does not allow starting tasks for this pull request. |
2b63e5f
to
9c15f97
Compare
@joc-a Thank you for the contribution! Would you be able to post some screenshots for a ux-review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch 👍🏽
It looks great, a left one comment before approving ✅
it.status == DownloadState.Status.COMPLETED | ||
}.filterNotExistsOnDisk() | ||
val items = requireComponents.core.store.state.downloads.values | ||
.sortedByDescending { it.createdTime } // sort from newest to oldest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a test to cover the new feature? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'll try my hand at writing a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much experience writing tests, but I thought I'd give it a shot.
I added createdTime
field to DownloadItem and tried with the following code I wrote in DownloadControllerTest:
@Test
fun `downloads are sorted from newest to oldest`() {
val testList = state.items
val expectedList = testList.sortedByDescending { it.createdTime }
assertEquals(testList, expectedList)
}
But that didn't work. I'm very new to this so maybe I'm not approaching this the right way, but I'd be happy to get some guidance! 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Amejia481 Done, thanks so much!
Can we wait to land this? This could potentially cause conflicts with the large Delete Downloads PR I am wrapping up. |
Codecov Report
@@ Coverage Diff @@
## master #15939 +/- ##
============================================
+ Coverage 29.68% 29.77% +0.08%
Complexity 1195 1195
============================================
Files 453 453
Lines 18555 18535 -20
Branches 2544 2536 -8
============================================
+ Hits 5508 5518 +10
+ Misses 12625 12594 -31
- Partials 422 423 +1
Continue to review full report at Codecov.
|
a59dc6c
to
78f6cf6
Compare
If your changes addressed the comments, please tag the reviewer for another review! In order for UX to sign off, please also add a screenshot. Thanks for your help @joc-a ! |
sort downloads from newest to oldest based on createdTime
78f6cf6
to
bcc22fe
Compare
add a test to make sure downloads are sorted from newest to oldest
bcc22fe
to
e362103
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me,
@kglazko do you still want to wait for your pr to land?
Pull Request checklist
To download an APK when reviewing a PR:
Downloads are now sorted from newest to oldest based on createdTime.
This is how the downloads appear in the notifications on the phone (sorted from newest to oldest):
This is how the downloads now appear on Fenix (the same order as above):