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

Allow automated fetching of synced bookmarks' favicons #2163

Merged
merged 83 commits into from
Nov 30, 2023

Conversation

ayoy
Copy link
Contributor

@ayoy ayoy commented Nov 15, 2023

Task/Issue URL: https://app.asana.com/0/0/1205949780297088/f
Tech Design URL: https://app.asana.com/0/481882893211075/1204986998781220/f

Description:
Add BookmarksFaviconFetcher that is used to fetch favicons for bookmarks received by Sync.
Fetcher is opt-in, controlled by a setting inside Sync settings (with an additional in-context onboarding
popup presented from client apps). Fetcher uses LinkPresentation framework to obtain a favicon
for a given domain, and in case of failure it falls back to checking hardcoded favicon URLs.
Fetcher keeps a state internally, by saving list of bookmarks IDs that need processing to a file on disk.
Fetcher plugs into clients' implementation of favicon storage by exposing FaviconStoring protocol.
Fetcher performs fetching on a serial operation queue. Each fetcher invocation cancels previously scheduled
operation and schedules a new one. Updating fetcher state is also scheduled on the operation queue -
state updates don't support cancelling and always finish before next operation is started.

Steps to test this PR:
See BSK PR for testing steps.

Copy Testing:

  • Use of correct apostrophes in new copy, ie rather than '

Orientation Testing:

  • Portrait
  • Landscape

Device Testing:

  • iPhone SE (1st Gen)
  • iPhone 8
  • iPhone X
  • iPhone 14 Pro
  • iPad

OS Testing:

  • iOS 14
  • iOS 15
  • iOS 16

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

Copy link

github-actions bot commented Nov 15, 2023

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against f46b1c4

@ayoy ayoy marked this pull request as ready for review November 16, 2023 09:06
@ayoy ayoy requested a review from bwaresiak November 16, 2023 09:06
@ayoy ayoy assigned bwaresiak and unassigned ayoy Nov 16, 2023
Copy link
Contributor

@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.

Looks Good.
the SyncSettingsVC and the UI part are changed in the new UI… that will be a bit messy

private func setUpFaviconsFetcher() -> BookmarksFaviconsFetcher? {
let stateStore: BookmarksFaviconsFetcherStateStore
do {
let url = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
Copy link
Contributor

Choose a reason for hiding this comment

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

why no guard let?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already rely on ~/Library/Application Support directory to be present and accessible on users' devices (you'll find the same force-unwrapped call in URLExtension). I can add a guard let here though and report another error here, no problem 👍

@@ -118,6 +121,9 @@ struct UserText {
static let bookmarksLimitExceededAction = "Manage Bookmarks"
static let credentialsLimitExceededAction = "Manage Logins"

static let fetchFaviconsOnboardingTitle = "Download Missing Icons?"
static let fetchFaviconsOnboardingMessage = "Do you want this device to automatically download icons for any new bookmarks synced from your other devices? This will expose the download to your network any time a bookmark is synced."
static let fetchFaviconsOnboardingButtonTitle = "Keep Bookmarks Icons Updated"
Copy link
Contributor

Choose a reason for hiding this comment

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

I updated to use Localised strings. In case you can update them

@ayoy ayoy merged commit d6c6d92 into develop Nov 30, 2023
10 checks passed
@ayoy ayoy deleted the dominik/sync-favicons-fetching branch November 30, 2023 07:36
samsymons added a commit that referenced this pull request Nov 30, 2023
# By Dominik Kapusta (1) and others
# Via GitHub
* develop:
  moving the toggle to the top of the dashboard (#2166)
  Allow automated fetching of synced bookmarks' favicons (#2163)
  NetP Geoswitching Design Review feedback (#2206)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
samsymons added a commit that referenced this pull request Dec 5, 2023
* develop: (40 commits)
  Address Bar Spoofing Tests + Remediation (#2181)
  Update Sync e2e tests to fit the new UI (#2215)
  NetP waitlist final touches (#2209)
  NetP: Remove port from server address (#2214)
  NetP: Fix list row colours (#2213)
  Reset VPN waitlist T&C (#2212)
  Report macOS active/new user for netP (#2207)
  Sabrina/sync setup update (#2198)
  new pixels for toolbars and share sheet  (#2208)
  Use design system fonts throughout NetP (#2211)
  moving the toggle to the top of the dashboard (#2166)
  Allow automated fetching of synced bookmarks' favicons (#2163)
  NetP Geoswitching Design Review feedback (#2206)
  update theme to use system colours (#2180)
  Release 7.99.0 (#2205)
  Update iOS privacy defaults (#2185)
  Remove disabled switches from VPN Settings screen (#2203)
  Update BSK for VPN settings (#2165)
  Fix migrating from Bookmarks V2 and older (#2196)
  Autofill pixel parameter removed (#2182)
  ...
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.

3 participants