-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show dialog to bookmark all tabs #2621
Show dialog to bookmark all tabs #2621
Conversation
…lder multiple times in the same session
🚫 The Asana task linked in the PR description is not added to macOS App Board project.
|
import SwiftUIExtensions | ||
|
||
struct BookmarkAllTabsDialogView: ModalView { | ||
@ObservedObject private var viewModel: BookmarkAllTabsDialogCoordinatorViewModel<BookmarkAllTabsDialogViewModel, AddEditBookmarkFolderDialogViewModel> |
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.
Used same approach of AddEditBookmarkDialogView
.
@@ -42,9 +42,13 @@ struct BookmarkDialogContainerView<Content: View, Buttons: View>: View { | |||
Text(title) | |||
.foregroundColor(.primary) | |||
.fontWeight(.semibold) | |||
.padding(.top, 20) |
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.
As BookmarkAllTabs dialog can have an educational message on multiple lines for long language I removed the fix height from the bookmark dialogs, moved the padding in here and let the subviews dictate the height. AddEditBookmarks still render properly.
@@ -42,8 +42,9 @@ final class AddEditBookmarkFolderDialogViewModel: BookmarkFolderDialogEditing { | |||
|
|||
@Published var folderName: String | |||
@Published var selectedFolder: BookmarkFolder? | |||
@Published private(set) var folders: [FolderViewModel] |
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.
Soooo, I found an issue when we present the Add folder dialog from AddEditBookmark and BookmarkAllTabs. Unfortunately this was missed during the project to address bookmark feedback (I’m pretty sure tho we would have tested this scenario, so I’m a bit 🙈) .
The issue happens when we add/edit a bookmark or bookmark all tabs, press the icon to add a folder, save and press again the icon to add a folder. The add folder dialog view shows the name of the previously saved folder rather than being empty and the picker selector is not updated.
I’ve fixed this and updated tests. I actually wrote an integration test.
import SwiftUI | ||
import Combine | ||
|
||
final class BookmarkAllTabsDialogCoordinatorViewModel<BookmarkViewModel: BookmarkAllTabsDialogEditing, AddFolderViewModel: BookmarkFolderDialogEditing>: ObservableObject { |
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 fashion on AddEditBookmarkDialogView
@@ -7567,55 +7567,55 @@ | |||
"localizations" : { | |||
"de" : { | |||
"stringUnit" : { | |||
"state" : "translated", |
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.
Will open a PR soon for the localization of these strings
@@ -39,7 +39,7 @@ private struct MultilineTextHeightFixer: ViewModifier { | |||
} | |||
} | |||
|
|||
extension View { | |||
public extension View { |
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 moved this ViewModifier which is helpful for multiline text from NetworkProtection to SwiftUIExtensions. I needed to render my text on multiple lines when I tested for long text. It wouldn’t work otherwise.
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.
Looks great and works as expected.
There are a couple of things to consider as concern copy! once we sort them we can merge (or if it is blocking you can merge it but we need to address thme before merging to main)
@@ -348,6 +348,11 @@ final class LocalBookmarkManager: BookmarkManager { | |||
return results | |||
} | |||
|
|||
func bookmarkAll(websitesInfo: [WebsiteInfo], withinParentFolder parent: ParentFolderType) { | |||
// TODO: https://app.asana.com/0/0/1207032959154802/f |
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 guess technically you can remove this? it does its duty
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 put had a TODO because I still have to call sync, reload the bookmarks and write tests so I won’t forget it.
#Preview("Bookmark All Tabs - Light") { | ||
let parentFolder = BookmarkFolder(id: "7", title: "DuckDuckGo") | ||
let bookmark = Bookmark(id: "1", url: "www.duckduckgo.com", title: "DuckDuckGo", isFavorite: true, parentFolderUUID: "7") | ||
let bookmarkManager = LocalBookmarkManager(bookmarkStore: BookmarkStoreMock(bookmarks: [bookmark, parentFolder])) |
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.
Some failure here
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.
@@ -1077,15 +1077,24 @@ struct UserText { | |||
static let editBookmark = NSLocalizedString("bookmarks.dialog.title.edit", value: "Edit Bookmark", comment: "Bookmark edit dialog title") | |||
static let addFolder = NSLocalizedString("bookmarks.dialog.folder.title.add", value: "Add Folder", comment: "Bookmark folder creation dialog title") | |||
static let editFolder = NSLocalizedString("bookmarks.dialog.folder.title.edit", value: "Edit Folder", comment: "Bookmark folder edit dialog title") | |||
static let bookmarkOpenTabs = NSLocalizedString("bookmarks.dialog.allTabs.title.add", value: "Bookmark %1$d Open Tabs", comment: "Title of dialog to bookmark all open tabs. E.g. 'Bookmark 42 Open 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.
I think there is an issue here since we do not support pluralisation we can really use "Bookmark %1$d Open Tabs”
We have to move towards something like “Bookmarks All Open Tabs (n)”
you should raise it with someone from copy
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.
Ah very good catch with the plurals. I will speak with Product/Copy
static let folderName = NSLocalizedString("bookmarks.dialog.field.folderName", value: "Folder Name", comment: "Folder name field label for Bookmarks folder") | ||
} | ||
enum Value { | ||
static let folderName = NSLocalizedString("bookmarks.dialog.field.folderName", value: "%1$@ - %2$d Tabs", comment: "The suggested name of the folder that will contain the bookmark tabs. Eg. 2024-02-12 - 50 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.
Same here at the very list we can ask the translator to deal with it using Tabs (n) for languages in which we have different plural forms
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.
Ah very good catch with the plurals. I will speak with Product/Copy
Thanks @SabrinaTardio! Actually I was thinking we would never be in a scenario where we have
|
4b87398
into
alessandro/bookmark-all-tabs
Task/Issue URL: https://app.asana.com/0/0/1207032400501907/f **Description**: - Show the dialog to bookmark all tabs when clicking on the “Bookmark All Tabs…” context menu items. - Fix a bug when adding a new folder multiple times that caused the folder picker not to be updated and the folder name text field to be prefilled with the previously created name.
Task/Issue URL: https://app.asana.com/0/0/1207032400501907/f **Description**: - Show the dialog to bookmark all tabs when clicking on the “Bookmark All Tabs…” context menu items. - Fix a bug when adding a new folder multiple times that caused the folder picker not to be updated and the folder name text field to be prefilled with the previously created name.
Task/Issue URL: https://app.asana.com/0/0/1207032400501907/f **Description**: - Show the dialog to bookmark all tabs when clicking on the “Bookmark All Tabs…” context menu items. - Fix a bug when adding a new folder multiple times that caused the folder picker not to be updated and the folder name text field to be prefilled with the previously created name.
Task/Issue URL: https://app.asana.com/0/0/1207032400501907/f **Description**: - Show the dialog to bookmark all tabs when clicking on the “Bookmark All Tabs…” context menu items. - Fix a bug when adding a new folder multiple times that caused the folder picker not to be updated and the folder name text field to be prefilled with the previously created name.
Task/Issue URL: https://app.asana.com/0/0/1207032400501907/f
CC: @samsymons
Description:
Figma Mockup
Screenshots
Steps to test this PR:
Scenario 1: Shows "Bookmark All Tabs…” dialog view - Main Application Menu 🟢
Bookmarks
main application menu item.Bookmark All Tabs…
menu item.Expected Result: The Bookmark All Tabs dialog should appear on screen.
Scenario 2: Shows "Bookmark All Tabs…” dialog view - More Options Menu 🟢
Bookmark All Tabs…
menu item.Expected Result: The Bookmark All Tabs dialog should appear on screen.
Scenario 3: Shows "Bookmark All Tabs…” dialog view - Tab Contextual Menu 🟢
Bookmark All Tabs…
menu item.Expected Result: The Bookmark All Tabs dialog should appear on screen.
Scenario 4: "Bookmark All Tabs…” dialog view shows right title 🟢
Bookmark All Tabs…
dialog view.Expected Result: The dialog title should reflect the number of open tabs as per design. In the case there are 5 tabs with a web page loaded the title should be “Bookmark 5 Open Tabs”.
Scenario 5: "Bookmark All Tabs…” dialog view shows right folder name as suggestion 🟢
Bookmark All Tabs…
dialog view.—
Internal references:
Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation