Skip to content

Commit

Permalink
Remove old Link branding (stripe#3516)
Browse files Browse the repository at this point in the history
## Summary
- Removes old Link branding.

## Motivation
https://jira.corp.stripe.com/browse/RUN_MOBILESDK-3108

## Testing
<!-- How was the code tested? Be as specific as possible. -->

## Changelog
N/A
  • Loading branch information
porter-stripe authored Apr 15, 2024
1 parent d1058b7 commit ba4f30c
Show file tree
Hide file tree
Showing 43 changed files with 19 additions and 250 deletions.
53 changes: 2 additions & 51 deletions Stripe/StripeiOSTests/PayWithLinkButtonSnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,55 +64,7 @@ class PayWithLinkButtonSnapshotTests: STPSnapshotTestCase {
}

func testRegistered_withLongEmailAddress() {
let sut = makeSUT(useNewBrand: true)
sut.linkAccount = makeAccountStub(email: longEmailAddress, isRegistered: true)
verify(sut)
}

func testDefault_legacy() {
let sut = makeSUT(useNewBrand: false)
sut.linkAccount = makeAccountStub(email: emailAddress, isRegistered: false)
verify(sut)

sut.isHighlighted = true
verify(sut, identifier: "Highlighted")
}

func testDefault_rounded_legacy() {
let sut = makeSUT(useNewBrand: false)
sut.cornerRadius = 16
sut.linkAccount = makeAccountStub(email: emailAddress, isRegistered: false)
verify(sut)
}

func testDisabled_legacy() {
let sut = makeSUT(useNewBrand: false)
sut.isEnabled = false
verify(sut)
}

func testRegistered_legacy() {
let sut = makeSUT(useNewBrand: false)
sut.linkAccount = makeAccountStub(email: emailAddress, isRegistered: true)
verify(sut)
}

func testRegistered_rounded_legacy() {
let sut = makeSUT(useNewBrand: false)
sut.cornerRadius = 16
sut.linkAccount = makeAccountStub(email: emailAddress, isRegistered: true)
verify(sut)
}

func testRegistered_square_legacy() {
let sut = makeSUT(useNewBrand: false)
sut.cornerRadius = 0
sut.linkAccount = makeAccountStub(email: emailAddress, isRegistered: true)
verify(sut)
}

func testRegistered_withLongEmailAddress_legacy() {
let sut = makeSUT(useNewBrand: false)
let sut = makeSUT()
sut.linkAccount = makeAccountStub(email: longEmailAddress, isRegistered: true)
verify(sut)
}
Expand Down Expand Up @@ -143,8 +95,7 @@ extension PayWithLinkButtonSnapshotTests {
)
}

