diff --git a/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/Contents.json b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/Contents.json b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/Contents.json new file mode 100644 index 000000000000..b74b82f821a9 --- /dev/null +++ b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/Contents.json @@ -0,0 +1,25 @@ +{ + "images" : [ + { + "filename" : "cbcLight.svg", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "cbcDark.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true + } +} diff --git a/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/cbcDark.svg b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/cbcDark.svg new file mode 100644 index 000000000000..019f30a0568c --- /dev/null +++ b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/cbcDark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/cbcLight.svg b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/cbcLight.svg new file mode 100644 index 000000000000..2277a5eb288a --- /dev/null +++ b/StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets/Cards/stp_card_cbc.imageset/cbcLight.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/StripePaymentsUI/StripePaymentsUI/Source/Internal/UI/Elements/DropDownFieldElement+CardBrand.swift b/StripePaymentSheet/StripePaymentSheet/Source/Categories/DropDownFieldElement+CardBrand.swift similarity index 100% rename from StripePaymentsUI/StripePaymentsUI/Source/Internal/UI/Elements/DropDownFieldElement+CardBrand.swift rename to StripePaymentSheet/StripePaymentSheet/Source/Categories/DropDownFieldElement+CardBrand.swift diff --git a/StripePaymentsUI/StripePaymentsUI/Source/Internal/Categories/STPCardBrand+PaymentsUI.swift b/StripePaymentSheet/StripePaymentSheet/Source/Categories/STPCardBrand+PaymentsUI.swift similarity index 92% rename from StripePaymentsUI/StripePaymentsUI/Source/Internal/Categories/STPCardBrand+PaymentsUI.swift rename to StripePaymentSheet/StripePaymentSheet/Source/Categories/STPCardBrand+PaymentsUI.swift index 09da4fc18811..873c9cf29e6c 100644 --- a/StripePaymentsUI/StripePaymentsUI/Source/Internal/Categories/STPCardBrand+PaymentsUI.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Categories/STPCardBrand+PaymentsUI.swift @@ -13,7 +13,7 @@ import UIKit extension STPCardBrand { func brandIconAttributedString(theme: ElementsAppearance = .default, maxWidth: CGFloat? = nil) -> NSAttributedString { let brandImageAttachment = NSTextAttachment() - let image: UIImage = self == .unknown ? STPImageLibrary.cardBrandChoiceImage() : STPImageLibrary.cardBrandImage(for: self) + let image: UIImage = self == .unknown ? PaymentSheetImageLibrary.cardBrandChoiceImage() : PaymentSheetImageLibrary.cardBrandImage(for: self) brandImageAttachment.image = image // TODO: -3 is a hack for proper vertical alignment, investigate this let hackyVerticalInset: CGFloat = -3 diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Helpers/PaymentSheetImageLibrary.swift b/StripePaymentSheet/StripePaymentSheet/Source/Helpers/PaymentSheetImageLibrary.swift index 4ad7bb1da326..aa99ad5f98f4 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Helpers/PaymentSheetImageLibrary.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Helpers/PaymentSheetImageLibrary.swift @@ -150,6 +150,13 @@ class PaymentSheetImageLibrary { class func unknownCardCardImage() -> UIImage { return cardBrandImage(for: .unknown) } + + /// This returns the icon for an unselected brand when multiple card brands are available. + class func cardBrandChoiceImage() + -> UIImage + { + return self.safeImageNamed("ps_card_cbc", templateIfAvailable: false) + } } // MARK: - v2 Images diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-UpdatePaymentViewController.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-UpdatePaymentViewController.swift index f5865681af52..200efa8892dd 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-UpdatePaymentViewController.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-UpdatePaymentViewController.swift @@ -9,7 +9,6 @@ import UIKit @_spi(STP) import StripeCore -@_spi(STP) import StripePaymentsUI @_spi(STP) import StripeUICore protocol UpdatePaymentViewControllerDelegate: AnyObject { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-WalletViewModel.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-WalletViewModel.swift index 91160a495c51..c3f2ec2956c2 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-WalletViewModel.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Controllers/PayWithLinkViewController-WalletViewModel.swift @@ -9,7 +9,6 @@ import Foundation @_spi(STP) import StripeCore @_spi(STP) import StripePayments -@_spi(STP) import StripePaymentsUI @_spi(STP) import StripeUICore protocol PayWithLinkWalletViewModelDelegate: AnyObject { diff --git a/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Elements/InlineSignup/LinkInlineSignupView-CheckboxElement.swift b/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Elements/InlineSignup/LinkInlineSignupView-CheckboxElement.swift index 4059bba8e80f..7f68e4bcd8d0 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Elements/InlineSignup/LinkInlineSignupView-CheckboxElement.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/Internal/Link/Elements/InlineSignup/LinkInlineSignupView-CheckboxElement.swift @@ -7,7 +7,6 @@ // @_spi(STP) import StripeCore -@_spi(STP) import StripePaymentsUI @_spi(STP) import StripeUICore import UIKit diff --git a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Views/CardBrandView.swift b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Views/CardBrandView.swift index 15c7ef4541ea..1e52a5f88ca7 100644 --- a/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Views/CardBrandView.swift +++ b/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Views/CardBrandView.swift @@ -133,7 +133,7 @@ import UIKit ) { fatalError("init(coder:) has not been implemented") } - + /// Card brand to display. var cardBrand: STPCardBrand = .unknown { didSet {