-
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
Stripe element add new card #473
Merged
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
18ec495
New card screen ui (#471)
cdolm92 4954afc
new stppaymentcardtextfield showing
cdolm92 2725bcc
wip - placeholder colors
cdolm92 550e5a8
Merge remote-tracking branch 'oss/master' into stripe-element-addNewCard
cdolm92 1cdbc41
snapshot tests
cdolm92 e3cd226
Email undeliverable/unverified (#478)
ifbarrera 4b75b2f
pr feedback
cdolm92 96b3c16
Merge remote-tracking branch 'oss/master' into stripe-element-addNewCard
cdolm92 1be1f8f
new snapshots
cdolm92 7971fd6
new placeholder colors
cdolm92 34da51a
new snapshots
cdolm92 588c4c5
Merge remote-tracking branch 'oss/feature-payment-methods' into strip…
cdolm92 918d530
fixed duplicate IDs in Storyboard
cdolm92 0817e30
Merge branch 'stripe-element-addNewCard' of https://github.com/kickst…
cdolm92 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
Kickstarter-iOS/Views/Controllers/AddNewCardViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import KsApi | ||
import Library | ||
import Prelude | ||
import ReactiveSwift | ||
import Stripe | ||
import UIKit | ||
|
||
internal final class AddNewCardViewController: UIViewController, STPPaymentCardTextFieldDelegate { | ||
|
||
private weak var saveButtonView: LoadingBarButtonItemView! | ||
@IBOutlet private weak var cardholderNameLabel: UILabel! | ||
@IBOutlet private weak var cardholderNameTextField: UITextField! | ||
@IBOutlet private weak var paymentField: STPPaymentCardTextField! | ||
|
||
internal static func instantiate() -> AddNewCardViewController { | ||
return Storyboard.Settings.instantiate(AddNewCardViewController.self) | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
let cancelButton = UIBarButtonItem(title: Strings.Cancel(), | ||
style: .plain, | ||
target: self, | ||
action: #selector(cancelButtonTapped)) | ||
cancelButton.tintColor = .ksr_green_700 | ||
self.navigationItem.leftBarButtonItem = cancelButton | ||
|
||
self.saveButtonView = LoadingBarButtonItemView.instantiate() | ||
self.saveButtonView.setTitle(title: Strings.Save()) | ||
self.saveButtonView.addTarget(self, action: #selector(saveButtonTapped)) | ||
let navigationBarButton = UIBarButtonItem(customView: self.saveButtonView) | ||
self.navigationItem.setRightBarButton(navigationBarButton, animated: false) | ||
|
||
self.paymentField.delegate = self | ||
} | ||
|
||
override func bindStyles() { | ||
super.bindStyles() | ||
|
||
_ = self | ||
|> settingsViewControllerStyle | ||
|
||
_ = self.cardholderNameLabel | ||
|> \.text %~ { _ in Strings.Cardholder_name() } | ||
|> \.textColor .~ .ksr_text_dark_grey_900 | ||
|
||
_ = self.cardholderNameTextField | ||
|> formFieldStyle | ||
|> \.textAlignment .~ .right | ||
|> \.attributedPlaceholder .~ | ||
NSAttributedString(string: Strings.Name(), | ||
attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) | ||
|
||
_ = self.paymentField | ||
|> \.borderColor .~ nil | ||
|> \.font .~ .ksr_body() | ||
|> \.cursorColor .~ .ksr_green_700 | ||
|> \.textColor .~ .ksr_text_dark_grey_500 | ||
} | ||
|
||
@objc fileprivate func cancelButtonTapped() { | ||
self.dismiss(animated: true, completion: nil) | ||
} | ||
|
||
@objc fileprivate func saveButtonTapped() { | ||
self.dismiss(animated: true, completion: nil) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Kickstarter-iOS/Views/Controllers/AddNewCardViewControllerTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Prelude | ||
@testable import Kickstarter_Framework | ||
@testable import KsApi | ||
@testable import Library | ||
|
||
final class AddNewCardViewControllerTests: TestCase { | ||
override func setUp() { | ||
super.setUp() | ||
AppEnvironment.pushEnvironment(mainBundle: Bundle.framework) | ||
UIView.setAnimationsEnabled(false) | ||
} | ||
|
||
func testAddNewCard() { | ||
combos(Language.allLanguages, Device.allCases).forEach { language, device in | ||
withEnvironment(language: language) { | ||
let controller = AddNewCardViewController.instantiate() | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller) | ||
|
||
FBSnapshotVerifyView(parent.view, identifier: "lang_\(language)_device_\(device)") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we use
settingsTitleLabelStyle
so it's consistent with our other form fields in Settings?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.
going to use
settingsSectionLabelStyle
because we want the text color to be.ksr_text_dark_grey_900