-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NT-262] Remember this card UI #848
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good...
Had couple comments and noticed that Dynamic Type isn't supported ... I remember us chatting about it offline. One suggestion that maybe we should consider ... I've been working on ToggleViewController
that would be easily reused here + it supports Dynamic Type.
@@ -22,6 +22,10 @@ internal final class AddNewCardViewController: UIViewController, | |||
@IBOutlet private var creditCardTextField: STPPaymentCardTextField! | |||
@IBOutlet private var creditCardValidationErrorLabel: UILabel! | |||
@IBOutlet private var creditCardValidationErrorContainer: UIView! | |||
@IBOutlet private var reusableCardStackViewContainer: UIView! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooooh, good old storyboard thingys πΏ
|> \.alignment .~ .center | ||
|
||
_ = self.reusableCardSwitch | ||
|> baseSwitchControlStyle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would only have 1 accessible element (the toggle - whose focus area would be the whole cell) but because we're faking a table view cell here we don't get that functionality...so because of that I think we should also add VoiceOver label on the switch that will simply duplicate the label but since it's a UISwitch
it will also use double tap to toggle
hint by default.
|> baseSwitchControlStyle | |
|> baseSwitchControlStyle | |
|> \.accessibilityLabel %~ { _ in Strings.Remember_this_card() } |
(not sure if this will pass SwiftFormat)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that there seems to be an issue with UISwitch
and right alignment..I've ran into it in my PR - #850
Basically even if you align right edges the switch still overlaps a little. Checked this out in view inspector.
Basically what helped was to align left edge of the switch to the right edge of superview minus the switch width.
} | ||
|
||
override func bindViewModel() { | ||
super.bindViewModel() | ||
|
||
self.reusableCardStackViewContainer.rac.hidden = self.viewModel.outputs.reusableCardSwitchIsHidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we order this alphabetically (so before the saveButtonIsEnabled
signal)?
Library/AddNewCardIntent.swift
Outdated
import Foundation | ||
|
||
public enum AddNewCardIntent: Equatable { | ||
case pledgeView |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need the View
suffix? Simply just pledge
π€
@@ -36,6 +37,7 @@ public protocol AddNewCardViewModelOutputs { | |||
var dismissKeyboard: Signal<Void, Never> { get } | |||
var paymentDetails: Signal<PaymentDetails, Never> { get } | |||
var paymentDetailsBecomeFirstResponder: Signal<Void, Never> { get } | |||
var reusableCardSwitchIsHidden: Signal<Bool, Never> { get } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this name not match reusableCardStackViewContainer
intentionally for it being too long?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job on this! Left minor comments on alphabetizing, this PR meets all required ACs, you can merge after taking @dusi's suggestions :) π³π³π³
@@ -22,6 +22,10 @@ internal final class AddNewCardViewController: UIViewController, | |||
@IBOutlet private var creditCardTextField: STPPaymentCardTextField! | |||
@IBOutlet private var creditCardValidationErrorLabel: UILabel! | |||
@IBOutlet private var creditCardValidationErrorContainer: UIView! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetize
@@ -23,7 +23,7 @@ internal final class PaymentMethodsViewModelTests: TestCase { | |||
|
|||
self.vm.outputs.editButtonIsEnabled.observe(self.editButtonIsEnabled.observer) | |||
self.vm.outputs.editButtonTitle.observe(self.editButtonTitle.observer) | |||
self.vm.outputs.goToAddCardScreen.observe(self.goToAddCardScreen.observer) | |||
self.vm.outputs.goToAddCardScreenWithIntent.observe(self.goToAddCardScreenWithIntent.observer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetize
π² What
Adds a Remember this card switch to
AddNewCardViewController
when being presented fromPledgeViewController
.Note: VM binding and GraphQL requests will be added in upcoming PR.
π€ Why
This allows the user to indicate that a card used during checkout should be stored for future backings.
π How
AddNewCardIntent
.π See
βΏοΈ Accessibility
β Acceptance criteria
AddNewCardViewController
is presented fromPledgeViewController
.AddNewCardViewController
is presented from Settings.β° TODO