From be32a7ac5239099b3bcc24080c4b68ff4ed7ebb2 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Sun, 5 May 2024 22:45:42 +0200 Subject: [PATCH] Enable field validation for Sync payloads (#2725) 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. --- DuckDuckGo.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- .../Preferences/Model/SyncPreferences.swift | 20 +++++++++---------- .../DataBrokerProtection/Package.swift | 2 +- .../NetworkProtectionMac/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 68f3b7a707..dc88f48c10 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -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" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 70b5f6cd13..41fa2b0e67 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -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" } }, { diff --git a/DuckDuckGo/Preferences/Model/SyncPreferences.swift b/DuckDuckGo/Preferences/Model/SyncPreferences.swift index a0a5591360..7781247f6c 100644 --- a/DuckDuckGo/Preferences/Model/SyncPreferences.swift +++ b/DuckDuckGo/Preferences/Model/SyncPreferences.swift @@ -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 } diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index dbbe4f1df5..19b8daa1e2 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -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"), ], diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 73fbc8b7ce..a027d241cb 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -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"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index 7c483d7bd5..7eb918dbc2 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -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: [