Skip to content

Commit

Permalink
try to fix stutter
Browse files Browse the repository at this point in the history
  • Loading branch information
virginiacook committed Dec 11, 2023
1 parent 0211df7 commit 964c963
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ public class PaymentSheet {
}

public func presentError(_ error: Error) {
// VBC TODO
let psvc = self.findPaymentSheetViewController()
psvc?.presentError(error)
}

/// Deletes all persisted authentication state associated with a customer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class PaymentSheetViewController: UIViewController {
private(set) var error: Error?
private var isPaymentInFlight: Bool = false
private(set) var isDismissable: Bool = true
private var isConfirming: Bool = false

// MARK: - Views

Expand Down Expand Up @@ -449,16 +450,18 @@ class PaymentSheetViewController: UIViewController {
pay(with: paymentOption)
}

func presentError() {
// VBC TODO: error handling from external sources
func presentError(_ error: Error) {
isConfirming = false
}

func pay(with paymentOption: PaymentOption) {
view.endEditing(true)
isPaymentInFlight = true
// Clear any errors
error = nil
updateUI()
if !isConfirming {
updateUI()
}
if isConfirmed {
// Confirm the payment with the payment option
let startTime = NSDate.timeIntervalSinceReferenceDate
Expand Down Expand Up @@ -515,8 +518,10 @@ class PaymentSheetViewController: UIViewController {
}
}
}
isConfirming = false
} else {
self.paymentOption = paymentOption
isConfirming = true
delegate?.paymentSheetViewControllerDidTapBuy(self)
}
}
Expand Down

0 comments on commit 964c963

Please sign in to comment.