From f16723ed0465d6ad36031994b217a2da6bad4df3 Mon Sep 17 00:00:00 2001 From: Michael Balsiger Date: Wed, 16 Oct 2024 15:23:13 +0200 Subject: [PATCH] Fixed Warnings in MerchantBackend --- .../Classes/MerchantBackendApi.swift | 12 ++++++++---- .../Classes/MerchantBackendRequest.swift | 2 +- .../Classes/RequestDecorator.swift | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendApi.swift b/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendApi.swift index 611c43e..fc5443f 100644 --- a/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendApi.swift +++ b/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendApi.swift @@ -66,7 +66,7 @@ struct MerchantBackendApi { let interceptor = requestDecorator.map { RequestDecoratorInterceptor.init( requestDecorator: $0, - decoratorCall: decoratorCall + decoratorCallHolder: .init(decoratorCall: decoratorCall) ) } return session.request( @@ -95,10 +95,14 @@ struct MerchantBackendApi { return false } + struct DecoratorCallHolder { + let decoratorCall: DecoratorCall + } + internal struct RequestDecoratorInterceptor: RequestInterceptor { let requestDecorator: SwedbankPaySDKRequestDecorator - let decoratorCall: DecoratorCall - + let decoratorCallHolder: DecoratorCallHolder + func adapt( _ urlRequest: URLRequest, for session: Session, @@ -107,7 +111,7 @@ struct MerchantBackendApi { var request = urlRequest DispatchQueue.main.async { self.requestDecorator.decorateAny(request: &request) - self.decoratorCall(self.requestDecorator, &request) + self.decoratorCallHolder.decoratorCall(self.requestDecorator, &request) completion(.success(request)) } } diff --git a/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendRequest.swift b/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendRequest.swift index 5e1a614..7756a0c 100644 --- a/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendRequest.swift +++ b/SwedbankPaySDKMerchantBackend/Classes/MerchantBackendRequest.swift @@ -16,7 +16,7 @@ import SwedbankPaySDK import Alamofire -extension Request: SwedbankPaySDKRequest { +extension Request: @retroactive SwedbankPaySDKRequest { public func cancel() { _ = self.cancel() as Request } diff --git a/SwedbankPaySDKMerchantBackend/Classes/RequestDecorator.swift b/SwedbankPaySDKMerchantBackend/Classes/RequestDecorator.swift index 0c95b73..b556ea8 100644 --- a/SwedbankPaySDKMerchantBackend/Classes/RequestDecorator.swift +++ b/SwedbankPaySDKMerchantBackend/Classes/RequestDecorator.swift @@ -31,7 +31,7 @@ public extension SwedbankPaySDK { } } -public protocol SwedbankPaySDKRequestDecorator { +public protocol SwedbankPaySDKRequestDecorator: Sendable { func decorateAny(request: inout URLRequest) func decorateGetTopLevelResources(request: inout URLRequest)