For #22534 - Show history highlights and groups in "Recently visited" #22535
Conversation
app/src/main/java/org/mozilla/fenix/historymetadata/HistoryMetadataFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/historymetadata/HistoryMetadataFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/controller/RecentVisitsController.kt
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/controller/RecentVisitsController.kt
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/interactor/RecentVisitsInteractor.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt
Outdated
Show resolved
Hide resolved
* @param onRecentVisitClick Invoked when the user clicks on a recent visit. | ||
*/ | ||
@Composable | ||
private fun RecentlyVisitedHighlight( |
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.
private fun RecentlyVisitedHighlight( | |
private fun RecentlyVisitedHistoryHighlight( |
I don't know if this adds clarity, maybe?
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.
Inside the same same file I'd say the impact is small but this aligns the naming to the other RecentlyVisitedHistoryGroup
composable. Thanks!
app/src/main/java/org/mozilla/fenix/home/recentvisits/view/RecentlyVisited.kt
Outdated
Show resolved
Hide resolved
/** | ||
* Recent items divider. | ||
* | ||
* @param modifier [Modifier] allowing to perfectly place this. |
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.
* @param modifier [Modifier] allowing to perfectly place this. | |
* @param modifier Optional [Modifier] to be applied to the layout. |
Using one of your previous kDoc description so we hopefully don't keep rewording this differently everywhere.
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 would't say this is optional.
Thought about even not providing a default here to force users pass a Modifier.
Saw there are differences in how this composable should be placed depending on which type of history is shown so while a Modifier could control a lot of different options that comment should hint to the users that it is intended to help place this appropriately.
* The title of a recent visit. | ||
* | ||
* @param text [String] that will be display. Will be ellipsized if cannot fit on one line. | ||
* @param modifier [Modifier] allowing to perfectly place this. |
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.
* @param modifier [Modifier] allowing to perfectly place this. | |
* @param modifier Optional [Modifier] to be applied to the layout. |
Using one of your previous kDoc description so we hopefully don't keep rewording this differently everywhere.
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
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.
@Mugurell another thing here is that we can't land ship this without some form of removal. I know the longer term plan is being discussed (likely via a block list or similar), but short-term we can do the same as we do for groups and simply show a remove option and delete all metadata for that highlight/url.
So, for groups we call: https://github.com/mozilla-mobile/android-components/blob/main/components/browser/storage-sync/src/main/java/mozilla/components/browser/storage/sync/PlacesHistoryStorage.kt#L320
And we'd add a similar call which we'd invoke when removing highlights.
@Mugurell opened a PR to add this removal API we should use in the interim for deleting highlights: mozilla-mobile/android-components#11307 (Talked to Nicole as well, we can talk about a better removal/delete approach separately.) |
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
This pull request has conflicts when rebasing. Could you fix it @Mugurell? 🙏 |
Will do my final pass tomorrow. |
After syncing with Christian I've updated the PR with sorting highlights and groups together. |
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.
Algorithm and feature logic look good to me! I left a few suggestions / nits for naming I would prefer updating before landing.
I think this can land once cleanup is addressed and tests are added, if @gabrielluong is fine with the UI bits!
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
Was told to wait until tomorrow for my review to see the final state of the changes. Otherwise, I was also informed that we should wait to land on Monday so that nothing breaks on the weekend. |
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
This pull request has conflicts when rebasing. Could you fix it @Mugurell? 🙏 |
This pull request has conflicts when rebasing. Could you fix it @Mugurell? 🙏 |
For now the metadata groups don't support scoring so as an interim solution we will show up to 9 items, evenly distributes, first favoring groups sorted by date then history highlights pre-sorted by default. Tapping a history highlight will switch to it's already open tab if available or create a new one in which to load it if needed. A "Remove" option will also be available for history highlights to remove it from the screen and also from history. Currently removing a group / highlight will not query new ones to again show up to 9 items, this will be implemented separately.
The updated feature supports more than history metadata so updating the overall naming scheme seems needed. To signal that this is a homescreen feature the entire package is moved to home
…e screen Saw failures about not finding the collection section on screen. This is probably happening because w are now adding the recent visits to homescreen above the collections section pushing it off screen. Since the collections might be obstructed by the toolbar shown on top as a quick solution we'll scroll to the next homescreen section so that the collections will be shown above in their entirety.
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 now! I also did some more manual testing and everything worked as expected.
@gabrielluong can you take a look as well esp. at the compose bits and refactorings. Unless you spot a blocker I'd say let's land this to get some bake time in Nightly.
} | ||
|
||
/** | ||
* Perform an in-memory mapping of a history highlight to metadata records to compute it's last access time. |
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.
nit: its.
|
||
/** | ||
* Maps the internal highlights and search groups to the final objects to be returned. | ||
* Items will be sorted by their last accessed date so that the most recent wil be first. |
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.
nit: will.
|
||
// TODO: Needs testImplementation 'androidx.compose.ui:ui-test-junit4:1.0.0-beta04' | ||
@Suppress("ForbiddenComment") | ||
class HistoryMetadataViewHolderTest { | ||
class RecentBookmarksViewHolderTest { |
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.
Hmm I don't think this is about RecentBookmarks, but I am not gonna block this from landing since you're on holiday.
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.
Looking back at this entire review, I think I would recommend breaking out some of the commits into their own PR next time. For example, the renaming refactor could've been in a separate PR that landed ahead and outside the feature. One of the final checks I was doing (as I am writing this) was to see if the refactoring preserved the git history since there were also additional refactoring on top of the renaming, which made it appear as a completely new file on the GitHub UI. For context, there were some menu item changes in RecentlyVisited
that I am aware of that needs to be corrected and losing that history would be a bit of an inconvenience.
/** | ||
* Callback for when the "Show all" link is clicked. | ||
*/ |
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 would revert these to going back to @see RecentVisitsInteractor.onHistoryShowAllClicked in another PR since the content are the same. That way we can just focus on changing it once.
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt
Outdated
Show resolved
Hide resolved
…sitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
…sitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
…ently visited" (mozilla-mobile#22535) * For mozilla-mobile#22534 - Update homescreen section name to "Recently visited" * For mozilla-mobile#22534 - Show both history highlights and groups in Recently visited For now the metadata groups don't support scoring so as an interim solution we will show up to 9 items, evenly distributes, first favoring groups sorted by date then history highlights pre-sorted by default. Tapping a history highlight will switch to it's already open tab if available or create a new one in which to load it if needed. A "Remove" option will also be available for history highlights to remove it from the screen and also from history. Currently removing a group / highlight will not query new ones to again show up to 9 items, this will be implemented separately. * For mozilla-mobile#22534 - Rename and refactor historymetadata to recentvisits The updated feature supports more than history metadata so updating the overall naming scheme seems needed. To signal that this is a homescreen feature the entire package is moved to home * For mozilla-mobile#22534 - Update UI tests to account for the new items space on the screen Saw failures about not finding the collection section on screen. This is probably happening because w are now adding the recent visits to homescreen above the collections section pushing it off screen. Since the collections might be obstructed by the toolbar shown on top as a quick solution we'll scroll to the next homescreen section so that the collections will be shown above in their entirety. * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com> Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
For now the metadata groups don't support scoring so as an interim solution we
will show up to 9 items, evenly distributes, first favoring groups sorted by date
then history highlights pre-sorted by default.
Tapping a history highlight will switch to it's already open tab if available
or create a new one in which to load it if needed.
A "Remove" option will also be available for history highlights to remove it from
the screen and also from history.
Currently removing a group / highlight will not query new ones to again show up to
9 items, this will be implemented separately.
The updated feature supports more than history metadata so updating the overall
naming scheme seems needed.
To signal that this is a homescreen feature the entire package is moved to home.
RecentVisitsOnHomescreen.mp4
Pull Request checklist
To download an APK when reviewing a PR: