Skip to content

Commit

Permalink
Merge branch 'develop' into develop-fix-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
goergisn authored Nov 27, 2023
2 parents 548f2f2 + ed9c64f commit a1d3bc1
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 77 deletions.
6 changes: 0 additions & 6 deletions Adyen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@
81825CB92AC59C3300F91912 /* UIView+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CB72AC59C3300F91912 /* UIView+Search.swift */; };
81825CBB2AC59C4000F91912 /* UIViewController+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CBA2AC59C4000F91912 /* UIViewController+Search.swift */; };
81825CBC2AC59C4000F91912 /* UIViewController+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CBA2AC59C4000F91912 /* UIViewController+Search.swift */; };
81825CBE2AC59C4B00F91912 /* XCTestCase+Available.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CBD2AC59C4B00F91912 /* XCTestCase+Available.swift */; };
81825CBF2AC59C4B00F91912 /* XCTestCase+Available.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CBD2AC59C4B00F91912 /* XCTestCase+Available.swift */; };
81825CC12AC59C6400F91912 /* XCTestCase+RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CC02AC59C6400F91912 /* XCTestCase+RootViewController.swift */; };
81825CC22AC59C6400F91912 /* XCTestCase+RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CC02AC59C6400F91912 /* XCTestCase+RootViewController.swift */; };
81825CC42AC59C6C00F91912 /* XCTestCase+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81825CC32AC59C6C00F91912 /* XCTestCase+Wait.swift */; };
Expand Down Expand Up @@ -1366,7 +1364,6 @@
814276612A7145F50081E896 /* AddressInputFormViewController+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressInputFormViewController+ViewModel.swift"; sourceTree = "<group>"; };
81825CB72AC59C3300F91912 /* UIView+Search.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Search.swift"; sourceTree = "<group>"; };
81825CBA2AC59C4000F91912 /* UIViewController+Search.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+Search.swift"; sourceTree = "<group>"; };
81825CBD2AC59C4B00F91912 /* XCTestCase+Available.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Available.swift"; sourceTree = "<group>"; };
81825CC02AC59C6400F91912 /* XCTestCase+RootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+RootViewController.swift"; sourceTree = "<group>"; };
81825CC32AC59C6C00F91912 /* XCTestCase+Wait.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Wait.swift"; sourceTree = "<group>"; };
81896E842A4DB5F300C532CA /* SearchViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewControllerTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2905,7 +2902,6 @@
children = (
81825CB72AC59C3300F91912 /* UIView+Search.swift */,
81825CBA2AC59C4000F91912 /* UIViewController+Search.swift */,
81825CBD2AC59C4B00F91912 /* XCTestCase+Available.swift */,
81825CC32AC59C6C00F91912 /* XCTestCase+Wait.swift */,
F96AE51A26038602009F82BD /* XCTestCaseExtension.swift */,
81825CC02AC59C6400F91912 /* XCTestCase+RootViewController.swift */,
Expand Down Expand Up @@ -6726,7 +6722,6 @@
F924C072246BEEF0006DDAB8 /* CardDetailsTests.swift in Sources */,
F9FE39E32679E09200F02A9B /* LoadingViewTests.swift in Sources */,
F96A25472372C39F007DBF0B /* ApplePayDetailsTest.swift in Sources */,
81825CBE2AC59C4B00F91912 /* XCTestCase+Available.swift in Sources */,
A07B2CF226A5D4FE0008185C /* BrazilSocialSecurityNumberFormatterTests.swift in Sources */,
A04E60DB27F30D900051C72C /* SessionDelegateMock.swift in Sources */,
F9AC61C424375F510062A00D /* PresentingViewControllerMock.swift in Sources */,
Expand Down Expand Up @@ -7223,7 +7218,6 @@
00220955299B8B1C00B2BACD /* BLIKComponentUITests.swift in Sources */,
81825CC22AC59C6400F91912 /* XCTestCase+RootViewController.swift in Sources */,
F9CCA3D7296ECDB200AD643D /* XCTestCase+Coder.swift in Sources */,
81825CBF2AC59C4B00F91912 /* XCTestCase+Available.swift in Sources */,
F9CCA3C5296ECB9900AD643D /* ListViewControllerUITests.swift in Sources */,
F9CCA3D3296ECD0700AD643D /* PostalAddressMocks.swift in Sources */,
);
Expand Down
14 changes: 4 additions & 10 deletions Adyen/UI/View Controllers/SecuredViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,10 @@ public final class SecuredViewController<ChildViewController: UIViewController>:
private var blurEffectView: UIVisualEffectView

private lazy var blurEffect: UIBlurEffect = {
if #available(iOS 12.0, *) {
switch traitCollection.userInterfaceStyle {
case .dark:
return UIBlurEffect(style: .dark)
case .light, .unspecified:
return UIBlurEffect(style: .light)
@unknown default:
return UIBlurEffect(style: .light)
}
} else {
switch traitCollection.userInterfaceStyle {
case .dark:
return UIBlurEffect(style: .dark)
default:
return UIBlurEffect(style: .light)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion AdyenComponents/Apple Pay/ApplePayConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ extension PKPaymentNetwork {

internal var txVariantName: String {
if self == .masterCard { return "mc" }
if #available(iOS 11.2, *), self == .cartesBancaires { return "cartebancaire" }
if self == .cartesBancaires { return "cartebancaire" }
return self.rawValue.lowercased()
}

Expand Down
19 changes: 9 additions & 10 deletions AdyenDropIn/Views/PreApplePayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ internal final class PreApplePayView: UIView, Localizable {

/// Creates PKPaymentButtonStyle based on Dark or Light Mode.
private var paymentButtonStyleAuto: PKPaymentButtonStyle {
let buttonStyle: PKPaymentButtonStyle
if #available(iOS 14.0, *) {
buttonStyle = .automatic
} else if #available(iOS 12.0, *), traitCollection.userInterfaceStyle == .dark {
buttonStyle = .white
} else {
buttonStyle = .black
return .automatic
}

switch traitCollection.userInterfaceStyle {
case .dark:
return .white
default:
return .black
}
return buttonStyle
}

internal init(model: Model) {
Expand Down Expand Up @@ -66,9 +67,7 @@ internal final class PreApplePayView: UIView, Localizable {
])
payButton.accessibilityIdentifier = ViewIdentifierBuilder.build(scopeInstance: self, postfix: "applePayButton")

if #available(iOS 12.0, *) {
payButton.cornerRadius = model.style.cornerRadius
}
payButton.cornerRadius = model.style.cornerRadius
}

private func addHintLabel() {
Expand Down
20 changes: 12 additions & 8 deletions Demo/UIKit/ComponentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,18 @@ internal final class ComponentsView: UIView {
}

private func setUpApplePayCell(_ cell: UITableViewCell) {
let style: PKPaymentButtonStyle
if #available(iOS 14.0, *) {
style = .automatic
} else if #available(iOS 12.0, *), traitCollection.userInterfaceStyle == .dark {
style = .white
} else {
style = .black
}
let style: PKPaymentButtonStyle = {
if #available(iOS 14.0, *) {
return .automatic
}

switch traitCollection.userInterfaceStyle {
case .dark:
return .white
default:
return .black
}
}()

let contentView = cell.contentView

Expand Down
2 changes: 1 addition & 1 deletion Tests/Adyen Tests/Utilities/AmountFormatterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AmountFormatterTests: XCTestCase {
XCTAssertEqual(AmountFormatter.formatted(amount: amount, currencyCode: "CVE", localeIdentifier: "ko_KR"), "CVE 123,456")
XCTAssertEqual(AmountFormatter.formatted(amount: amount, currencyCode: "CVE", localeIdentifier: "fr_FR"), "123 456 CVE")

if Available.iOS17 {
if #available(iOS 17.0, *) {
XCTAssertEqual(AmountFormatter.formatted(amount: amount, currencyCode: "ISK", localeIdentifier: "is_IS"), "1.234,56 kr.")
} else {
XCTAssertEqual(AmountFormatter.formatted(amount: amount, currencyCode: "ISK", localeIdentifier: "is_IS"), "1.234,56 ISK")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import XCTest

override func setUpWithError() throws {
guard #available(iOS 14.0, *) else {
// XCTestCase does not respect @available so we have skip all tests here
// XCTestCase does not respect @available so we have to skip the test like this
throw XCTSkip("Unsupported iOS version")
}

Expand Down
10 changes: 6 additions & 4 deletions Tests/Components Tests/Apple Pay/ApplePayComponentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ class ApplePayComponentTest: XCTestCase {
waitForExpectations(timeout: 4)
}

@available(iOS 15.0, *)
func testApplePayCoupon() {
guard Available.iOS15 else { return }
func testApplePayCoupon() throws {
guard #available(iOS 15.0, *) else {
// XCTestCase does not respect @available so we have to skip the test like this
throw XCTSkip("Unsupported iOS version")
}

sut.applePayDelegate = mockApplePayDelegate
(mockApplePayDelegate as! ApplePayDelegateMockiOS15).onCouponChange = { coupon, payment in
Expand Down Expand Up @@ -298,7 +300,7 @@ class ApplePayComponentTest: XCTestCase {

func testNewInitSuccess() throws {
guard #available(iOS 16.0, *) else {
// XCTestCase does not respect @available so we have skip all tests here
// XCTestCase does not respect @available so we have to skip the test like this
throw XCTSkip("Unsupported iOS version")
}

Expand Down
36 changes: 0 additions & 36 deletions Tests/Helpers/XCTestCase+Available.swift

This file was deleted.

0 comments on commit a1d3bc1

Please sign in to comment.