From 3e67b83ed81bbe4e07c0fb47da1b37fd007ff1ae Mon Sep 17 00:00:00 2001 From: Elle Sullivan Date: Tue, 23 Apr 2024 19:04:35 +0100 Subject: [PATCH 1/2] Fix interrupt function not being cleared on succesful completion --- .../Scheduler/DataBrokerProtectionProcessor.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift index 5bb320d3d1..eb9e9b6e39 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift @@ -72,6 +72,7 @@ final class DataBrokerProtectionProcessor { priorityDate: nil, showWebView: showWebView) { errors in os_log("Scans done", log: .dataBrokerProtection) + self.currentlyRunningOperationsForFunction = nil completion?(errors) self.calculateMisMatches() } @@ -90,6 +91,7 @@ final class DataBrokerProtectionProcessor { priorityDate: nil, showWebView: showWebView) { errors in os_log("Optouts done", log: .dataBrokerProtection) + self.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -102,6 +104,7 @@ final class DataBrokerProtectionProcessor { priorityDate: Date(), showWebView: showWebView) { errors in os_log("Queued operations done", log: .dataBrokerProtection) + self.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -114,6 +117,7 @@ final class DataBrokerProtectionProcessor { priorityDate: nil, showWebView: showWebView) { errors in os_log("Queued operations done", log: .dataBrokerProtection) + self.currentlyRunningOperationsForFunction = nil completion?(errors) } } From dc8385729020c7c11bbc0bbb5bcae01ace321395 Mon Sep 17 00:00:00 2001 From: Elle Sullivan Date: Tue, 23 Apr 2024 20:03:38 +0100 Subject: [PATCH 2/2] Add weak self to closures --- .../DataBrokerProtectionProcessor.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift index eb9e9b6e39..4e0cf5ac7d 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift @@ -70,11 +70,11 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .startManualScans(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 + self?.currentlyRunningOperationsForFunction = nil completion?(errors) - self.calculateMisMatches() + self?.calculateMisMatches() } } @@ -89,9 +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 + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -102,9 +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 + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -115,9 +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 + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } }