From 7dd56055f7f562d359fddcac8ef89018068adbe9 Mon Sep 17 00:00:00 2001 From: Michael Balsiger Date: Fri, 4 Oct 2024 11:14:18 +0200 Subject: [PATCH] Bumped to iOS 11 and fixed all warnings --- SwedbankPaySDK.podspec | 2 +- SwedbankPaySDK.xcodeproj/project.pbxproj | 6 ++---- .../Classes/Api/Helpers/CustomDateDecoder.swift | 2 +- .../Classes/ApplePay/SwedbankPayAuthorization.swift | 4 ++-- .../Classes/Beacon/BeaconEndpointRouter.swift | 4 +--- .../Classes/SwedbankPayPaymentSession.swift | 2 +- .../ConfigurationAsync.swift | 12 ++++++++++-- .../Classes/WebView/SCAWebViewService.swift | 2 +- .../WebView/SwedbankPayExtraWebViewController.swift | 2 +- .../WebView/SwedbankPaySCAWebViewController.swift | 2 +- .../WebView/SwedbankPayWebViewController.swift | 2 +- .../WebView/SwedbankPayWebViewControllerBase.swift | 2 +- SwedbankPaySDKMerchantBackend.podspec | 2 +- 13 files changed, 24 insertions(+), 20 deletions(-) diff --git a/SwedbankPaySDK.podspec b/SwedbankPaySDK.podspec index ba949e4..936b095 100644 --- a/SwedbankPaySDK.podspec +++ b/SwedbankPaySDK.podspec @@ -20,7 +20,7 @@ The Swedbank Pay iOS SDK enables simple embedding of Swedbank Pay Checkout to an s.author = 'Swedbank Pay' s.source = { :git => 'https://github.com/SwedbankPay/swedbank-pay-sdk-ios.git', :tag => s.version.to_s } - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.swift_versions = '5.0', '5.1' s.source_files = 'SwedbankPaySDK/Classes/**/*' diff --git a/SwedbankPaySDK.xcodeproj/project.pbxproj b/SwedbankPaySDK.xcodeproj/project.pbxproj index 0675999..654da11 100644 --- a/SwedbankPaySDK.xcodeproj/project.pbxproj +++ b/SwedbankPaySDK.xcodeproj/project.pbxproj @@ -1578,7 +1578,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1637,7 +1637,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -1660,7 +1660,6 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SwedbankPaySDK/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1685,7 +1684,6 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SwedbankPaySDK/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/SwedbankPaySDK/Classes/Api/Helpers/CustomDateDecoder.swift b/SwedbankPaySDK/Classes/Api/Helpers/CustomDateDecoder.swift index dd884b6..539a2c0 100644 --- a/SwedbankPaySDK/Classes/Api/Helpers/CustomDateDecoder.swift +++ b/SwedbankPaySDK/Classes/Api/Helpers/CustomDateDecoder.swift @@ -15,7 +15,7 @@ import Foundation -class CustomDateDecoder: JSONDecoder { +class CustomDateDecoder: JSONDecoder, @unchecked Sendable { let dateFormatter = { let formatter = ISO8601DateFormatter() formatter.timeZone = TimeZone(identifier: "UTC") diff --git a/SwedbankPaySDK/Classes/ApplePay/SwedbankPayAuthorization.swift b/SwedbankPaySDK/Classes/ApplePay/SwedbankPayAuthorization.swift index c2015b8..6f549a5 100644 --- a/SwedbankPaySDK/Classes/ApplePay/SwedbankPayAuthorization.swift +++ b/SwedbankPaySDK/Classes/ApplePay/SwedbankPayAuthorization.swift @@ -45,7 +45,7 @@ class SwedbankPayAuthorization: NSObject { paymentRequest.merchantIdentifier = merchantIdentifier - if let merchantCapabilities = task.expects?.first(where: { $0.name == "MerchantCapabilities" })?.stringArray?.contains(where: { $0 == "supports3DS" }) { + if (task.expects?.first(where: { $0.name == "MerchantCapabilities" })?.stringArray?.contains(where: { $0 == "supports3DS" })) != nil { paymentRequest.merchantCapabilities = .threeDSecure } @@ -85,7 +85,7 @@ class SwedbankPayAuthorization: NSObject { extension SwedbankPayAuthorization: PKPaymentAuthorizationControllerDelegate { func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) { if let handler = self.handler { - if let status = status { + if status != nil { handler(.success((success))) } else { handler(.failure(self.errors?.first ?? SwedbankPayAPIError.unknown)) diff --git a/SwedbankPaySDK/Classes/Beacon/BeaconEndpointRouter.swift b/SwedbankPaySDK/Classes/Beacon/BeaconEndpointRouter.swift index 344f006..a7a4bb3 100644 --- a/SwedbankPaySDK/Classes/Beacon/BeaconEndpointRouter.swift +++ b/SwedbankPaySDK/Classes/Beacon/BeaconEndpointRouter.swift @@ -90,11 +90,9 @@ struct BeaconEndpointRouter: BeaconEndpointRouterProtocol { extension BeaconEndpointRouter { func makeRequest(handler: @escaping (Result) -> Void) { - let requestStartTimestamp: Date = Date() - requestWithDataResponse { result in switch result { - case .success(let data): + case .success: handler(.success(())) case .failure(let error): handler(.failure(error)) diff --git a/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift b/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift index 3596e27..93079ae 100644 --- a/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift +++ b/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift @@ -499,7 +499,7 @@ public extension SwedbankPaySDK { switch result { case .success: self.scaMethodRequestDataPerformed.append((name: task.expects?.first(where: { $0.name == "threeDSMethodData" })?.value ?? "null", value: "Y")) - case .failure(let error): + case .failure: self.scaMethodRequestDataPerformed.append((name: task.expects?.first(where: { $0.name == "threeDSMethodData" })?.value ?? "null", value: "N")) } diff --git a/SwedbankPaySDK/Classes/SwedbankPaySDK+Extensions/ConfigurationAsync.swift b/SwedbankPaySDK/Classes/SwedbankPaySDK+Extensions/ConfigurationAsync.swift index 551a38a..480114d 100644 --- a/SwedbankPaySDK/Classes/SwedbankPaySDK+Extensions/ConfigurationAsync.swift +++ b/SwedbankPaySDK/Classes/SwedbankPaySDK+Extensions/ConfigurationAsync.swift @@ -196,7 +196,11 @@ public extension SwedbankPaySDKConfigurationAsync { @available(*, deprecated, message: "no longer maintained") func urlMatchesListOfGoodRedirects(_ url: URL) async -> Bool { return await withUnsafeContinuation { continuation in - urlMatchesListOfGoodRedirects(url, completion: continuation.resume(returning:)) + urlMatchesListOfGoodRedirects(url, completion: { _ in + Task { @MainActor in + continuation.resume(returning:) + } + }) } } @@ -204,7 +208,11 @@ public extension SwedbankPaySDKConfigurationAsync { navigationAction: WKNavigationAction ) async -> SwedbankPaySDK.PaymentMenuRedirectPolicy { return await withUnsafeContinuation { continuation in - decidePolicyForPaymentMenuRedirect(navigationAction: navigationAction, completion: continuation.resume(returning:)) + decidePolicyForPaymentMenuRedirect(navigationAction: navigationAction, completion: { paymentMenuRedirectPolicy in + Task { @MainActor in + continuation.resume(returning: paymentMenuRedirectPolicy) + } + }) } } } diff --git a/SwedbankPaySDK/Classes/WebView/SCAWebViewService.swift b/SwedbankPaySDK/Classes/WebView/SCAWebViewService.swift index e933ab3..fea8dc1 100644 --- a/SwedbankPaySDK/Classes/WebView/SCAWebViewService.swift +++ b/SwedbankPaySDK/Classes/WebView/SCAWebViewService.swift @@ -14,7 +14,7 @@ // limitations under the License. import Foundation -import WebKit +@preconcurrency import WebKit class SCAWebViewService: NSObject, WKNavigationDelegate { private var handler: ((Result) -> Void)? diff --git a/SwedbankPaySDK/Classes/WebView/SwedbankPayExtraWebViewController.swift b/SwedbankPaySDK/Classes/WebView/SwedbankPayExtraWebViewController.swift index f523530..b141377 100644 --- a/SwedbankPaySDK/Classes/WebView/SwedbankPayExtraWebViewController.swift +++ b/SwedbankPaySDK/Classes/WebView/SwedbankPayExtraWebViewController.swift @@ -14,7 +14,7 @@ // limitations under the License. import Foundation -import WebKit +@preconcurrency import WebKit final class SwedbankPayExtraWebViewController: SwedbankPayWebViewControllerBase { override init( diff --git a/SwedbankPaySDK/Classes/WebView/SwedbankPaySCAWebViewController.swift b/SwedbankPaySDK/Classes/WebView/SwedbankPaySCAWebViewController.swift index 768ecab..6d8ba2e 100644 --- a/SwedbankPaySDK/Classes/WebView/SwedbankPaySCAWebViewController.swift +++ b/SwedbankPaySDK/Classes/WebView/SwedbankPaySCAWebViewController.swift @@ -14,7 +14,7 @@ // limitations under the License. import UIKit -import WebKit +@preconcurrency import WebKit class SwedbankPaySCAWebViewController: UIViewController { internal var lastRootPage: (navigation: WKNavigation?, baseURL: URL?)? diff --git a/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewController.swift b/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewController.swift index 7e987b6..c4f7ed3 100644 --- a/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewController.swift +++ b/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewController.swift @@ -14,7 +14,7 @@ // limitations under the License. import UIKit -import WebKit +@preconcurrency import WebKit class SwedbankPayWebViewController: SwedbankPayWebViewControllerBase { internal static let maybeStuckNoteMinimumIntervalFromDidBecomeActive = 3.0 diff --git a/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewControllerBase.swift b/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewControllerBase.swift index 0fe02c1..73afb92 100644 --- a/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewControllerBase.swift +++ b/SwedbankPaySDK/Classes/WebView/SwedbankPayWebViewControllerBase.swift @@ -14,7 +14,7 @@ // limitations under the License. import UIKit -import WebKit +@preconcurrency import WebKit class SwedbankPayWebViewControllerBase: UIViewController { weak var delegate: SwedbankPayWebViewControllerDelegate? diff --git a/SwedbankPaySDKMerchantBackend.podspec b/SwedbankPaySDKMerchantBackend.podspec index 2b1a6df..2c1ffe7 100644 --- a/SwedbankPaySDKMerchantBackend.podspec +++ b/SwedbankPaySDKMerchantBackend.podspec @@ -13,7 +13,7 @@ a backend server that implements the Merchant Backend API. s.author = 'Swedbank Pay' s.source = { :git => 'https://github.com/SwedbankPay/swedbank-pay-sdk-ios.git', :tag => s.version.to_s } - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.swift_versions = '5.0', '5.1' s.dependency 'SwedbankPaySDK', s.version.to_s