From 410d1a36c8ad1b62a62863ccb69cd0f56496babb Mon Sep 17 00:00:00 2001 From: Elle Sullivan Date: Wed, 24 Apr 2024 15:18:34 +0100 Subject: [PATCH] DBP interrupt fixes for release (#2696) Task/Issue URL: https://app.asana.com/0/1199230911884351/1207148631921399/f https://app.asana.com/0/1199230911884351/1207152863082294/f Tech Design URL: CC: **Description**: Combines https://github.com/duckduckgo/macos-browser/pull/2685 and https://github.com/duckduckgo/macos-browser/pull/2690 to merge them into an internal release **Steps to test this PR**: 1. Follow the steps in the two individual PRs --- [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f) --- .../Scheduler/DataBrokerProtectionProcessor.swift | 14 +++++++++----- .../Scheduler/DataBrokerProtectionScheduler.swift | 4 +++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift index 0ba21a21f7..01df6e5e39 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift @@ -70,10 +70,11 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runAllScanOperations(pendingCompletion: completion) runOperations(operationType: .scan, priorityDate: nil, - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Scans done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) - self.calculateMisMatches() + self?.calculateMisMatches() } } @@ -88,8 +89,9 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runAllOptOutOperations(pendingCompletion: completion) runOperations(operationType: .optOut, priorityDate: nil, - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Optouts done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -100,8 +102,9 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runQueuedOperations(pendingCompletion: completion) runOperations(operationType: .all, priorityDate: Date(), - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Queued operations done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -112,8 +115,9 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runAllOperations(pendingCompletion: completion) runOperations(operationType: .all, priorityDate: nil, - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Queued operations done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift index d5f9083d07..0a0f529a9f 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift @@ -261,7 +261,9 @@ public final class DefaultDataBrokerProtectionScheduler: DataBrokerProtectionSch self.startScheduler(showWebView: showWebView) - self.userNotificationService.sendFirstScanCompletedNotification() + if errors?.oneTimeError == nil { + self.userNotificationService.sendFirstScanCompletedNotification() + } if let hasMatches = try? self.dataManager.hasMatches(), hasMatches {