From 5851cb3ed10f5737f9a81571a04ae15856cc5c14 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Tue, 30 Apr 2024 09:06:35 +0200 Subject: [PATCH 1/4] Enable gzip compression for Sync PATCH payloads --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/swiftpm/Package.resolved | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index ff31d352ae..7e7a583deb 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -9710,8 +9710,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { - kind = exactVersion; - version = 141.1.2; + branch = "dominik/sync-payload-compression"; + kind = branch; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6a9a30f87e..894888a685 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" : "f8c73292d4d6724ec81f98bd29dbb2061f1a8cf6", - "version" : "141.1.2" + "branch" : "dominik/sync-payload-compression", + "revision" : "b131b28c73709e7d191df9fc1fb7ab1fa5f499e6" } }, { @@ -72,6 +72,15 @@ "version" : "2.3.0" } }, + { + "identity" : "gzipswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/1024jp/GzipSwift.git", + "state" : { + "revision" : "731037f6cc2be2ec01562f6597c1d0aa3fe6fd05", + "version" : "6.0.1" + } + }, { "identity" : "ios-js-support", "kind" : "remoteSourceControl", @@ -129,7 +138,7 @@ { "identity" : "swift-argument-parser", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser", + "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { "revision" : "46989693916f56d1186bd59ac15124caef896560", "version" : "1.3.1" From 27bc09487d7f5eca3df4cb3d5ee71101ace925ca Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Thu, 9 May 2024 21:24:51 +0200 Subject: [PATCH 2/4] Report PATCH payload compression failures as pixels --- Core/PixelEvent.swift | 6 ++++++ Core/SyncBookmarksAdapter.swift | 2 ++ Core/SyncCredentialsAdapter.swift | 2 ++ Core/SyncSettingsAdapter.swift | 2 ++ 4 files changed, 12 insertions(+) diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index a7e0c917c8..8fc73d888e 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -525,10 +525,13 @@ extension Pixel { case syncSentUnauthenticatedRequest case syncMetadataCouldNotLoadDatabase case syncBookmarksFailed + case syncBookmarksPatchCompressionFailed case syncCredentialsProviderInitializationFailed case syncCredentialsFailed + case syncCredentialsPatchCompressionFailed case syncSettingsFailed case syncSettingsMetadataUpdateFailed + case syncSettingsPatchCompressionFailed case syncSignupError case syncLoginError case syncLogoutError @@ -1173,10 +1176,13 @@ extension Pixel.Event { case .syncSentUnauthenticatedRequest: return "m_d_sync_sent_unauthenticated_request" case .syncMetadataCouldNotLoadDatabase: return "m_d_sync_metadata_could_not_load_database" case .syncBookmarksFailed: return "m_d_sync_bookmarks_failed" + case .syncBookmarksPatchCompressionFailed: return "m_d_sync_bookmarks_patch_compression_failed" case .syncCredentialsProviderInitializationFailed: return "m_d_sync_credentials_provider_initialization_failed" case .syncCredentialsFailed: return "m_d_sync_credentials_failed" + case .syncCredentialsPatchCompressionFailed: return "m_d_sync_credentials_patch_compression_failed" case .syncSettingsFailed: return "m_d_sync_settings_failed" case .syncSettingsMetadataUpdateFailed: return "m_d_sync_settings_metadata_update_failed" + case .syncSettingsPatchCompressionFailed: return "m_d_sync_settings_patch_compression_failed" case .syncSignupError: return "m_d_sync_signup_error" case .syncLoginError: return "m_d_sync_login_error" case .syncLogoutError: return "m_d_sync_logout_error" diff --git a/Core/SyncBookmarksAdapter.swift b/Core/SyncBookmarksAdapter.swift index 9494349344..bb409844ae 100644 --- a/Core/SyncBookmarksAdapter.swift +++ b/Core/SyncBookmarksAdapter.swift @@ -189,6 +189,8 @@ public final class SyncBookmarksAdapter { syncErrorCancellable = provider.syncErrorPublisher .sink { error in switch error { + case SyncError.patchPayloadCompressionFailed(let errorCode): + Pixel.fire(pixel: .syncBookmarksPatchCompressionFailed, withAdditionalParameters: ["error": "\(errorCode)"]) case let syncError as SyncError: Pixel.fire(pixel: .syncBookmarksFailed, error: syncError) switch syncError { diff --git a/Core/SyncCredentialsAdapter.swift b/Core/SyncCredentialsAdapter.swift index f57927f704..ccbed05570 100644 --- a/Core/SyncCredentialsAdapter.swift +++ b/Core/SyncCredentialsAdapter.swift @@ -88,6 +88,8 @@ public final class SyncCredentialsAdapter { syncErrorCancellable = provider.syncErrorPublisher .sink { error in switch error { + case SyncError.patchPayloadCompressionFailed(let errorCode): + Pixel.fire(pixel: .syncCredentialsPatchCompressionFailed, withAdditionalParameters: ["error": "\(errorCode)"]) case let syncError as SyncError: Pixel.fire(pixel: .syncCredentialsFailed, error: syncError) diff --git a/Core/SyncSettingsAdapter.swift b/Core/SyncSettingsAdapter.swift index 9b310a9291..5f99a3610c 100644 --- a/Core/SyncSettingsAdapter.swift +++ b/Core/SyncSettingsAdapter.swift @@ -63,6 +63,8 @@ public final class SyncSettingsAdapter { syncErrorCancellable = provider.syncErrorPublisher .sink { error in switch error { + case SyncError.patchPayloadCompressionFailed(let errorCode): + Pixel.fire(pixel: .syncSettingsPatchCompressionFailed, withAdditionalParameters: ["error": "\(errorCode)"]) case let syncError as SyncError: Pixel.fire(pixel: .syncSettingsFailed, error: syncError) case let settingsMetadataError as SettingsSyncMetadataSaveError: From bc08a2ca484b283ad14a4a9b88a880c8e04b6d46 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio Date: Fri, 10 May 2024 14:15:11 +0200 Subject: [PATCH 3/4] remove unwanted duplicate continuation.resume --- DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift b/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift index 98f844aa15..3ffee80dc6 100644 --- a/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift +++ b/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift @@ -298,7 +298,6 @@ extension SyncSettingsViewController: SyncManagementViewModelDelegate { } let confirmAction = UIAlertAction(title: UserText.syncTurnOffConfirmAction, style: .destructive) { _ in self.onConfirmSyncDisable?() - continuation.resume(returning: true) } alert.addAction(cancelAction) alert.addAction(confirmAction) @@ -329,7 +328,6 @@ extension SyncSettingsViewController: SyncManagementViewModelDelegate { } alert.addAction(title: UserText.syncDeleteAllConfirmAction, style: .destructive) { self.onConfirmAndDeleteAllData?() - continuation.resume(returning: true) } self.present(alert, animated: true) } From 809e1f43bf95fb0ada3322e0ee27aae9b22112e1 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Fri, 10 May 2024 14:43:28 +0200 Subject: [PATCH 4/4] Use BSK 144.0.6 --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 8ea8d9c6d9..a5f1381fb0 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -9805,8 +9805,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { - branch = "dominik/sync-payload-compression"; - kind = branch; + kind = exactVersion; + version = 144.0.6; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7171bcdcff..d352edeb83 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" : { - "branch" : "dominik/sync-payload-compression", - "revision" : "803be7265bac4eefff35be97aed6d7d693d8c8a9" + "revision" : "72be4e73360989af170399bc063fd5c628e1e84c", + "version" : "144.0.6" } }, {