Skip to content

Commit

Permalink
Fixed Warnings in MerchantBackend
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalsiger committed Oct 16, 2024
1 parent fcc7706 commit f16723e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions SwedbankPaySDKMerchantBackend/Classes/MerchantBackendApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct MerchantBackendApi {
let interceptor = requestDecorator.map {
RequestDecoratorInterceptor.init(
requestDecorator: $0,
decoratorCall: decoratorCall
decoratorCallHolder: .init(decoratorCall: decoratorCall)
)
}
return session.request(
Expand Down Expand Up @@ -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,
Expand All @@ -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))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import SwedbankPaySDK
import Alamofire

extension Request: SwedbankPaySDKRequest {
extension Request: @retroactive SwedbankPaySDKRequest {
public func cancel() {
_ = self.cancel() as Request
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public extension SwedbankPaySDK {
}
}

public protocol SwedbankPaySDKRequestDecorator {
public protocol SwedbankPaySDKRequestDecorator: Sendable {
func decorateAny(request: inout URLRequest)

func decorateGetTopLevelResources(request: inout URLRequest)
Expand Down

0 comments on commit f16723e

Please sign in to comment.