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

For #22534 - Show history highlights and groups in "Recently visited" #22535

Merged
merged 7 commits into from Nov 29, 2021
Merged

For #22534 - Show history highlights and groups in "Recently visited" #22535

merged 7 commits into from Nov 29, 2021

Conversation

Mugurell
Copy link
Contributor

@Mugurell Mugurell commented Nov 22, 2021

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

  • 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

@Mugurell Mugurell requested review from a team as code owners November 22, 2021 17:29
@Mugurell Mugurell added the needs:review PRs that need to be reviewed label Nov 22, 2021
* @param onRecentVisitClick Invoked when the user clicks on a recent visit.
*/
@Composable
private fun RecentlyVisitedHighlight(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private fun RecentlyVisitedHighlight(
private fun RecentlyVisitedHistoryHighlight(

I don't know if this adds clarity, maybe?

Copy link
Contributor Author

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!

/**
* Recent items divider.
*
* @param modifier [Modifier] allowing to perfectly place this.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @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.

Copy link
Contributor Author

@Mugurell Mugurell Nov 22, 2021

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.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @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.

Copy link
Contributor

@csadilek csadilek left a 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.

@csadilek
Copy link
Contributor

@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.)

@mergify
Copy link
Contributor

mergify bot commented Nov 24, 2021

This pull request has conflicts when rebasing. Could you fix it @Mugurell? 🙏

@gabrielluong
Copy link
Member

Will do my final pass tomorrow.

@Mugurell Mugurell removed the needs:review PRs that need to be reviewed label Nov 25, 2021
@Mugurell
Copy link
Contributor Author

After syncing with Christian I've updated the PR with sorting highlights and groups together.
Tested and it works but there is still a bit of cleanup needed and have to also add unit tests.

Copy link
Contributor

@csadilek csadilek left a 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!

@gabrielluong
Copy link
Member

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.

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2021

This pull request has conflicts when rebasing. Could you fix it @Mugurell? 🙏

@mergify
Copy link
Contributor

mergify bot commented Nov 26, 2021

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.
Copy link
Contributor

@csadilek csadilek left a 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.
Copy link
Contributor

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.
Copy link
Contributor

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 {
Copy link
Member

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.

Copy link
Member

@gabrielluong gabrielluong left a 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.

Comment on lines +32 to +34
/**
* Callback for when the "Show all" link is clicked.
*/
Copy link
Member

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.

gabrielluong and others added 2 commits November 29, 2021 13:59
…sitsFeature.kt

Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
…sitsFeature.kt

Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
@csadilek csadilek added the pr:needs-landing-squashed PRs that are ready to land (squashed) [Will be merged by Mergify] label Nov 29, 2021
@mergify mergify bot merged commit 5c3fedd into mozilla-mobile:main Nov 29, 2021
@Mugurell Mugurell deleted the hhPolish branch January 12, 2022 15:16
pkirakosyan pushed a commit to gexsi/user-agent-android that referenced this pull request Mar 7, 2022
…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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:needs-landing-squashed PRs that are ready to land (squashed) [Will be merged by Mergify]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants