Merge pull request #199 from James-Sangalli/allow-yesterday-time-for-sell-expiry-time-more-user-friendly

In sell flow, allow user to set expiry time to earlier time
pull/200/head
James Sangalli 7 years ago committed by GitHub
commit 3ff47c8eaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Trust/Localization/en.lproj/Localizable.strings
  2. 16
      Trust/Sell/ViewControllers/SetSellTicketsExpiryDateViewController.swift

@ -204,6 +204,7 @@
"a.wallet.ticketToken.sell.noteLabel.title" = "Before the link expires, anyone with the MagicLink can purchase your tickets with one click";
"a.wallet.ticketToken.sell.linkExpiryDate.title" = "LINK EXPIRY DATE";
"a.wallet.ticketToken.sell.linkExpiryTime.title" = "LINK EXPIRY TIME";
"a.wallet.ticketToken.sell.linkExpiryTime.atLeastNow.title" = "Please select a date in the future";
"a.wallet.ticketToken.sell.totalCost.title" = "Total Cost:";
"a.wallet.ticketToken.sell.confirm.title" = "Confirm Sale?";
"a.wallet.ticketToken.sell.confirm.subtitle" = "Generate Sale Link";

@ -126,7 +126,7 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
datePicker.isHidden = true
timePicker.datePickerMode = .time
timePicker.minimumDate = Date()
timePicker.minimumDate = Date.yesterday
timePicker.addTarget(self, action: #selector(timePickerValueChanged), for: .valueChanged)
timePicker.isHidden = true
@ -229,8 +229,18 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
fatalError("init(coder:) has not been implemented")
}
@objc
func nextButtonTapped() {
@objc func nextButtonTapped() {
let expiryDate = linkExpiryDate()
guard expiryDate > Date() else {
UIAlertController.alert(title: "",
message: R.string.localizable.aWalletTicketTokenSellLinkExpiryTimeAtLeastNowTitle(),
alertButtonTitles: [R.string.localizable.oK()],
alertButtonStyles: [.cancel],
viewController: self,
completion: nil)
return
}
//TODO be good if we check if date chosen is not too far into the future. Example 1 year ahead. Common error?
delegate?.didSetSellTicketsExpiryDate(ticketHolder: ticketHolder, linkExpiryDate: linkExpiryDate(), ethCost: ethCost, dollarCost: dollarCost, in: self)
}

Loading…
Cancel
Save