Skip to content

Commit

Permalink
Enable field validation for Sync payloads (#2725)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1207196051122978/f

Description:
This change adds a mechanism that filters out syncable objects that would fail validation on the backend
before sending Sync patch request. Objects rejected from patch payload are retried on every subsequent
Sync request, until they're updated to pass validation or deleted.
  • Loading branch information
ayoy authored May 5, 2024
1 parent 74cee75 commit be32a7a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12772,7 +12772,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 143.0.1;
version = 144.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "dedd5ef4cc71379e43cbd8244374a53043163e21",
"version" : "143.0.1"
"revision" : "9906b9464f6f12e94f3cc62456b5b5a9c1a43db8",
"version" : "144.0.0"
}
},
{
Expand Down
20 changes: 9 additions & 11 deletions DuckDuckGo/Preferences/Model/SyncPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,15 @@ final class SyncPreferences: ObservableObject, SyncUI.ManagementViewModel {
}
.store(in: &cancellables)

if DDGSync.isFieldValidationEnabled {
syncService.isSyncInProgressPublisher
.removeDuplicates()
.filter { !$0 }
.asVoid()
.receive(on: DispatchQueue.main)
.sink { [weak self] in
self?.updateInvalidObjects()
}
.store(in: &cancellables)
}
syncService.isSyncInProgressPublisher
.removeDuplicates()
.filter { !$0 }
.asVoid()
.receive(on: DispatchQueue.main)
.sink { [weak self] in
self?.updateInvalidObjects()
}
.store(in: &cancellables)

$syncErrorMessage
.map { $0 != nil }
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "143.0.1"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let package = Package(
.library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "143.0.1"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.1"),
.package(path: "../XPCHelper"),
.package(path: "../SwiftUIExtensions"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "143.0.1"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "144.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down

0 comments on commit be32a7a

Please sign in to comment.