|
|
@ -11,6 +11,7 @@ protocol UniversalLinkCoordinatorDelegate: class { |
|
|
|
func viewControllerForPresenting(in coordinator: UniversalLinkCoordinator) -> UIViewController? |
|
|
|
func viewControllerForPresenting(in coordinator: UniversalLinkCoordinator) -> UIViewController? |
|
|
|
func completed(in coordinator: UniversalLinkCoordinator) |
|
|
|
func completed(in coordinator: UniversalLinkCoordinator) |
|
|
|
func importPaidSignedOrder(signedOrder: SignedOrder, tokenObject: TokenObject, completion: @escaping (Bool) -> Void) |
|
|
|
func importPaidSignedOrder(signedOrder: SignedOrder, tokenObject: TokenObject, completion: @escaping (Bool) -> Void) |
|
|
|
|
|
|
|
func didImported(contract: String, in coordinator: UniversalLinkCoordinator) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class UniversalLinkCoordinator: Coordinator { |
|
|
|
class UniversalLinkCoordinator: Coordinator { |
|
|
@ -319,6 +320,7 @@ class UniversalLinkCoordinator: Coordinator { |
|
|
|
if self.importTicketViewController != nil { |
|
|
|
if self.importTicketViewController != nil { |
|
|
|
if let vc = self.importTicketViewController, var _ = vc.viewModel { |
|
|
|
if let vc = self.importTicketViewController, var _ = vc.viewModel { |
|
|
|
if successful { |
|
|
|
if successful { |
|
|
|
|
|
|
|
self.delegate?.didImported(contract: signedOrder.order.contractAddress, in: self) |
|
|
|
self.showImportSuccessful() |
|
|
|
self.showImportSuccessful() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//TODO Pass in error message |
|
|
|
//TODO Pass in error message |
|
|
@ -344,6 +346,9 @@ class UniversalLinkCoordinator: Coordinator { |
|
|
|
if let response = result.response { |
|
|
|
if let response = result.response { |
|
|
|
if response.statusCode < 300 { |
|
|
|
if response.statusCode < 300 { |
|
|
|
successful = true |
|
|
|
successful = true |
|
|
|
|
|
|
|
if let contract = parameters["contractAddress"] as? String { |
|
|
|
|
|
|
|
self.delegate?.didImported(contract: contract, in: self) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -382,6 +387,10 @@ extension UniversalLinkCoordinator: ImportTicketViewControllerDelegate { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func didPressImport(in viewController: ImportTicketViewController) { |
|
|
|
func didPressImport(in viewController: ImportTicketViewController) { |
|
|
|
|
|
|
|
if let signedOrder = viewController.signedOrder, let tokenObj = viewController.tokenObject { |
|
|
|
|
|
|
|
self.delegate?.didImported(contract: signedOrder.order.contractAddress, in: self) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if let query = viewController.query, let parameters = viewController.parameters { |
|
|
|
if let query = viewController.query, let parameters = viewController.parameters { |
|
|
|
importUniversalLink(query: query, parameters: parameters) |
|
|
|
importUniversalLink(query: query, parameters: parameters) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|