Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC - DBP Processor Refactoring (Abstraction & Testability) #2730

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
}

@objc private func forceBrokerJSONFilesUpdate() {
if let updater = DataBrokerProtectionBrokerUpdater.provide() {
if let updater = DefaultDataBrokerProtectionBrokerUpdater.provide() {
updater.updateBrokers()
}
}
Expand Down
4 changes: 0 additions & 4 deletions DuckDuckGo/DBP/DataBrokerProtectionLoginItemScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public class DataBrokerProtectionPixelsHandler: EventMapping<DataBrokerProtectio
.backgroundAgentStartedStoppingDueToAnotherInstanceRunning,
.ipcServerOptOutAllBrokers,
.ipcServerRunQueuedOperations,
.ipcServerRunAllOperations,
.scanSuccess,
.scanFailed,
.scanError,
Expand Down
5 changes: 0 additions & 5 deletions DuckDuckGoDBPBackgroundAgent/IPCServiceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ extension IPCServiceManager: IPCServerInterface {
}
}

func runAllOperations(showWebView: Bool) {
pixelHandler.fire(.ipcServerRunAllOperations)
scheduler.runAllOperations(showWebView: showWebView)
}

func openBrowser(domain: String) {
Task { @MainActor in
browserWindowManager.show(domain: domain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct EmptyCookieHandler: CookieHandler {
}
}

final class DebugScanOperation: DataBrokerOperation {
final class DebugScanOperation: DataBrokerTask {
typealias ReturnValue = DebugScanReturnValue
typealias InputValue = Void

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,7 @@ extension DataBrokerProtectionIPCClient: IPCServerInterface {
})
}

public func runAllOperations(showWebView: Bool) {
self.pixelHandler.fire(.ipcServerRunAllOperations)
xpc.execute(call: { server in
server.runAllOperations(showWebView: showWebView)
}, xpcReplyErrorHandler: { _ in
// Intentional no-op as there's no completion block
// If you add a completion block, please remember to call it here too!
})
}

public func openBrowser(domain: String) {
self.pixelHandler.fire(.ipcServerRunAllOperations)
xpc.execute(call: { server in
server.openBrowser(domain: domain)
}, xpcReplyErrorHandler: { error in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public final class DataBrokerProtectionIPCScheduler: DataBrokerProtectionSchedul
ipcClient.runQueuedOperations(showWebView: showWebView, completion: completion)
}

public func runAllOperations(showWebView: Bool) {
ipcClient.runAllOperations(showWebView: showWebView)
}

public func getDebugMetadata(completion: @escaping (DBPBackgroundAgentMetadata?) -> Void) {
ipcClient.getDebugMetadata(completion: completion)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
}
Expand Down
Loading