Skip to content

Commit

Permalink
Kingfisher upgrade, fix Swift 6 issues, bump min iOS to 13 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
regdos authored Nov 21, 2024
1 parent 1839eb8 commit 9219cbb
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PUAPI.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PUApplePay.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PUCore.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PUSDK.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PUTheme.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PUThreeDS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 5 additions & 3 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1400;
LastUpgradeCheck = 1400;
LastUpgradeCheck = 1610;
TargetAttributes = {
3ACEF7A4292BCECA00D62E9A = {
CreatedOnToolsVersion = 14.0;
Expand Down Expand Up @@ -865,6 +865,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -925,6 +926,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -959,7 +961,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -989,7 +991,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"originHash" : "0dd9c25a659f8a0ef0d349636c46f727113b8d3a83bf815cb7b3317c6ec9fef2",
"originHash" : "f7d6378cf48786bde2558846a41e3d789be3a0be44ee5cbcaf34f4f4cce7623a",
"pins" : [
{
"identity" : "kingfisher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher.git",
"state" : {
"revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50",
"version" : "7.12.0"
"revision" : "c0940e241945e6378c01fbd45fd3815579d47ef5",
"version" : "8.1.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import UIKit
final class SelectableListViewController<T: Selectable>: ListViewController<ListViewCell> {

// MARK: - Arguments
struct Arguments<T> {
let items: [T]
let selected: T?
struct Arguments<U> {
let items: [U]
let selected: U?
}

// MARK: - Public Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ extension NetworkClientAuthenticationChallengeHandler: URLSessionDelegate {

private extension SecTrust {
var valid: Bool {
var result: SecTrustResultType = .invalid
var status: OSStatus!
var error: CFError?

status = SecTrustEvaluate(self, &result)

guard status == noErr else { return false }
guard result == .recoverableTrustFailure else { return result == .unspecified || result == .proceed }
guard SecTrustEvaluateWithError(self, &error) else {
return false
}

let exceptions = SecTrustCopyExceptions(self)
_ = SecTrustSetExceptions(self, exceptions)
status = SecTrustEvaluate(self, &result)

guard status == noErr else { return false }
return result == .unspecified || result == .proceed
guard SecTrustEvaluateWithError(self, &error) else {
return false
}

return true
}

var publicKeys: [SecKey] {
Expand All @@ -91,18 +91,19 @@ private extension SecTrust {
guard let certificate = SecTrustGetCertificateAtIndex(self, ix) else { continue }
let certificates = [certificate] as CFArray

var result: SecTrustResultType = .invalid
var trust: SecTrust!
var status: OSStatus!
var error: CFError?

status = SecTrustCreateWithCertificates(
let status = SecTrustCreateWithCertificates(
certificates,
SecPolicyCreateBasicX509(),
&trust)

guard status == noErr else { continue }
status = SecTrustEvaluate(trust, &result)
guard status == noErr else { continue }

guard SecTrustEvaluateWithError(trust, &error) else {
continue
}

guard let publicKey = SecTrustCopyPublicKey(trust) else { continue }
publicKeys.append(publicKey)
Expand Down
11 changes: 6 additions & 5 deletions PUAPI/Sources/PUAPI/Client/NetworkClientCertificate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ struct NetworkClientCertificate {

var publicKey: SecKey? {
var trust: SecTrust!
var status: OSStatus!
var result: SecTrustResultType = .invalid
var error: CFError?

guard let certificate = certificate else { return nil }

status = SecTrustCreateWithCertificates(
let status = SecTrustCreateWithCertificates(
certificate,
SecPolicyCreateBasicX509(),
&trust)

guard status == noErr else { return nil }
status = SecTrustEvaluate(trust, &result)
guard status == noErr else { return nil }
guard SecTrustEvaluateWithError(trust, &error) else {
return nil
}

return SecTrustCopyPublicKey(trust)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PassKit

extension PKPaymentNetwork {
static func networks() -> [PKPaymentNetwork] {
if #available(iOS 12.0, *) {
if #available(iOS 13.0, *) {
return [.maestro, .masterCard, .visa]
} else {
return [.masterCard, .visa]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class PBLPaymentMethodsViewModel {

// MARK: - Public Properties
weak var delegate: PBLPaymentMethodsViewModelDelegate?
private (set) var items: [PaymentMethodItemPayByLink] = []
private(set) var items: [PaymentMethodItemPayByLink] = []

// MARK: - Private Properties
private let configuration: PaymentMethodsConfiguration
Expand Down
4 changes: 2 additions & 2 deletions PUSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|

s.platform = :ios
s.swift_version = '5.10'
s.ios.deployment_target = '12.0'
s.ios.deployment_target = '13.0'

s.subspec 'PUAPI' do |ss|
ss.source_files = 'PUAPI/Sources/PUAPI/**/*'
Expand Down Expand Up @@ -63,7 +63,7 @@ Pod::Spec.new do |s|
ss.source_files = 'PUTheme/Sources/PUTheme/**/*'
ss.resource_bundles = {'PUTheme' => ['PUTheme/Sources/PUTheme/Resources/Fonts/*.{ttf}']}
ss.resources = ['PUTheme/Sources/PUTheme/Resources/Fonts/*.{ttf}']
ss.dependency 'Kingfisher', '7.11.0'
ss.dependency 'Kingfisher', '8.1.0'
ss.dependency 'PUSDK/PUCore'
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import WebKit
@preconcurrency import WebKit

#if canImport(PUCore)
import PUCore
Expand Down
7 changes: 4 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"originHash" : "19316b9b29fdd6a3088b66d8e392584f242c56bfa65cfe0b9a12321596367bb5",
"pins" : [
{
"identity" : "kingfisher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher.git",
"state" : {
"revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50",
"version" : "7.12.0"
"revision" : "c0940e241945e6378c01fbd45fd3815579d47ef5",
"version" : "8.1.0"
}
},
{
Expand All @@ -19,5 +20,5 @@
}
}
],
"version" : 2
"version" : 3
}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let package = Package(
name: "PUSDK",
defaultLocalization: "pl",
platforms: [
.iOS(.v12)
.iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand Down Expand Up @@ -83,7 +83,7 @@ let package = Package(
// .package(url: /* package url */, from: "1.0.0"),
.package(
url: "https://github.com/onevcat/Kingfisher.git",
.upToNextMinor(from: .init(7, 12, 0))
.upToNextMinor(from: .init(8, 1, 0))
),
.package(
url: "https://github.com/birdrides/mockingbird",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Allows to make payments in PayU ecosystem.

## Requirements

* iOS 12.0 or higher
* iOS 13.0 or higher

## Getting Started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class PKPaymentNetworkExtensionsTests: XCTestCase {
func testShouldHaveExpectedNetworks() throws {
let sut = PKPaymentNetwork.networks()

if #available(iOS 12.0, *) {
if #available(iOS 13.0, *) {
XCTAssertTrue(sut.contains(.maestro))
XCTAssertTrue(sut.contains(.masterCard))
XCTAssertTrue(sut.contains(.visa))
Expand Down

0 comments on commit 9219cbb

Please sign in to comment.