Merge pull request #434 from James-Sangalli/show-contract-address-with-webpage-in-erc875-tabs

Show lock button that links to etherscan page for ticket contract in ticket redeem/sell/transfer flows
pull/435/head
James Sangalli 6 years ago committed by GitHub
commit 90d322add5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      AlphaWallet/InCoordinator.swift
  2. 12
      AlphaWallet/Redeem/ViewControllers/RedeemTicketsQuantitySelectionViewController.swift
  3. 12
      AlphaWallet/Redeem/ViewControllers/RedeemTicketsViewController.swift
  4. 12
      AlphaWallet/Redeem/ViewControllers/TicketRedemptionViewController.swift
  5. 12
      AlphaWallet/Sell/ViewControllers/EnterSellTicketsPriceQuantityViewController.swift
  6. 12
      AlphaWallet/Sell/ViewControllers/SellTicketsViewController.swift
  7. 12
      AlphaWallet/Sell/ViewControllers/SetSellTicketsExpiryDateViewController.swift
  8. 5
      AlphaWallet/Settings/Types/Constants.swift
  9. 13
      AlphaWallet/Settings/Types/RPCServers.swift
  10. 12
      AlphaWallet/Tokens/ViewControllers/TicketsViewController.swift
  11. 45
      AlphaWallet/Transactions/Coordinators/TicketsCoordinator.swift
  12. 12
      AlphaWallet/Transfer/ViewControllers/ChooseTicketTransferModeViewController.swift
  13. 12
      AlphaWallet/Transfer/ViewControllers/SetTransferTicketsExpiryDateViewController.swift
  14. 12
      AlphaWallet/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift
  15. 13
      AlphaWallet/Transfer/ViewControllers/TransferTicketsViaWalletAddressViewController.swift
  16. 12
      AlphaWallet/Transfer/ViewControllers/TransferTicketsViewController.swift

@ -414,6 +414,11 @@ extension InCoordinator: TicketsCoordinatorDelegate {
viewController.navigationController?.pushViewController(controller, animated: true)
}
func didPressViewContractWebPage(for token: TokenObject, in viewController: UIViewController) {
let url = config.server.etherscanContractDetailsWebPageURL(for: token.contract)
viewController.openURL(url)
}
func didPressViewEthereumInfo(in viewController: UIViewController) {
let controller = WhatIsEthereumInfoViewController()
viewController.navigationController?.pushViewController(controller, animated: true)

@ -11,6 +11,7 @@ import UIKit
protocol RedeemTicketsQuantitySelectionViewControllerDelegate: class {
func didSelectQuantity(token: TokenObject, ticketHolder: TicketHolder, in viewController: RedeemTicketsQuantitySelectionViewController)
func didPressViewInfo(in viewController: RedeemTicketsQuantitySelectionViewController)
func didPressViewContractWebPage(in viewController: RedeemTicketsQuantitySelectionViewController)
}
class RedeemTicketsQuantitySelectionViewController: UIViewController {
@ -27,7 +28,10 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -113,11 +117,15 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
func configure(viewModel: RedeemTicketsQuantitySelectionViewModel) {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -11,6 +11,7 @@ import UIKit
protocol RedeemTicketsViewControllerDelegate: class {
func didSelectTicketHolder(token: TokenObject, ticketHolder: TicketHolder, in viewController: RedeemTicketsViewController)
func didPressViewInfo(in viewController: RedeemTicketsViewController)
func didPressViewContractWebPage(in viewController: RedeemTicketsViewController)
}
class RedeemTicketsViewController: UIViewController {
@ -25,7 +26,10 @@ class RedeemTicketsViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
view.backgroundColor = Colors.appBackground
@ -81,7 +85,7 @@ class RedeemTicketsViewController: UIViewController {
tableView.dataSource = self
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
header.configure(title: viewModel.title)
@ -111,6 +115,10 @@ class RedeemTicketsViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
private func animateRowHeightChanges(for indexPaths: [IndexPath], in tableview: UITableView) {
tableView.reloadData()
}

@ -23,7 +23,10 @@ class TicketRedemptionViewController: UIViewController {
self.session = session
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
titleLabel.translatesAutoresizingMaskIntoConstraints = false
@ -110,6 +113,11 @@ class TicketRedemptionViewController: UIViewController {
navigationController?.pushViewController(controller, animated: true)
}
@objc func showContractWebPage() {
let url = Config().server.etherscanContractDetailsWebPageURL(for: viewModel.token.contract)
openURL(url)
}
private func showSuccessMessage() {
invalidateTimer()
@ -135,7 +143,7 @@ class TicketRedemptionViewController: UIViewController {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -5,6 +5,7 @@ import UIKit
protocol EnterSellTicketsPriceQuantityViewControllerDelegate: class {
func didEnterSellTicketsPriceQuantity(token: TokenObject, ticketHolder: TicketHolder, ethCost: String, in viewController: EnterSellTicketsPriceQuantityViewController)
func didPressViewInfo(in viewController: EnterSellTicketsPriceQuantityViewController)
func didPressViewContractWebPage(in viewController: EnterSellTicketsPriceQuantityViewController)
}
class EnterSellTicketsPriceQuantityViewController: UIViewController {
@ -51,7 +52,10 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController {
self.ethPrice = ethPrice
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -242,11 +246,15 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
func configure(viewModel: EnterSellTicketsPriceQuantityViewControllerViewModel) {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -5,6 +5,7 @@ import UIKit
protocol SellTicketsViewControllerDelegate: class {
func didSelectTicketHolder(ticketHolder: TicketHolder, in viewController: SellTicketsViewController)
func didPressViewInfo(in viewController: SellTicketsViewController)
func didPressViewContractWebPage(in viewController: SellTicketsViewController)
}
class SellTicketsViewController: UIViewController {
@ -21,7 +22,10 @@ class SellTicketsViewController: UIViewController {
self.paymentFlow = paymentFlow
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
view.backgroundColor = Colors.appBackground
@ -77,7 +81,7 @@ class SellTicketsViewController: UIViewController {
tableView.dataSource = self
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
header.configure(title: viewModel.title)
@ -107,6 +111,10 @@ class SellTicketsViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
private func animateRowHeightChanges(for indexPaths: [IndexPath], in tableview: UITableView) {
tableView.reloadData()
}

@ -5,6 +5,7 @@ import UIKit
protocol SetSellTicketsExpiryDateViewControllerDelegate: class {
func didSetSellTicketsExpiryDate(ticketHolder: TicketHolder, linkExpiryDate: Date, ethCost: String, in viewController: SetSellTicketsExpiryDateViewController)
func didPressViewInfo(in viewController: SetSellTicketsExpiryDateViewController)
func didPressViewContractWebPage(in viewController: SetSellTicketsExpiryDateViewController)
}
class SetSellTicketsExpiryDateViewController: UIViewController {
@ -41,7 +42,10 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
self.ethCost = ethCost
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -231,11 +235,15 @@ class SetSellTicketsExpiryDateViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
func configure(viewModel: SetSellTicketsExpiryDateViewControllerViewModel) {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -39,6 +39,11 @@ public struct Constants {
public static let mainnetEtherscanAPI = "https://api.etherscan.io/api?module=account&action=txlist&address="
public static let ropstenEtherscanAPI = "https://ropsten.etherscan.io/api?module=account&action=txlist&address="
public static let rinkebyEtherscanAPI = "https://rinkeby.etherscan.io/api?module=account&action=txlist&address="
//etherscan contract details web page
public static let mainnetEtherscanContractDetailsWebPageURL = "https://etherscan.io/address/"
public static let ropstenEtherscanContractDetailsWebPageURL = "https://ropsten.etherscan.io/address/"
public static let rinkebyEtherscanContractDetailsWebPageURL = "https://rinkeby.etherscan.io/address/"
}
public struct UnitConfiguration {

@ -57,10 +57,23 @@ enum RPCServer {
}
}
var etherscanContractDetailsWebPageURL: String {
switch self {
case .main: return Constants.mainnetEtherscanContractDetailsWebPageURL
case .ropsten: return Constants.ropstenEtherscanContractDetailsWebPageURL
case .rinkeby: return Constants.rinkebyEtherscanContractDetailsWebPageURL
case .kovan, .poa, .sokol, .classic, .callisto, .custom: return Constants.mainnetEtherscanContractDetailsWebPageURL
}
}
func etherscanAPIURLForTransactionList(for address: String) -> URL {
return URL(string: getEtherscanURL + address)!
}
func etherscanContractDetailsWebPageURL(for address: String) -> URL {
return URL(string: etherscanContractDetailsWebPageURL + address)!
}
var displayName: String {
if isTestNetwork {
return "\(name) (\(R.string.localizable.settingsNetworkTestLabelTitle()))"

@ -17,6 +17,7 @@ protocol TicketsViewControllerDelegate: class {
func didPressTransfer(for type: PaymentFlow, ticketHolders: [TicketHolder], in viewController: TicketsViewController)
func didCancel(in viewController: TicketsViewController)
func didPressViewRedemptionInfo(in viewController: TicketsViewController)
func didPressViewContractWebPage(in viewController: TicketsViewController)
}
class TicketsViewController: UIViewController {
@ -39,7 +40,10 @@ class TicketsViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
view.backgroundColor = Colors.appBackground
@ -122,7 +126,7 @@ class TicketsViewController: UIViewController {
tableView.dataSource = self
if let tokenObject = tokenObject, tokenObject.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
if let tokenObject = tokenObject {
@ -173,6 +177,10 @@ class TicketsViewController: UIViewController {
delegate?.didPressViewRedemptionInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
private func animateRowHeightChanges(for indexPaths: [IndexPath], in tableview: UITableView) {
tableView.reloadData()
}

@ -23,6 +23,7 @@ protocol TicketsCoordinatorDelegate: class {
func didCancel(in coordinator: TicketsCoordinator)
func didPressViewRedemptionInfo(in: UIViewController)
func didPressViewEthereumInfo(in: UIViewController)
func didPressViewContractWebPage(for token: TokenObject, in viewController: UIViewController)
}
class TicketsCoordinator: NSObject, Coordinator {
@ -373,6 +374,10 @@ extension TicketsCoordinator: TicketsViewControllerDelegate {
func didPressViewRedemptionInfo(in viewController: TicketsViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: TicketsViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: RedeemTicketsViewControllerDelegate {
@ -383,6 +388,10 @@ extension TicketsCoordinator: RedeemTicketsViewControllerDelegate {
func didPressViewInfo(in viewController: RedeemTicketsViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: RedeemTicketsViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: RedeemTicketsQuantitySelectionViewControllerDelegate {
@ -393,6 +402,10 @@ extension TicketsCoordinator: RedeemTicketsQuantitySelectionViewControllerDelega
func didPressViewInfo(in viewController: RedeemTicketsQuantitySelectionViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: RedeemTicketsQuantitySelectionViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: SellTicketsViewControllerDelegate {
@ -403,6 +416,10 @@ extension TicketsCoordinator: SellTicketsViewControllerDelegate {
func didPressViewInfo(in viewController: SellTicketsViewController) {
delegate?.didPressViewEthereumInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: SellTicketsViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: TransferTicketsQuantitySelectionViewControllerDelegate {
@ -413,6 +430,10 @@ extension TicketsCoordinator: TransferTicketsQuantitySelectionViewControllerDele
func didPressViewInfo(in viewController: TransferTicketsQuantitySelectionViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: TransferTicketsQuantitySelectionViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: EnterSellTicketsPriceQuantityViewControllerDelegate {
@ -423,6 +444,10 @@ extension TicketsCoordinator: EnterSellTicketsPriceQuantityViewControllerDelegat
func didPressViewInfo(in viewController: EnterSellTicketsPriceQuantityViewController) {
delegate?.didPressViewEthereumInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: EnterSellTicketsPriceQuantityViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: SetSellTicketsExpiryDateViewControllerDelegate {
@ -433,6 +458,10 @@ extension TicketsCoordinator: SetSellTicketsExpiryDateViewControllerDelegate {
func didPressViewInfo(in viewController: SetSellTicketsExpiryDateViewController) {
delegate?.didPressViewEthereumInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: SetSellTicketsExpiryDateViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: TransferTicketsViewControllerDelegate {
@ -443,6 +472,10 @@ extension TicketsCoordinator: TransferTicketsViewControllerDelegate {
func didPressViewInfo(in viewController: TransferTicketsViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: TransferTicketsViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: TransferTicketsCoordinatorDelegate {
@ -488,6 +521,10 @@ extension TicketsCoordinator: ChooseTicketTransferModeViewControllerDelegate {
func didPressViewInfo(in viewController: ChooseTicketTransferModeViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: ChooseTicketTransferModeViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: SetTransferTicketsExpiryDateViewControllerDelegate {
@ -498,6 +535,10 @@ extension TicketsCoordinator: SetTransferTicketsExpiryDateViewControllerDelegate
func didPressViewInfo(in viewController: SetTransferTicketsExpiryDateViewController) {
delegate?.didPressViewRedemptionInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: SetTransferTicketsExpiryDateViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}
extension TicketsCoordinator: GenerateTransferMagicLinkViewControllerDelegate {
@ -534,4 +575,8 @@ extension TicketsCoordinator: TransferTicketsViaWalletAddressViewControllerDeleg
func didPressViewInfo(in viewController: TransferTicketsViaWalletAddressViewController) {
delegate?.didPressViewEthereumInfo(in: viewController)
}
func didPressViewContractWebPage(in viewController: TransferTicketsViaWalletAddressViewController) {
delegate?.didPressViewContractWebPage(for: viewController.viewModel.token, in: viewController)
}
}

@ -6,6 +6,7 @@ protocol ChooseTicketTransferModeViewControllerDelegate: class {
func didChooseTransferViaMagicLink(token: TokenObject, ticketHolder: TicketHolder, in viewController: ChooseTicketTransferModeViewController)
func didChooseTransferNow(token: TokenObject, ticketHolder: TicketHolder, in viewController: ChooseTicketTransferModeViewController)
func didPressViewInfo(in viewController: ChooseTicketTransferModeViewController)
func didPressViewContractWebPage(in viewController: ChooseTicketTransferModeViewController)
}
class ChooseTicketTransferModeViewController: UIViewController {
@ -26,7 +27,10 @@ class ChooseTicketTransferModeViewController: UIViewController {
self.paymentFlow = paymentFlow
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -107,11 +111,15 @@ class ChooseTicketTransferModeViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
func configure(viewModel: ChooseTicketTransferModeViewControllerViewModel) {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -5,6 +5,7 @@ import UIKit
protocol SetTransferTicketsExpiryDateViewControllerDelegate: class {
func didPressNext(ticketHolder: TicketHolder, linkExpiryDate: Date, in viewController: SetTransferTicketsExpiryDateViewController)
func didPressViewInfo(in viewController: SetTransferTicketsExpiryDateViewController)
func didPressViewContractWebPage(in viewController: SetTransferTicketsExpiryDateViewController)
}
class SetTransferTicketsExpiryDateViewController: UIViewController {
@ -34,7 +35,10 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
self.paymentFlow = paymentFlow
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -214,6 +218,10 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
linkExpiryDateField.layer.cornerRadius = linkExpiryDateField.frame.size.height / 2
@ -232,7 +240,7 @@ class SetTransferTicketsExpiryDateViewController: UIViewController {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -5,6 +5,7 @@ import UIKit
protocol TransferTicketsQuantitySelectionViewControllerDelegate: class {
func didSelectQuantity(token: TokenObject, ticketHolder: TicketHolder, in viewController: TransferTicketsQuantitySelectionViewController)
func didPressViewInfo(in viewController: TransferTicketsQuantitySelectionViewController)
func didPressViewContractWebPage(in viewController: TransferTicketsQuantitySelectionViewController)
}
class TransferTicketsQuantitySelectionViewController: UIViewController {
@ -23,7 +24,10 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
self.paymentFlow = paymentFlow
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -109,11 +113,15 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
func configure(viewModel: TransferTicketsQuantitySelectionViewModel) {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -6,6 +6,7 @@ import QRCodeReaderViewController
protocol TransferTicketsViaWalletAddressViewControllerDelegate: class {
func didEnterWalletAddress(ticketHolder: TicketHolder, to walletAddress: String, paymentFlow: PaymentFlow, in viewController: TransferTicketsViaWalletAddressViewController)
func didPressViewInfo(in viewController: TransferTicketsViaWalletAddressViewController)
func didPressViewContractWebPage(in viewController: TransferTicketsViaWalletAddressViewController)
}
class TransferTicketsViaWalletAddressViewController: UIViewController {
@ -25,7 +26,10 @@ class TransferTicketsViaWalletAddressViewController: UIViewController {
self.paymentFlow = paymentFlow
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
roundedBackground.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(roundedBackground)
@ -102,11 +106,16 @@ class TransferTicketsViaWalletAddressViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
let url = Config().server.etherscanContractDetailsWebPageURL(for: viewModel.token.contract)
openURL(url)
}
func configure(viewModel: TransferTicketsViaWalletAddressViewControllerViewModel) {
self.viewModel = viewModel
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
view.backgroundColor = viewModel.backgroundColor

@ -5,6 +5,7 @@ import UIKit
protocol TransferTicketsViewControllerDelegate: class {
func didSelectTicketHolder(token: TokenObject, ticketHolder: TicketHolder, in viewController: TransferTicketsViewController)
func didPressViewInfo(in viewController: TransferTicketsViewController)
func didPressViewContractWebPage(in viewController: TransferTicketsViewController)
}
class TransferTicketsViewController: UIViewController {
@ -21,7 +22,10 @@ class TransferTicketsViewController: UIViewController {
self.paymentFlow = paymentFlow
super.init(nibName: nil, bundle: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo))
navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: R.image.location(), style: .plain, target: self, action: #selector(showInfo)),
UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))
]
view.backgroundColor = Colors.appBackground
@ -77,7 +81,7 @@ class TransferTicketsViewController: UIViewController {
tableView.dataSource = self
if viewModel.token.contract != Constants.ticketContractAddress {
navigationItem.rightBarButtonItem = nil
navigationItem.rightBarButtonItems = [UIBarButtonItem(image: R.image.settings_lock(), style: .plain, target: self, action: #selector(showContractWebPage))]
}
header.configure(title: viewModel.title)
@ -107,6 +111,10 @@ class TransferTicketsViewController: UIViewController {
delegate?.didPressViewInfo(in: self)
}
@objc func showContractWebPage() {
delegate?.didPressViewContractWebPage(in: self)
}
private func animateRowHeightChanges(for indexPaths: [IndexPath], in tableview: UITableView) {
tableView.reloadData()
}

Loading…
Cancel
Save