-
Notifications
You must be signed in to change notification settings - Fork 37
Add support for per-model Sync Data Providers initialization #433
Conversation
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.
LGTM, two small comments inline.
@@ -230,6 +230,7 @@ public class DDGSync: DDGSyncing { | |||
dependencies.scheduler.isEnabled = false | |||
startSyncCancellable?.cancel() | |||
syncQueueCancellable?.cancel() | |||
try syncQueue?.dataProviders.forEach { try $0.deregisterFeature() } | |||
syncQueue = nil | |||
authState = .inactive | |||
try dependencies.secureStore.removeAccount() |
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 wonder if we should handle any of these try
calls somehow... pixel?
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.
Let me add a task for it. I'm sure it's not the only place we need to handle.
Sources/DDGSync/DataProvider.swift
Outdated
open class DataProvider: DataProviding { | ||
|
||
public let feature: Feature | ||
public let metadataStore: SyncMetadataStore |
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.
Should this be public, or rather encapsulated? I don't think we want anyone to use it directly.
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.
Of course we don't want to expose it 👍 thanks!
Task/Issue URL: https://app.asana.com/0/0/1205093266805582/f Rework Sync initialization mechanism by moving sync data models initialization from DDGSync (where it was tied to account signup/login flow) to data models themselves. Sync Metadata is leveraged to store sync setup state per data model. Two values are possible: needs remote data fetch (a.k.a initial sync) or ready to sync. Decoupling account flow from data models initialization allows to initialize data models independently of user turning on sync, which is a requirement to support initial sync for new syncable models added with client app updates. Also DataProvider class has been added – it's a dedicated sync data providers superclass that also encapsulates common logic, making individual data providers simpler.
Please review the release process for BrowserServicesKit here.
Required:
Task/Issue URL: https://app.asana.com/0/0/1205093266805582/f
iOS PR: duckduckgo/iOS#1863
macOS PR: duckduckgo/macos-browser#1387
What kind of version bump will this require?: Major
Description:
Rework Sync initialization mechanism by moving sync data models initialization from
DDGSync (where it was tied to account signup/login flow) to data models themselves.
Sync Metadata is leveraged to store sync setup state per data model. Two values are
possible: needs remote data fetch (a.k.a initial sync) or ready to sync.
Decoupling account flow from data models initialization allows to initialize data models
independently of user turning on sync, which is a requirement to support initial sync
for new syncable models added with client app updates.
Also DataProvider class has been added – it's a dedicated sync data providers superclass
that also encapsulates common logic, making individual data providers simpler.
Steps to test this PR:
iOS:
was triggered for an active account).
macOS:
OS Testing:
Internal references:
Software Engineering Expectations
Technical Design Template