From 8e655b6ba5e4d80372582c57193c2636ce0ca3d7 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 28 Oct 2024 14:07:39 +0100 Subject: [PATCH] Warnings cleanup (#1882) # Summary - Less linter warnings # Ticket COIOS-0000 --------- Co-authored-by: Alex Guretzki --- .../Abstract/AnyPaymentMethodDecoder.swift | 3 +++ Adyen/Model/PrefilledShopperInformation.swift | 1 + .../Form/AddressInputFormViewController.swift | 6 +++--- .../ThreeDS2PlusDACoreActionHandler.swift | 8 +++++++- .../DelegatedAuthenticationView.swift | 1 + AdyenCard/Form/FormCardLogosItemView.swift | 4 ++-- AdyenComponents/UPI/UPIComponent.swift | 12 ++++++------ .../Extensions/JSONEncoder+SortedKeys.swift | 4 ++-- .../Components/CardComponentUITests.swift | 2 +- 9 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift index 790fda85d1..80f10d25a1 100644 --- a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift +++ b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift @@ -29,6 +29,7 @@ private struct PaymentMethodField: Decodable { } } +// swiftlint:disable file_length internal enum AnyPaymentMethodDecoder { private static var decoders: [PaymentMethodType: PaymentMethodDecoder] = [ @@ -514,3 +515,5 @@ private struct TwintPaymentMethodDecoder: PaymentMethodDecoder { return nil } } + +// swiftlint:enable file_length diff --git a/Adyen/Model/PrefilledShopperInformation.swift b/Adyen/Model/PrefilledShopperInformation.swift index 1ce8ee5323..5ce7ff8182 100644 --- a/Adyen/Model/PrefilledShopperInformation.swift +++ b/Adyen/Model/PrefilledShopperInformation.swift @@ -58,6 +58,7 @@ public struct PrefilledShopperInformation: ShopperInformation { /// - deliveryAddress: The delivery address of the shopper, optional. /// - socialSecurityNumber: The social security number of the shopper, optional. /// - card: Shopper's card basic information, optional. + // swiftlint:disable:next line_length @available(*, deprecated, renamed: "init(shopperName:emailAddress:phoneNumber:billingAddress:deliveryAddress:socialSecurityNumber:card:)") public init( shopperName: ShopperName? = nil, diff --git a/Adyen/UI/View Controllers/AddressLookup/Form/AddressInputFormViewController.swift b/Adyen/UI/View Controllers/AddressLookup/Form/AddressInputFormViewController.swift index 9a90c72e87..5b8e626459 100644 --- a/Adyen/UI/View Controllers/AddressLookup/Form/AddressInputFormViewController.swift +++ b/Adyen/UI/View Controllers/AddressLookup/Form/AddressInputFormViewController.swift @@ -90,16 +90,16 @@ public class AddressInputFormViewController: FormViewController { }() } -internal extension AddressInputFormViewController { +extension AddressInputFormViewController { @objc - func submitTapped() { + internal func submitTapped() { guard validate() else { return } viewModel.handleSubmit(validAddress: addressItem.value) } @objc - func dismissAddressLookup() { + internal func dismissAddressLookup() { viewModel.handleDismiss() } } diff --git a/AdyenActions/Components/3DS2/Action handlers/3DS2+Delegated Authentication/ThreeDS2PlusDACoreActionHandler.swift b/AdyenActions/Components/3DS2/Action handlers/3DS2+Delegated Authentication/ThreeDS2PlusDACoreActionHandler.swift index f62f1001b2..8514224182 100644 --- a/AdyenActions/Components/3DS2/Action handlers/3DS2+Delegated Authentication/ThreeDS2PlusDACoreActionHandler.swift +++ b/AdyenActions/Components/3DS2/Action handlers/3DS2+Delegated Authentication/ThreeDS2PlusDACoreActionHandler.swift @@ -6,6 +6,8 @@ internal typealias VoidHandler = () -> Void +// swiftlint:disable file_length + #if canImport(AdyenAuthentication) @_spi(AdyenInternal) import Adyen import Adyen3DS2 @@ -15,6 +17,7 @@ internal typealias VoidHandler = () -> Void /// Handles the 3D Secure 2 fingerprint and challenge actions separately + Delegated Authentication. @available(iOS 16.0, *) + // swiftlint:disable:next type_body_length internal class ThreeDS2PlusDACoreActionHandler: ThreeDS2CoreActionHandler { internal var delegatedAuthenticationState: DelegatedAuthenticationState = .init() @@ -324,7 +327,8 @@ internal typealias VoidHandler = () -> Void switch result { case .failure: // If there is an error then we assume that the device is not registered and we try registration. - // Improvement: we could alternatively check the individual errors from AuthenticationSDK and based on which decide if we would like to call out if it is registered or not. + // Improvement: we could alternatively check the individual errors from AuthenticationSDK + // and based on which decide if we would like to call out if it is registered or not. handler(false) case let .success(isRegistered): handler(isRegistered) @@ -502,3 +506,5 @@ internal typealias VoidHandler = () -> Void } #endif + +// swiftlint:enable file_length diff --git a/AdyenActions/UI/View Controllers/DelegatedAuthentication/DelegatedAuthenticationView.swift b/AdyenActions/UI/View Controllers/DelegatedAuthentication/DelegatedAuthenticationView.swift index a8c8d7cc57..319189a0c1 100644 --- a/AdyenActions/UI/View Controllers/DelegatedAuthentication/DelegatedAuthenticationView.swift +++ b/AdyenActions/UI/View Controllers/DelegatedAuthentication/DelegatedAuthenticationView.swift @@ -15,6 +15,7 @@ internal protocol DelegatedAuthenticationViewDelegate: AnyObject { } @available(iOS 16.0, *) +// swiftlint:disable:next type_body_length internal final class DelegatedAuthenticationView: UIView { private enum Constants { diff --git a/AdyenCard/Form/FormCardLogosItemView.swift b/AdyenCard/Form/FormCardLogosItemView.swift index b675125d49..0b4d8ed163 100644 --- a/AdyenCard/Form/FormCardLogosItemView.swift +++ b/AdyenCard/Form/FormCardLogosItemView.swift @@ -36,11 +36,11 @@ internal final class FormCardLogosItemView: FormItemView, UIC collectionView.dataSource = self } - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { item.cardLogos.count } - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CardLogoCell.reuseIdentifier, for: indexPath) if let cell = cell as? CardLogoCell, let logo = item.cardLogos.adyen[safeIndex: indexPath.row] { cell.update( diff --git a/AdyenComponents/UPI/UPIComponent.swift b/AdyenComponents/UPI/UPIComponent.swift index ae02de434d..3be16cb132 100644 --- a/AdyenComponents/UPI/UPIComponent.swift +++ b/AdyenComponents/UPI/UPIComponent.swift @@ -31,13 +31,13 @@ public final class UPIComponent: PaymentComponent, } internal enum Constants { - static let upiCollect = "upi_collect" - static let upiQRCode = "upi_qr" - static let upiIntent = "upi_intent" - static let vpaFlowIdentifier = "UPI/VPA" - static let noAppsVpaSegmentTitle = "VPA" + internal static let upiCollect = "upi_collect" + internal static let upiQRCode = "upi_qr" + internal static let upiIntent = "upi_intent" + internal static let vpaFlowIdentifier = "UPI/VPA" + internal static let noAppsVpaSegmentTitle = "VPA" - static let qrCodeIcon = "qrcode" + internal static let qrCodeIcon = "qrcode" } /// Configuration for UPI Component. diff --git a/AdyenEncryption/Extensions/JSONEncoder+SortedKeys.swift b/AdyenEncryption/Extensions/JSONEncoder+SortedKeys.swift index 9f3f8e5a58..29768396a5 100644 --- a/AdyenEncryption/Extensions/JSONEncoder+SortedKeys.swift +++ b/AdyenEncryption/Extensions/JSONEncoder+SortedKeys.swift @@ -6,8 +6,8 @@ import Foundation -internal extension JSONEncoder { - static func encodeWithSortedKeys(_ encodable: Encodable) throws -> Data { +extension JSONEncoder { + internal static func encodeWithSortedKeys(_ encodable: Encodable) throws -> Data { let encoder = JSONEncoder() encoder.dateEncodingStrategy = .iso8601 encoder.outputFormatting = .sortedKeys diff --git a/Tests/SnapshotTests/Components/CardComponentUITests.swift b/Tests/SnapshotTests/Components/CardComponentUITests.swift index ac555ce350..87c649a955 100644 --- a/Tests/SnapshotTests/Components/CardComponentUITests.swift +++ b/Tests/SnapshotTests/Components/CardComponentUITests.swift @@ -105,7 +105,7 @@ private extension CardComponent.AddressFormType { var description: String { switch self { - case let .lookup(provider): + case .lookup: "lookup" case .full: "full"