-
Notifications
You must be signed in to change notification settings - Fork 1.3k
For #11404 - Add 'Open all' options in bookmarks #27138
Conversation
45752c9
to
1e3fb01
Compare
0da10f1
to
469e4b8
Compare
app/src/main/res/values/strings.xml
Outdated
<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> |
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.
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 |
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 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 { |
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'm not sure if we need to update the menu with Dispatchers.Default
. This was not discussed in the original PR.
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 thoughts here?
469e4b8
to
9d91f69
Compare
device-2022-10-11-111519.mp4 |
51508b8
to
6976d1e
Compare
Request for data collection review formAll questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.
|
6976d1e
to
be7dd1d
Compare
Data Review Form (to be filled by Data Stewards)
Resultdata-review+ |
Thanks! LGTM |
@rocketsroger I have a suggested edit to the strings in this reminder for clarity: HEADLINE: Open 16 tabs? 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. |
be7dd1d
to
168f95f
Compare
} | ||
|
||
browserScreen { | ||
// out of folder and should not be opened |
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 am not sure I really follow this comment. Could this be something that we can reword for better clarity?
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.
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 |
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.
// continue only if a folder is defined | |
// continue only if a folder exists |
|
||
when (node.type) { | ||
BookmarkNodeType.FOLDER -> { | ||
// if not leaf (empty) folder |
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 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 |
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 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.
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.
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"
if (hasAtLeastOneChild) { | ||
if (itemType == BookmarkNodeType.FOLDER) { |
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 think these 2 if statements can be joined to avoid the nesting
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.
Good catch, I'll join them. Thanks
if (hasAtLeastOneChild) { | ||
if (itemType == BookmarkNodeType.FOLDER) { |
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.
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 |
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 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.
168f95f
to
a588f61
Compare
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. |
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.
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. |
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.
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, |
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.
OpenAllInTabs, | |
OpenAllInNewTabs, |
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.
Sounds good I'll update
@@ -80,6 +80,16 @@ class BookmarkFragmentInteractor( | |||
} | |||
} | |||
|
|||
override fun onOpenAllInTabs(folder: BookmarkNode) { |
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.
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 { |
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 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 |
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 am assuming these strings already got OK'd
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.
Yes, these strings were reviewed and approved by @ewachowiak
* 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>
a588f61
to
869b014
Compare
This is to re-land #21212
Co-authored-by: Pg pg.developper.fr@gmail.com
Pull Request checklist
QA
To download an APK when reviewing a PR (after all CI tasks finished running):
Checks
at the top of the PR page.firefoxci-taskcluster
group on the left to expand all tasks.build-debug
task.View task in Taskcluster
in the newDETAILS
section.GitHub Automation
Fixes #11404