Skip to content

Commit

Permalink
update snapshot merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceqin-stripe committed Dec 23, 2024
2 parents ad6c10e + e58c201 commit 67891b7
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,36 +86,56 @@ final class UpdatePaymentMethodViewController: UIViewController {

private lazy var removeButton: UIButton = {
let button = UIButton(type: .custom)
let font = viewModel.appearance.primaryButton.font ?? viewModel.appearance.scaledFont(for: viewModel.appearance.font.base.medium, style: .callout, maximumPointSize: 25)
if #available(iOS 15.0, *) {
var configuration = UIButton.Configuration.bordered()
configuration.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 16, bottom: 10, trailing: 16)
configuration.baseBackgroundColor = .clear
configuration.background.cornerRadius = viewModel.appearance.cornerRadius
configuration.background.strokeWidth = viewModel.appearance.selectedBorderWidth ?? viewModel.appearance.borderWidth * 1.5
configuration.background.strokeColor = viewModel.appearance.colors.danger
configuration.titleAlignment = .center
configuration.attributedTitle = AttributedString(.Localized.remove, attributes: AttributeContainer([.font: font, .foregroundColor: viewModel.appearance.colors.danger]))
button.configuration = configuration
} else {
button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 16, bottom: 10, right: 16)
button.setTitleColor(viewModel.appearance.colors.danger, for: .normal)
button.setTitleColor(viewModel.appearance.colors.danger.disabledColor, for: .highlighted)
button.layer.borderColor = viewModel.appearance.colors.danger.cgColor
button.layer.borderWidth = viewModel.appearance.selectedBorderWidth ?? viewModel.appearance.borderWidth * 1.5
button.layer.cornerRadius = viewModel.appearance.cornerRadius
button.setTitle(.Localized.remove, for: .normal)
button.titleLabel?.textAlignment = .center
button.titleLabel?.font = font
button.titleLabel?.adjustsFontForContentSizeCategory = true
}
button.setTitleColor(viewModel.appearance.colors.danger, for: .normal)
button.setTitleColor(viewModel.appearance.colors.danger.disabledColor, for: .highlighted)
button.addTarget(self, action: #selector(buttonTouchDown(_:)), for: .touchDown)
button.addTarget(self, action: #selector(buttonTouchUp(_:)), for: [.touchUpInside, .touchUpOutside])
button.layer.borderColor = viewModel.appearance.colors.danger.cgColor
button.layer.borderWidth = viewModel.appearance.primaryButton.borderWidth
button.layer.cornerRadius = viewModel.appearance.cornerRadius
button.setTitle(.Localized.remove, for: .normal)
button.titleLabel?.textAlignment = .center
button.titleLabel?.font = viewModel.appearance.scaledFont(for: viewModel.appearance.font.base.medium, style: .callout, maximumPointSize: 25)
button.titleLabel?.adjustsFontForContentSizeCategory = true
button.addTarget(self, action: #selector(removePaymentMethod), for: .touchUpInside)
button.isHidden = !viewModel.canRemove
return button
}()

@objc private func buttonTouchDown(_ button: UIButton) {
button.layer.borderColor = viewModel.appearance.colors.danger.disabledColor.cgColor
if #available(iOS 15.0, *) {
button.configuration?.attributedTitle?.foregroundColor = viewModel.appearance.colors.danger.disabledColor
button.configuration?.background.strokeColor = viewModel.appearance.colors.danger.disabledColor
}
else {
button.setTitleColor(viewModel.appearance.colors.danger.disabledColor, for: .normal)
button.layer.borderColor = viewModel.appearance.colors.danger.disabledColor.cgColor
}
}

@objc private func buttonTouchUp(_ button: UIButton) {
button.layer.borderColor = viewModel.appearance.colors.danger.cgColor
if #available(iOS 15.0, *) {
button.configuration?.attributedTitle?.foregroundColor = viewModel.appearance.colors.danger
button.configuration?.background.strokeColor = viewModel.appearance.colors.danger
}
else {
button.setTitleColor(viewModel.appearance.colors.danger, for: .normal)
button.layer.borderColor = viewModel.appearance.colors.danger.cgColor
}
}

private lazy var paymentMethodForm: UIView = {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 67891b7

Please sign in to comment.