fileprivate func makeSUT(useNewBrand: Bool = true) -> PayWithLinkButton {
LinkUI.useNewBrand = useNewBrand
fileprivate func makeSUT() -> PayWithLinkButton {
return PayWithLinkButton()
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ enum Image: String, CaseIterable, ImageMaker {
case pm_type_p24 = "icon-pm-p24"
case pm_type_sepa = "icon-pm-sepa"
case pm_type_paypal = "icon-pm-paypal"
case pm_type_link_deprecated = "icon-pm-link-deprecated"
case pm_type_upi = "icon-pm-upi"
case pm_type_cashapp = "icon-pm-cashapp"
case pm_type_revolutpay = "icon-pm-revolutpay"
Expand All @@ -59,8 +58,6 @@ enum Image: String, CaseIterable, ImageMaker {
case link_logo = "link_logo"
case link_logo_bw = "link_logo_bw"
case link_logo_knockout = "link_logo_knockout"
case link_logo_deprecated = "link_logo_deprecated"
case link_arrow_deprecated = "link_arrow_deprecated"

// Carousel
case carousel_applepay
Expand All @@ -73,7 +70,6 @@ enum Image: String, CaseIterable, ImageMaker {
case carousel_card_unionpay
case carousel_card_unknown
case carousel_card_visa
case carousel_link_deprecated
case carousel_sepa

// Affirm Images
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ extension UIColor {
///
/// Use it as accent color for controls and activity indicators.
static var linkBrand: UIColor {
LinkUI.useNewBrand ? UIColor(red: 0, green: 0.84, blue: 0.44, alpha: 1.0) : UIColor(red: 0.2, green: 0.867, blue: 0.702, alpha: 1.0)
UIColor(red: 0, green: 0.84, blue: 0.44, alpha: 1.0)
}

/// Level 400 variant of Link brand color.
///
/// Use for separator bars over the Link brand color.
static var linkBrand400: UIColor {
LinkUI.useNewBrand ? UIColor(red: 0.0, green: 0.64, blue: 0.33, alpha: 1.0) : UIColor(red: 0.102, green: 0.773, blue: 0.608, alpha: 1.0)
UIColor(red: 0.0, green: 0.64, blue: 0.33, alpha: 1.0)
}

/// Color of the Link logo in the navigation bar.
Expand All @@ -36,7 +36,7 @@ extension UIColor {

/// Foreground color of the primary button.
static var linkPrimaryButtonForeground: UIColor {
LinkUI.useNewBrand ? UIColor(red: 0, green: 0.12, blue: 0.06, alpha: 1.0) : UIColor(red: 0.012, green: 0.141, blue: 0.149, alpha: 1.0)
UIColor(red: 0, green: 0.12, blue: 0.06, alpha: 1.0)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ enum LinkUI {
static let smallContentSpacing: CGFloat = 8

static let tinyContentSpacing: CGFloat = 4

/// Enable 2024 brand
/// Delete this after rollout. (~May 2024)
@_spi(STP) public static var useNewBrand = false
}

// MARK: Development flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ import UIKit
final class LinkMoreInfoView: UIView {
struct Constants {
static var logoWidth: CGFloat {
LinkUI.useNewBrand ? 42 : 31
42
}
static let logoHeight: CGFloat = 14
}
private lazy var logoView: UIImageView = {
let imageView: UIImageView
if LinkUI.useNewBrand {
imageView = DynamicImageView(dynamicImage: Image.link_logo_knockout.makeImage(template: false), pairedColor: theme.colors.background)
} else {
imageView = UIImageView(image: Image.link_logo_deprecated.makeImage(template: true))
imageView.tintColor = theme.colors.secondaryText
}
imageView = DynamicImageView(dynamicImage: Image.link_logo_knockout.makeImage(template: false), pairedColor: theme.colors.background)
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.contentMode = .scaleAspectFit
imageView.isAccessibilityElement = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import UIKit
@_spi(LinkOnly) public var paymentOption: PaymentOptionDisplayData? {
if paymentMethodId == nil { return nil }

return PaymentOptionDisplayData(image: (LinkUI.useNewBrand ? Image.link_logo : Image.pm_type_link_deprecated).makeImage(), label: STPPaymentMethodType.link.displayName)
return PaymentOptionDisplayData(image: Image.link_logo.makeImage(), label: STPPaymentMethodType.link.displayName)
}

/// The parent view controller to present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension PaymentOption {
case .new(let confirmParams):
return confirmParams.makeIcon(updateImageHandler: updateImageHandler)
case .link:
return (LinkUI.useNewBrand ? Image.link_logo : Image.pm_type_link_deprecated).makeImage()
return Image.link_logo.makeImage()
case .external(let paymentMethod, _):
return PaymentSheet.PaymentMethodType.external(paymentMethod).makeImage(
forDarkBackground: traitCollection?.isDarkMode ?? false,
Expand All @@ -46,7 +46,7 @@ extension PaymentOption {
assertionFailure("This shouldn't be called - we don't show new PMs in the saved PM collection view")
return UIImage()
case .link:
return (LinkUI.useNewBrand ? Image.link_logo : Image.carousel_link_deprecated).makeImage(template: false)
return Image.link_logo.makeImage()
case .external:
assertionFailure("This shouldn't be called - we don't show EPMs in the saved PM collection view")
return UIImage()
Expand Down Expand Up @@ -91,7 +91,7 @@ extension STPPaymentMethod {
case .SEPADebit:
return Image.carousel_sepa.makeImage().withRenderingMode(.alwaysOriginal)
case .link:
return (LinkUI.useNewBrand ? Image.link_logo : Image.pm_type_link_deprecated).makeImage().withRenderingMode(.alwaysOriginal)
return Image.link_logo.makeImage().withRenderingMode(.alwaysOriginal)
default:
assertionFailure("\(type) not supported for saved PMs")
return makeIcon()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ final class PaymentSheetLoader {
&& configuration.applePay != nil
&& intent.isApplePayEnabled

// If Link is enabled, set the `useNewBrand`
// Should default to true in case we remove the server-side flag someday
LinkUI.useNewBrand = intent.elementsSession.linkSettings?.useRebrand ?? true

// Send load finished analytic
// This is hacky; the logic to determine the default selected payment method belongs to the SavedPaymentOptionsViewController. We invoke it here just to report it to analytics before that VC loads.
let (defaultSelectedIndex, paymentOptionsViewModels) = SavedPaymentOptionsViewController.makeViewModels(
Expand Down
Loading

0 comments on commit ba4f30c

Please sign in to comment.