From 16acb56a1a079b4981e4570268439dd122595a39 Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 3 May 2024 09:30:46 +0100 Subject: [PATCH] Remove unused `runAllOperations` from `DataBrokerProtectionScheduler`, `IPCServerInterface`, and `XPCServerInterface` interfaces. Remove related Pixel. --- ...taBrokerProtectionLoginItemScheduler.swift | 4 --- .../DataBrokerProtectionPixelsHandler.swift | 1 - .../IPCServiceManager.swift | 5 ---- .../IPC/DataBrokerProtectionIPCClient.swift | 11 ------- .../DataBrokerProtectionIPCScheduler.swift | 4 --- .../IPC/DataBrokerProtectionIPCServer.swift | 6 ---- .../Pixels/DataBrokerProtectionPixels.swift | 6 +--- .../DataBrokerProtectionNoOpScheduler.swift | 1 - .../DataBrokerProtectionProcessor.swift | 10 ------- .../DataBrokerProtectionQueueManager.swift | 14 --------- .../DataBrokerProtectionScheduler.swift | 29 ------------------- 11 files changed, 1 insertion(+), 90 deletions(-) diff --git a/DuckDuckGo/DBP/DataBrokerProtectionLoginItemScheduler.swift b/DuckDuckGo/DBP/DataBrokerProtectionLoginItemScheduler.swift index 50b75e9fac..02bd9767be 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionLoginItemScheduler.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionLoginItemScheduler.swift @@ -76,10 +76,6 @@ extension DataBrokerProtectionLoginItemScheduler: DataBrokerProtectionScheduler ipcScheduler.optOutAllBrokers(showWebView: showWebView, completion: completion) } - func runAllOperations(showWebView: Bool) { - ipcScheduler.runAllOperations(showWebView: showWebView) - } - func runQueuedOperations(showWebView: Bool, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) { ipcScheduler.runQueuedOperations(showWebView: showWebView, completion: completion) diff --git a/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift b/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift index 2f91fe97a0..dfdfd2ba19 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift @@ -76,7 +76,6 @@ public class DataBrokerProtectionPixelsHandler: EventMapping Void) { ipcClient.getDebugMetadata(completion: completion) } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift index 7f4ae3e840..59998ea152 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift @@ -99,7 +99,6 @@ public protocol IPCServerInterface: AnyObject { completion: @escaping ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)) func runQueuedOperations(showWebView: Bool, completion: @escaping ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)) - func runAllOperations(showWebView: Bool) // MARK: - Debugging Features @@ -141,7 +140,6 @@ protocol XPCServerInterface { completion: @escaping ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)) func runQueuedOperations(showWebView: Bool, completion: @escaping ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)) - func runAllOperations(showWebView: Bool) // MARK: - Debugging Features @@ -226,10 +224,6 @@ extension DataBrokerProtectionIPCServer: XPCServerInterface { serverDelegate?.runQueuedOperations(showWebView: showWebView, completion: completion) } - func runAllOperations(showWebView: Bool) { - serverDelegate?.runAllOperations(showWebView: showWebView) - } - func openBrowser(domain: String) { serverDelegate?.openBrowser(domain: domain) } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift index ad7f3cd61d..11c5fea673 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift @@ -130,7 +130,6 @@ public enum DataBrokerProtectionPixels { case ipcServerOptOutAllBrokersCompletion(error: Error?) case ipcServerRunQueuedOperations case ipcServerRunQueuedOperationsCompletion(error: Error?) - case ipcServerRunAllOperations // DataBrokerProtection User Notifications case dataBrokerProtectionNotificationSentFirstScanComplete @@ -247,7 +246,6 @@ extension DataBrokerProtectionPixels: PixelKitEvent { case .ipcServerOptOutAllBrokersCompletion: return "m_mac_dbp_ipc-server_opt-out-all-brokers_completion" case .ipcServerRunQueuedOperations: return "m_mac_dbp_ipc-server_run-queued-operations" case .ipcServerRunQueuedOperationsCompletion: return "m_mac_dbp_ipc-server_run-queued-operations_completion" - case .ipcServerRunAllOperations: return "m_mac_dbp_ipc-server_run-all-operations" // User Notifications case .dataBrokerProtectionNotificationSentFirstScanComplete: @@ -418,8 +416,7 @@ extension DataBrokerProtectionPixels: PixelKitEvent { .ipcServerOptOutAllBrokers, .ipcServerOptOutAllBrokersCompletion, .ipcServerRunQueuedOperations, - .ipcServerRunQueuedOperationsCompletion, - .ipcServerRunAllOperations: + .ipcServerRunQueuedOperationsCompletion: return [Consts.bundleIDParamKey: Bundle.main.bundleIdentifier ?? "nil"] case .scanSuccess(let dataBroker, let matchesFound, let duration, let tries, let isManualScan): return [Consts.dataBrokerParamKey: dataBroker, Consts.matchesFoundKey: String(matchesFound), Consts.durationParamKey: String(duration), Consts.triesKey: String(tries), Consts.isManualScan: isManualScan.description] @@ -507,7 +504,6 @@ public class DataBrokerProtectionPixelsHandler: EventMapping Void)?) { } func startManualScan(showWebView: Bool, startTime: Date, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) { } - func runAllOperations(showWebView: Bool) { } func getDebugMetadata(completion: (DBPBackgroundAgentMetadata?) -> Void) { } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift index 353a225e2c..57e8f46b0a 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift @@ -94,16 +94,6 @@ final class DataBrokerProtectionProcessor { } } - func runAllOperations(showWebView: Bool = false, - completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)? = nil ) { - runOperations(operationType: .all, - priorityDate: nil, - showWebView: showWebView) { errors in - os_log("Queued operations done", log: .dataBrokerProtection) - completion?(errors) - } - } - func stopAllOperations() { operationQueue.cancelAllOperations() } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift index 7c6b2d3d68..56f3567a47 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift @@ -36,7 +36,6 @@ protocol DataBrokerProtectionQueueManager { func startManualScans(showWebView: Bool, operationDependencies: OperationDependencies, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) func runAllOptOutOperations(showWebView: Bool, operationDependencies: OperationDependencies, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) func runQueuedOperations(showWebView: Bool, operationDependencies: OperationDependencies, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) - func runAllOperations(showWebView: Bool, operationDependencies: OperationDependencies, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) func stopAllOperations() } @@ -120,19 +119,6 @@ final class DefaultDataBrokerProtectionQueueManager: DataBrokerProtectionQueueMa } } - func runAllOperations(showWebView: Bool, operationDependencies: OperationDependencies, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) { - - guard mode.canInterrupt(forNewMode: .queued) else { return } - mode = .queued - - addOperationCollections(withType: .all, - showWebView: showWebView, - operationDependencies: operationDependencies) { errors in - os_log("All operations completed", log: .dataBrokerProtection) - completion?(errors) - } - } - func stopAllOperations() { operationQueue.cancelAllOperations() } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift index 27ae1ffede..03a9199525 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift @@ -82,7 +82,6 @@ public protocol DataBrokerProtectionScheduler { func optOutAllBrokers(showWebView: Bool, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) func startManualScan(showWebView: Bool, startTime: Date, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) func runQueuedOperations(showWebView: Bool, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)?) - func runAllOperations(showWebView: Bool) /// Debug operations @@ -94,10 +93,6 @@ extension DataBrokerProtectionScheduler { startScheduler(showWebView: false) } - public func runAllOperations() { - runAllOperations(showWebView: false) - } - public func startManualScan(startTime: Date) { startManualScan(showWebView: false, startTime: startTime, completion: nil) } @@ -247,30 +242,6 @@ public final class DefaultDataBrokerProtectionScheduler: DataBrokerProtectionSch self.queueManager.stopAllOperations() } - public func runAllOperations(showWebView: Bool = false) { - guard self.currentOperation != .manualScan else { - os_log("Manual scan in progress, returning...", log: .dataBrokerProtection) - return - } - - os_log("Running all operations...", log: .dataBrokerProtection) - self.currentOperation = .all - queueManager.runAllOperations(showWebView: showWebView, - operationDependencies: operationDependencies) { [weak self] errors in - if let errors = errors { - if let oneTimeError = errors.oneTimeError { - os_log("Error during DefaultDataBrokerProtectionScheduler.runAllOperations in dataBrokerProcessor.runAllOperations(), error: %{public}@", log: .dataBrokerProtection, oneTimeError.localizedDescription) - self?.pixelHandler.fire(.generalError(error: oneTimeError, functionOccurredIn: "DefaultDataBrokerProtectionScheduler.runAllOperations")) - } - if let operationErrors = errors.operationErrors, - operationErrors.count != 0 { - os_log("Operation error(s) during DefaultDataBrokerProtectionScheduler.runAllOperations in dataBrokerProcessor.runAllOperations(), count: %{public}d", log: .dataBrokerProtection, operationErrors.count) - } - } - self?.currentOperation = .idle - } - } - public func runQueuedOperations(showWebView: Bool = false, completion: ((DataBrokerProtectionSchedulerErrorCollection?) -> Void)? = nil) { guard self.currentOperation != .manualScan else {