From 061b9c372187ed562dbcec759b4a38a7cbc21887 Mon Sep 17 00:00:00 2001 From: Elle Sullivan Date: Mon, 23 Sep 2024 15:18:03 +0100 Subject: [PATCH] Fix PIR not building on xcode 16 (#3328) Task/Issue URL: https://app.asana.com/0/1201037661562251/1208378563410288/f Tech Design URL: CC: **Description**: Very minor to fix an odd build quirk in the QueueManager **Steps to test this PR**: 1. Check the tests run and PIR still works, otherwise nothing to really test directly **Definition of Done**: * [ ] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? --- ###### Internal references: [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) --- .../DataBrokerProtectionQueueManager.swift | 16 +++++++++++++--- .../Tests/DataBrokerProtectionTests/Mocks.swift | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift index dd312afbb1..c8e2bb429b 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift @@ -24,10 +24,20 @@ protocol DataBrokerProtectionOperationQueue { var maxConcurrentOperationCount: Int { get set } func cancelAllOperations() func addOperation(_ op: Operation) - func addBarrierBlock(_ barrier: @escaping @Sendable () -> Void) + func addBarrierCompletionBlock(_ barrier: @escaping @Sendable () -> Void) } -extension OperationQueue: DataBrokerProtectionOperationQueue {} +extension OperationQueue: DataBrokerProtectionOperationQueue { + /* + An unfortunute necessarity due to an issue with xcode 16 and building for Product Review Release + Originally we just used addBarrierBlock directly, but now it won't build as it says + the extension doesn't conform to the protocol + The docs however say the method signiture is unchanged, so we've decided to blame the build system + */ + func addBarrierCompletionBlock(_ barrier: @escaping @Sendable () -> Void) { + addBarrierBlock(barrier) + } +} enum DataBrokerProtectionQueueMode { case idle @@ -232,7 +242,7 @@ private extension DefaultDataBrokerProtectionQueueManager { return } - operationQueue.addBarrierBlock { [weak self] in + operationQueue.addBarrierCompletionBlock { [weak self] in let errorCollection = DataBrokerProtectionAgentErrorCollection(oneTimeError: nil, operationErrors: self?.operationErrorsForCurrentOperations()) completion?(errorCollection) self?.resetModeAndClearErrors() diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift index 7eda40ac91..7bf578e3f8 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift @@ -1373,7 +1373,7 @@ final class MockDataBrokerProtectionOperationQueue: DataBrokerProtectionOperatio self.operations.append(op) } - func addBarrierBlock(_ barrier: @escaping @Sendable () -> Void) { + func addBarrierCompletionBlock(_ barrier: @escaping @Sendable () -> Void) { didCallAddBarrierBlockCount += 1 self.barrierBlock = barrier }