Fix: import ticket UI should not change to prompt for import again shortly after importing paid link

pull/362/head
Hwee-Boon Yar 7 years ago
parent c3afd9bc9e
commit 839fdbfc41
  1. 3
      Trust/Market/Coordinators/UniversalLinkCoordinator.swift
  2. 9
      Trust/Market/ViewModels/ImportTicketViewControllerViewModel.swift

@ -18,6 +18,7 @@ class UniversalLinkCoordinator: Coordinator {
var importTicketViewController: ImportTicketViewController?
var ethPrice: Subscribable<Double>?
var ethBalance: Subscribable<BigInt>?
var hasCompleted = false
func start()
{
@ -246,6 +247,7 @@ class UniversalLinkCoordinator: Coordinator {
}
private func updateImportTicketController(with state: ImportTicketViewControllerViewModel.State, ticketHolder: TicketHolder? = nil, ethCost: String? = nil, dollarCost: String? = nil) {
guard !hasCompleted else { return }
if let vc = importTicketViewController, var viewModel = vc.viewModel {
viewModel.state = state
if let ticketHolder = ticketHolder {
@ -259,6 +261,7 @@ class UniversalLinkCoordinator: Coordinator {
}
vc.configure(viewModel: viewModel)
}
hasCompleted = state.hasCompleted
}
private func promptImportUniversalLink(ticketHolder: TicketHolder, ethCost: String, dollarCost: String? = nil) {

@ -9,6 +9,15 @@ struct ImportTicketViewControllerViewModel {
case processing
case succeeded
case failed(errorMessage: String)
var hasCompleted: Bool {
switch self {
case .succeeded, .failed:
return true
case .validating, .processing, .promptImport:
return false
}
}
}
var state: State
var ticketHolder: TicketHolder?

Loading…
Cancel
Save