duckduckgo / macos-browser

DuckDuckGo macOS Browser
Apache License 2.0
249 stars 10 forks source link

Add support for displaying Favorites in HTML New Tab Page #3583

Closed ayoy closed 1 week ago

ayoy commented 1 week ago

Task/Issue URL: https://app.asana.com/0/72649045549333/1208246350498753/f

Description: This change implements NewTabPageFavoritesClient that connects HTML NTP to favorites. The client talks to the NewTabPageUserScript, and it uses a newly added NewTabPageFavoritesModel, which provides favorites array from BookmarkManager and delegates favorites-related actions to NewTabPageFavoritesActionsHandler. Favicons are provided by FaviconsManager but need to be delivered to the web UI as "web assets" which means they're handled in DuckURLSchemeHandler.

Steps to test this PR:

  1. Clear app data
  2. Run the app from Xcode, and become internal user.
  3. Using Debug Menu -> Feature Flag Overrides enable htmlNewTabPage.
  4. Import bookmarks and verify that favorites view on the NTP is populated.
  5. Verify that collapsing/expanding favorites view works and is remembered between app sessions.
  6. Open another window with NTP and verify that changes in one window are applied in the other.
  7. Verify that moving favorites works.
  8. Verify that opening favorites using left mouse click works.
  9. Verify that all context menu options work as expected (note: the implementation of the actions, e.g. all dialogs, wasn't changed so you don't have to pay extra attention to verifying if behavior is 100% the same as in native NTP).
  10. Open bookmarks bar; verify that you can't drag and drop a favorite onto bookmarks bar.
  11. Verify that "Add favorite" button works as expected.

Definition of Done:


Internal references:

Pull Request Review Checklist Software Engineering Expectations Technical Design Template Pull Request Documentation

github-actions[bot] commented 1 week ago
Warnings
:warning: PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by :no_entry_sign: dangerJS against fbf76370955ba902c3d7f3714e283eaad343c333

ayoy commented 1 week ago

One thing that is different from the current production build is that in the production build, we are limited on how many favorites we can add; here, there is no limit. Is that on purpose?

@jotaemepereira sorry to only reply now to you about it. This seems to be done on purpose - the FE always offers to add a new favorite. This is currently being ship-reviewed for Windows and wasn't protested. We may still change this behavior going forward but for now, the native side doesn't have control on whether or not the "add favorite" and ghost buttons are displayed.