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

For #11404 - Add 'Open all' options in bookmarks #27138

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

rocketsroger
Copy link
Contributor

@rocketsroger rocketsroger commented Sep 23, 2022

This is to re-land #21212

  • Add "Open all in new tabs" options in bookmarks
  • Add "Open all in private tabs" options in bookmarks
  • Add metrics tracking if the usage of "Open all in..." in bookmarks

Co-authored-by: Pg pg.developper.fr@gmail.com

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.

QA

  • QA Needed

To download an APK when reviewing a PR (after all CI tasks finished running):

  1. Click on Checks at the top of the PR page.
  2. Click on the firefoxci-taskcluster group on the left to expand all tasks.
  3. Click on the build-debug task.
  4. Click on View task in Taskcluster in the new DETAILS section.
  5. The APK links should be on the right side of the screen, named for each CPU architecture.

GitHub Automation

Fixes #11404

@rocketsroger rocketsroger changed the title For #11404 - Add 'Open all' optionst in bookmarks For #11404 - Add 'Open all' options in bookmarks Sep 23, 2022
@rocketsroger rocketsroger force-pushed the FB_11404 branch 2 times, most recently from 0da10f1 to 469e4b8 Compare September 23, 2022 23:38
<string name="open_all_warning_title">Confirm open</string>
<!-- Message to warn users that a large number of tabs will be opened
%d is a placeholder for the number of tabs that will be opened. -->
<string name="open_all_warning_message">You are about to open %d tabs. This might slow down Firefox while the pages are loading. Are you sure you want to continue?</string>
Copy link
Contributor Author

@rocketsroger rocketsroger Sep 23, 2022

Choose a reason for hiding this comment

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

These strings are the same that's used in desktop. These will need to be reviewed.

@@ -83,6 +87,10 @@ class DefaultBookmarkController(

private val resources: Resources = activity.resources

@Suppress("MagicNumber")
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
internal val maxOpenBeforeWarn = 15
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a number that's from desktop.

@@ -58,7 +63,10 @@ class BookmarkNodeViewHolder(

containerView.urlView.isVisible = item.type == BookmarkNodeType.ITEM
containerView.setSelectionInteractor(item, mode, interactor)
menu.updateMenu(item.type)

CoroutineScope(Dispatchers.Default).launch {
Copy link
Contributor Author

@rocketsroger rocketsroger Sep 23, 2022

Choose a reason for hiding this comment

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

I'm not sure if we need to update the menu with Dispatchers.Default. This was not discussed in the original PR.

Copy link
Member

Choose a reason for hiding this comment

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

@Mugurell thoughts here?

@rocketsroger
Copy link
Contributor Author

When the bookmark folder contains more than 15 bookmarks:
Screenshot_20221004_080056

@rocketsroger rocketsroger added the needs:UX-feedback Needs UX Feedback label Oct 4, 2022
@rocketsroger
Copy link
Contributor Author

device-2022-10-11-111519.mp4

@rocketsroger rocketsroger force-pushed the FB_11404 branch 5 times, most recently from 51508b8 to 6976d1e Compare October 11, 2022 19:50
@rocketsroger rocketsroger added the needs:strings Needs strings label Oct 11, 2022
@rocketsroger rocketsroger marked this pull request as ready for review October 11, 2022 19:59
@rocketsroger rocketsroger requested review from a team as code owners October 11, 2022 19:59
@rocketsroger
Copy link
Contributor Author

Request for data collection review form

All questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.

  1. What questions will you answer with this data?
  • This data will help us understand how often user open all bookmarks in a folder.
  1. Why does Mozilla need to answer these questions? Are there benefits for users? Do we need this information to address product or business requirements?
  • We are adding new features in bookmarks to make users' interactions more efficient.
  1. What alternative methods did you consider to answer these questions? Why were they not sufficient?
  • There are no other alternatives.

  1. Can current instrumentation answer these questions?
  • No.

  1. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories found on the Mozilla wiki.

    Note that the data steward reviewing your request will characterize your data collection based on the highest (and most sensitive) category.
Measurement Description Data Collection Category Tracking Bug #
Open all in new tabs: A user opened all bookmarks in a folder in new tabs. Category 2 - interaction data #11404
Open all in private tabs: A user opened all bookmarks in a folder in private tabs. Category 2 - interaction data #11404
  1. Please provide a link to the documentation for this data collection which describes the ultimate data set in a public, complete, and accurate way.
  1. How long will this data be collected? Choose one of the following:
  • Up until version 120, with the option to renew at that point.
  1. What populations will you measure?
  • All channels, all locales, all countries

  1. If this data collection is default on, what is the opt-out mechanism for users?
  • Default Glean SDK opt-out mechanism.

  1. Please provide a general description of how you will analyze this data.
  • Glean and Glam.

  1. Where do you intend to share the results of your analysis?
  • 
Only on Glean, Glam, and with mobile teams.

  1. Is there a third-party tool (i.e. not Telemetry) that you are proposing to use for this data collection?
  • No third-party tools.

@rocketsroger rocketsroger added the needs:data-review PR is awaiting a data review label Oct 11, 2022
@eliserichards
Copy link

Request for data collection review form

All questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.

1. What questions will you answer with this data?


* This data will help us understand how often user open all bookmarks in a folder.


2. Why does Mozilla need to answer these questions? Are there benefits for users? Do we need this information to address product or business requirements?


* We are adding new features in bookmarks to make users' interactions more efficient.


3. What alternative methods did you consider to answer these questions? Why were they not sufficient?


* There are no other alternatives.


4. Can current instrumentation answer these questions?


* No.


5. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories found on the Mozilla wiki.
   
   Note that the data steward reviewing your request will characterize your data collection based on the highest (and most sensitive) category.

Measurement Description Data Collection Category Tracking Bug #
Open all in new tabs: A user opened all bookmarks in a folder in new tabs. Category 2 - interaction data #11404
Open all in private tabs: A user opened all bookmarks in a folder in private tabs. Category 2 - interaction data #11404

6. Please provide a link to the documentation for this data collection which describes the ultimate data set in a public, complete, and accurate way.


* [https://dictionary.telemetry.mozilla.org/apps/fenix
  ](https://dictionary.telemetry.mozilla.org/apps/fenix%E2%80%A8)


7. How long will this data be collected? Choose one of the following:


* Up until version 120, with the option to renew at that point.


8. What populations will you measure?


* All channels, all locales, all countries


9. If this data collection is default on, what is the opt-out mechanism for users?


* Default Glean SDK opt-out mechanism.


10. Please provide a general description of how you will analyze this data.


* Glean and Glam.


11. Where do you intend to share the results of your analysis?


* Only on Glean, Glam, and with mobile teams.


12. Is there a third-party tool (i.e. not Telemetry) that you are proposing to use for this data collection?


* No third-party tools.

Data Review Form (to be filled by Data Stewards)

  1. Is there or will there be documentation that describes the schema for the ultimate data set in a public, complete, and accurate way?

  2. Is there a control mechanism that allows the user to turn the data collection on and off? (Note, for data collection not needed for security purposes, Mozilla provides such a control mechanism) Provide details as to the control mechanism available.

    • Yes, through the "Send Usage Data" preference in the application settings.
  3. If the request is for permanent data collection, is there someone who will monitor the data over time?

    • No, the data will be collected for one year (until version 120) with the option to remove/renew.
  4. Using the category system of data types on the Mozilla wiki, what collection type of data do the requested measurements fall under?

    • Category 2 - interaction data
  5. Is the data collection request for default-on or default-off?

    • Default-on
  6. Does the instrumentation include the addition of any new identifiers (whether anonymous or otherwise; e.g., username, random IDs, etc. See the appendix for more details)?

    • No
  7. Is the data collection covered by the existing Firefox privacy notice?

    • Yes
  8. Does the data collection use a third-party collection tool? If yes, escalate to legal.

    • No

Result

data-review+

@eliserichards eliserichards removed the needs:data-review PR is awaiting a data review label Oct 11, 2022
@rocketsroger rocketsroger added the needs:review PRs that need to be reviewed label Oct 12, 2022
@topotropic
Copy link

Thanks! LGTM

@topotropic topotropic removed the needs:UX-feedback Needs UX Feedback label Oct 13, 2022
@ewachowiak
Copy link

@rocketsroger I have a suggested edit to the strings in this reminder for clarity:

HEADLINE: Open 16 tabs?
BODY: Opening this many tabs may slow down Firefox while the pages are loading. Are you sure you want to continue?

Note that the "16" would be a variable to show the correct # of tabs. The word "Firefox" should also be a variable so the correct product name (E.g. Firefox Nightly) appears.

@rocketsroger
Copy link
Contributor Author

@rocketsroger I have a suggested edit to the strings in this reminder for clarity:

HEADLINE: Open 16 tabs? BODY: Opening this many tabs may slow down Firefox while the pages are loading. Are you sure you want to continue?

Note that the "16" would be a variable to show the correct # of tabs. The word "Firefox" should also be a variable so the correct product name (E.g. Firefox Nightly) appears.

Thanks! I'll update to reflect this change.

@rocketsroger
Copy link
Contributor Author

Updated. On local builds the app name is "Firefox Fenix". Thanks
Screenshot_20221014_125906

@rocketsroger rocketsroger removed the needs:strings Needs strings label Oct 14, 2022
}

browserScreen {
// out of folder and should not be opened
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure I really follow this comment. Could this be something that we can reword for better clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I'll update and move this below to where we verify that the tab is not opened.

navigationToolbar {
}.enterURLAndEnterToBrowser(url) {
// needs to wait for the right url to load before saving a bookmark
verifyUrl(url.toString())
}.openThreeDotMenu {
}.bookmarkPage { }
}.bookmarkPage {
// continue only if a folder is defined
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
// continue only if a folder is defined
// continue only if a folder exists


when (node.type) {
BookmarkNodeType.FOLDER -> {
// if not leaf (empty) folder
Copy link
Member

@gabrielluong gabrielluong Oct 14, 2022

Choose a reason for hiding this comment

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

Could we capitalize all of these comments?

override fun handleOpeningFolderBookmarks(folder: BookmarkNode, mode: BrowsingMode) {
// potentially heavy function with a lot of bookmarks to open => use a coroutine
scope.launch {
// if more than maximum elements
Copy link
Member

Choose a reason for hiding this comment

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

I find myself thinking that a lot of these comments in the PR could be improved upon or some might not be necessary since they're just repeating what the code will tell you.

This comment unfortunately doesn't make sense in relation with the next line of code which is returning early when the bookmark folder cannot be loaded. Rather I think this comment was trying to say that we warn users if the number of bookmarks are bigger than WARN_OPEN_ALL_SIZE, but that is already stated further down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I'll remove most of the comments and leave the one that says "Warn user if more than maximum number of bookmarks are being opened"

Comment on lines 89 to 90
if (hasAtLeastOneChild) {
if (itemType == BookmarkNodeType.FOLDER) {
Copy link
Member

@gabrielluong gabrielluong Oct 14, 2022

Choose a reason for hiding this comment

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

I think these 2 if statements can be joined to avoid the nesting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll join them. Thanks

Comment on lines 102 to 103
if (hasAtLeastOneChild) {
if (itemType == BookmarkNodeType.FOLDER) {
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

internal fun menuItems(itemType: BookmarkNodeType): List<TextMenuCandidate> {
@SuppressWarnings("LongMethod")
internal suspend fun menuItems(itemType: BookmarkNodeType, itemId: String): List<TextMenuCandidate> {
// if have at least one child
Copy link
Member

Choose a reason for hiding this comment

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

This is an example where I really don't think the comment is adding much for us. So, I would ask that we audit the comments and try to add clarity to them in the PR.

app/metrics.yaml Outdated
open_all_in_private_tabs:
type: event
description: |
A user opened a folder of bookmarks at once in new private tabs.
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
A user opened a folder of bookmarks at once in new private tabs.
A user opened all the bookmarks in a folder in new private tabs.

app/metrics.yaml Outdated
open_all_in_new_tabs:
type: event
description: |
A user opened a folder of bookmarks at once in new tabs.
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
A user opened a folder of bookmarks at once in new tabs.
A user opened all the bookmarks in a folder in new tabs.

@@ -25,14 +26,19 @@ class BookmarkItemMenu(
Share,
OpenInNewTab,
OpenInPrivateTab,
OpenAllInTabs,
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
OpenAllInTabs,
OpenAllInNewTabs,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good I'll update

@@ -80,6 +80,16 @@ class BookmarkFragmentInteractor(
}
}

override fun onOpenAllInTabs(folder: BookmarkNode) {
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
override fun onOpenAllInTabs(folder: BookmarkNode) {
override fun onOpenAllInNewTabs(folder: BookmarkNode) {

Thoughts?

@@ -58,7 +63,10 @@ class BookmarkNodeViewHolder(

containerView.urlView.isVisible = item.type == BookmarkNodeType.ITEM
containerView.setSelectionInteractor(item, mode, interactor)
menu.updateMenu(item.type)

CoroutineScope(Dispatchers.Default).launch {
Copy link
Member

Choose a reason for hiding this comment

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

@Mugurell thoughts here?

@@ -622,6 +622,17 @@
<!-- Content description (not visible, for screen readers etc.): "Close button for library settings" -->
<string name="content_description_close_button">Close</string>

<!-- Title to show in alert when a lot of tabs are to be opened
Copy link
Member

Choose a reason for hiding this comment

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

I am assuming these strings already got OK'd

Copy link
Contributor Author

@rocketsroger rocketsroger Oct 25, 2022

Choose a reason for hiding this comment

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

Yes, these strings were reviewed and approved by @ewachowiak

@gabrielluong gabrielluong removed the needs:review PRs that need to be reviewed label Oct 25, 2022
* Add "Open all in new tabs" options in bookmarks
* Add "Open all in private tabs" options in bookmarks
* Add metrics tracking if the usage of "Open all in..." in bookmarks

Co-authored-by: Pg <pg.developper.fr@gmail.com>
@rocketsroger rocketsroger added the pr:needs-landing PRs that are ready to land [Will be merged by Mergify] label Oct 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:needs-landing PRs that are ready to land [Will be merged by Mergify]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Open all..." option (Synced tabs, Bookmark Folder, etc)
5 participants