Skip to content
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

Assorted fixes and updates to HTML New Tab Page #3748

Merged
merged 8 commits into from
Jan 20, 2025

Conversation

ayoy
Copy link
Collaborator

@ayoy ayoy commented Jan 18, 2025

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

Description:
This change contains updates to HTML New Tab Page: fixed displaying favicons fetcher
onboarding dialog, added user image background thumbnails context menu
and updated favicon placeholder to 2 letters.

Steps to test this PR:

  1. I've had favicons fetcher onboarding dialog tested and verified already (see this comment in Asana).
  2. Open the app, set internal user state and enable htmlNewTabPage feature flag.
  3. Import some bookmarks and verify that favorites placeholders in New Tab Page display 2 letters.
  4. Set image as background, go to customize panel -> My Backgrounds, verify that image thumbnails have context menu that allows deleting images and that deleting via context menu works.

Definition of Done:


Internal references:

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

@ayoy ayoy marked this pull request as ready for review January 18, 2025 08:33
@ayoy ayoy requested a review from SabrinaTardio January 18, 2025 08:33
@ayoy ayoy assigned SabrinaTardio and unassigned ayoy Jan 18, 2025
Copy link
Collaborator

@SabrinaTardio SabrinaTardio left a comment

Choose a reason for hiding this comment

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

Works as expected!

return nil
}
return .init(syncService: syncService, syncBookmarksAdapter: syncBookmarksAdapter)
}()
return ContentBlocking.shared.tld.eTLDplus1(domain)?.dropping(prefix: Const.wwwPrefix)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could just initialise TLD directly in this class rather then using the instance in ContentBlocking

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would mean adding TLD to Bookmark class which didn't sound good to me. The alternative I considered was the add TLD computing functionality in The NTP Favorites model, but that would be a much bigger change. The impact of this is very little so I decided to go with a simple solution like this, especially that we use exactly the same approach in PinnedTabInnerView and LetterIconView.

Comment on lines +76 to +83

private lazy var faviconsFetcherOnboarding: FaviconsFetcherOnboarding? = {
guard let syncService = NSApp.delegateTyped.syncService, let syncBookmarksAdapter = NSApp.delegateTyped.syncDataProviders?.bookmarksAdapter else {
assertionFailure("SyncService and/or SyncBookmarksAdapter is nil")
return nil
}
return .init(syncService: syncService, syncBookmarksAdapter: syncBookmarksAdapter)
}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably I am missing some context, plus some of the favicon logic here was here from before… But in general seems a little strange for this and the favicon logic to live in DuckSchemeHandler and not in Bookmark or somewhere more specific

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, this isn't different from current usage of the favicons fetcher onboarding. We need to access Sync Service to check whether we should present it. For old NTP this was done in HomePageViewController, and for html NTP it's in the scheme handler because there's where favicons are requested and where we have to respond to favicons being missing.

@ayoy ayoy merged commit f5ed982 into main Jan 20, 2025
20 checks passed
@ayoy ayoy deleted the dominik/htmlntp-favicons-dialog branch January 20, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants