From 5c819ef99662bf2a84d967b4c2a3d6cda19e9b14 Mon Sep 17 00:00:00 2001 From: Hwee-Boon Yar Date: Fri, 18 May 2018 14:04:53 +0800 Subject: [PATCH] Extract ticket row view model code --- ...cketsQuantitySelectionViewController.swift | 16 +------ .../TicketRedemptionViewController.swift | 14 +------ .../BaseTicketTableViewCellViewModel.swift | 35 +--------------- ...eemTicketsQuantitySelectionViewModel.swift | 28 ------------- .../TicketRedemptionViewModel.swift | 28 ------------- .../ViewModels/TicketRowViewModel.swift | 42 +++++++++++++++++++ Trust/Redeem/Views/TicketRowView.swift | 16 +++++++ ...llTicketsPriceQuantityViewController.swift | 16 +------ ...PriceQuantityViewControllerViewModel.swift | 28 ------------- .../TicketTableViewCellViewModel.swift | 20 --------- .../Views/BaseTicketTableViewCell.swift | 18 +------- ...ooseTicketTransferModeViewController.swift | 16 +------ ...nsferTicketsExpiryDateViewController.swift | 16 +------ ...cketsQuantitySelectionViewController.swift | 16 +------ ...icketsViaWalletAddressViewController.swift | 16 +------ ...tTransferModeViewControllerViewModel.swift | 28 ------------- ...etsExpiryDateViewControllerViewModel.swift | 28 ------------- ...ferTicketsQuantitySelectionViewModel.swift | 28 ------------- ...WalletAddressViewControllerViewModel.swift | 32 -------------- 19 files changed, 67 insertions(+), 374 deletions(-) diff --git a/Trust/Redeem/ViewControllers/RedeemTicketsQuantitySelectionViewController.swift b/Trust/Redeem/ViewControllers/RedeemTicketsQuantitySelectionViewController.swift index 60237b3d5..8c3b95b50 100644 --- a/Trust/Redeem/ViewControllers/RedeemTicketsQuantitySelectionViewController.swift +++ b/Trust/Redeem/ViewControllers/RedeemTicketsQuantitySelectionViewController.swift @@ -129,7 +129,7 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController { subtitleLabel.font = viewModel.subtitleFont subtitleLabel.text = viewModel.subtitleText - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: viewModel.ticketHolder)) quantityStepper.borderWidth = 1 quantityStepper.clipsToBounds = true @@ -138,20 +138,6 @@ class RedeemTicketsQuantitySelectionViewController: UIViewController { ticketView.stateLabel.isHidden = true - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.venueLabel.text = viewModel.venue - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match - nextButton.setTitleColor(viewModel.buttonTitleColor, for: .normal) nextButton.backgroundColor = viewModel.buttonBackgroundColor nextButton.titleLabel?.font = viewModel.buttonFont diff --git a/Trust/Redeem/ViewControllers/TicketRedemptionViewController.swift b/Trust/Redeem/ViewControllers/TicketRedemptionViewController.swift index 824e094b2..6b7ea6ca0 100644 --- a/Trust/Redeem/ViewControllers/TicketRedemptionViewController.swift +++ b/Trust/Redeem/ViewControllers/TicketRedemptionViewController.swift @@ -149,20 +149,8 @@ class TicketRedemptionViewController: UIViewController { configureUI() - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: viewModel.ticketHolder)) ticketView.stateLabel.isHidden = true - - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match } } diff --git a/Trust/Redeem/ViewModels/BaseTicketTableViewCellViewModel.swift b/Trust/Redeem/ViewModels/BaseTicketTableViewCellViewModel.swift index e8a90ff6a..498f5d45d 100644 --- a/Trust/Redeem/ViewModels/BaseTicketTableViewCellViewModel.swift +++ b/Trust/Redeem/ViewModels/BaseTicketTableViewCellViewModel.swift @@ -3,7 +3,7 @@ import UIKit struct BaseTicketTableViewCellViewModel { - private let ticketHolder: TicketHolder + let ticketHolder: TicketHolder init( ticketHolder: TicketHolder @@ -11,39 +11,6 @@ struct BaseTicketTableViewCellViewModel { self.ticketHolder = ticketHolder } - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var time: String { - //TODO Should format be localized? - return ticketHolder.date.format("h:mm a", overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } - var backgroundColor: UIColor { return Colors.appWhite } diff --git a/Trust/Redeem/ViewModels/RedeemTicketsQuantitySelectionViewModel.swift b/Trust/Redeem/ViewModels/RedeemTicketsQuantitySelectionViewModel.swift index 003c39b15..076d10176 100644 --- a/Trust/Redeem/ViewModels/RedeemTicketsQuantitySelectionViewModel.swift +++ b/Trust/Redeem/ViewModels/RedeemTicketsQuantitySelectionViewModel.swift @@ -50,35 +50,7 @@ struct RedeemTicketsQuantitySelectionViewModel { return Colors.appBackground } - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - var subtitleText: String { return R.string.localizable.aWalletTicketTokenRedeemQuantityTitle() } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } } diff --git a/Trust/Redeem/ViewModels/TicketRedemptionViewModel.swift b/Trust/Redeem/ViewModels/TicketRedemptionViewModel.swift index 616f30a99..ef8e4d15a 100644 --- a/Trust/Redeem/ViewModels/TicketRedemptionViewModel.swift +++ b/Trust/Redeem/ViewModels/TicketRedemptionViewModel.swift @@ -28,32 +28,4 @@ struct TicketRedemptionViewModel { var backgroundColor: UIColor { return Colors.appBackground } - - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } } diff --git a/Trust/Redeem/ViewModels/TicketRowViewModel.swift b/Trust/Redeem/ViewModels/TicketRowViewModel.swift index 92e2c6c7c..4f9c6ddb4 100644 --- a/Trust/Redeem/ViewModels/TicketRowViewModel.swift +++ b/Trust/Redeem/ViewModels/TicketRowViewModel.swift @@ -3,6 +3,8 @@ import UIKit struct TicketRowViewModel { + var ticketHolder: TicketHolder? = nil + var backgroundColor: UIColor { return Colors.appWhite } @@ -58,4 +60,44 @@ struct TicketRowViewModel { var detailsFont: UIFont { return Fonts.light(size: 16)! } + + var ticketCount: String { + guard let ticketHolder = ticketHolder else { return "" } + return "x\(ticketHolder.tickets.count)" + } + + var city: String { + guard let ticketHolder = ticketHolder else { return "" } + return ", \(ticketHolder.city)" + } + + var category: String { + guard let ticketHolder = ticketHolder else { return "" } + return String(ticketHolder.category) + } + + var teams: String { + guard let ticketHolder = ticketHolder else { return "" } + return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) + } + + var match: String { + guard let ticketHolder = ticketHolder else { return "" } + return "M\(ticketHolder.match)" + } + + var venue: String { + guard let ticketHolder = ticketHolder else { return "" } + return ticketHolder.venue + } + + var date: String { + guard let ticketHolder = ticketHolder else { return "" } + return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) + } + + var time: String { + guard let ticketHolder = ticketHolder else { return "" } + return ticketHolder.date.format("h:mm a", overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) + } } diff --git a/Trust/Redeem/Views/TicketRowView.swift b/Trust/Redeem/Views/TicketRowView.swift index 0033c7d00..4353a97f2 100644 --- a/Trust/Redeem/Views/TicketRowView.swift +++ b/Trust/Redeem/Views/TicketRowView.swift @@ -145,5 +145,21 @@ class TicketRowView: UIView { teamsLabel.textColor = viewModel.subtitleColor teamsLabel.font = viewModel.subtitleFont + + ticketCountLabel.text = viewModel.ticketCount + + venueLabel.text = viewModel.venue + + dateLabel.text = viewModel.date + + timeLabel.text = viewModel.time + + cityLabel.text = viewModel.city + + categoryLabel.text = viewModel.category + + teamsLabel.text = viewModel.teams + + matchLabel.text = viewModel.match } } diff --git a/Trust/Sell/ViewControllers/EnterSellTicketsPriceQuantityViewController.swift b/Trust/Sell/ViewControllers/EnterSellTicketsPriceQuantityViewController.swift index 268a2ed7e..1d98151fa 100644 --- a/Trust/Sell/ViewControllers/EnterSellTicketsPriceQuantityViewController.swift +++ b/Trust/Sell/ViewControllers/EnterSellTicketsPriceQuantityViewController.swift @@ -253,7 +253,7 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController { header.configure(title: viewModel.headerTitle) - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: viewModel.ticketHolder)) pricePerTicketLabel.textAlignment = .center pricePerTicketLabel.textColor = viewModel.choiceLabelColor @@ -296,20 +296,6 @@ class EnterSellTicketsPriceQuantityViewController: UIViewController { ticketView.stateLabel.isHidden = true - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.venueLabel.text = viewModel.venue - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match - nextButton.setTitleColor(viewModel.buttonTitleColor, for: .normal) nextButton.backgroundColor = viewModel.buttonBackgroundColor nextButton.titleLabel?.font = viewModel.buttonFont diff --git a/Trust/Sell/ViewModels/EnterSellTicketsPriceQuantityViewControllerViewModel.swift b/Trust/Sell/ViewModels/EnterSellTicketsPriceQuantityViewControllerViewModel.swift index e1681384c..189433915 100644 --- a/Trust/Sell/ViewModels/EnterSellTicketsPriceQuantityViewControllerViewModel.swift +++ b/Trust/Sell/ViewModels/EnterSellTicketsPriceQuantityViewControllerViewModel.swift @@ -46,38 +46,10 @@ struct EnterSellTicketsPriceQuantityViewControllerViewModel { return Colors.appBackground } - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - var quantityLabelText: String { return R.string.localizable.aWalletTicketTokenSellQuantityTitle() } - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } - var pricePerTicketLabelText: String { return R.string.localizable.aWalletTicketTokenSellPricePerTicketTitle() } diff --git a/Trust/Tokens/ViewModels/TicketTableViewCellViewModel.swift b/Trust/Tokens/ViewModels/TicketTableViewCellViewModel.swift index 0a3bc12a3..3e89d2a72 100644 --- a/Trust/Tokens/ViewModels/TicketTableViewCellViewModel.swift +++ b/Trust/Tokens/ViewModels/TicketTableViewCellViewModel.swift @@ -11,26 +11,6 @@ struct TicketTableViewCellViewModel { self.ticketHolder = ticketHolder } - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var title: String { - return ticketHolder.name - } - - var seatRange: String { - return ticketHolder.seatRange - } - - var city: String { - return ticketHolder.city - } - - var venue: String { - return ticketHolder.venue - } - var backgroundColor: UIColor { return Colors.appWhite } diff --git a/Trust/Tokens/Views/BaseTicketTableViewCell.swift b/Trust/Tokens/Views/BaseTicketTableViewCell.swift index 1ecbd7a4f..066998b49 100644 --- a/Trust/Tokens/Views/BaseTicketTableViewCell.swift +++ b/Trust/Tokens/Views/BaseTicketTableViewCell.swift @@ -32,7 +32,7 @@ class BaseTicketTableViewCell: UITableViewCell { contentView.backgroundColor = viewModel.backgroundColor - rowView.configure(viewModel: .init()) + rowView.configure(viewModel: .init(ticketHolder: viewModel.ticketHolder)) if showCheckbox() { rowView.checkboxImageView.image = viewModel.checkboxImage @@ -41,22 +41,6 @@ class BaseTicketTableViewCell: UITableViewCell { rowView.stateLabel.text = " \(viewModel.status) " rowView.stateLabel.isHidden = viewModel.status.isEmpty - rowView.ticketCountLabel.text = viewModel.ticketCount - - rowView.venueLabel.text = viewModel.venue - - rowView.dateLabel.text = viewModel.date - - rowView.cityLabel.text = ", \(viewModel.city)" - - rowView.categoryLabel.text = viewModel.category - - rowView.timeLabel.text = viewModel.time - - rowView.teamsLabel.text = viewModel.teams - - rowView.matchLabel.text = viewModel.match - rowView.areDetailsVisible = viewModel.areDetailsVisible } diff --git a/Trust/Transfer/ViewControllers/ChooseTicketTransferModeViewController.swift b/Trust/Transfer/ViewControllers/ChooseTicketTransferModeViewController.swift index 4920bc034..9ccfd8003 100644 --- a/Trust/Transfer/ViewControllers/ChooseTicketTransferModeViewController.swift +++ b/Trust/Transfer/ViewControllers/ChooseTicketTransferModeViewController.swift @@ -118,24 +118,10 @@ class ChooseTicketTransferModeViewController: UIViewController { header.configure(title: viewModel.headerTitle) - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: ticketHolder)) ticketView.stateLabel.isHidden = true - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.venueLabel.text = viewModel.venue - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match - generateMagicLinkButton.setTitleColor(viewModel.buttonTitleColor, for: .normal) generateMagicLinkButton.backgroundColor = viewModel.buttonBackgroundColor generateMagicLinkButton.titleLabel?.font = viewModel.buttonFont diff --git a/Trust/Transfer/ViewControllers/SetTransferTicketsExpiryDateViewController.swift b/Trust/Transfer/ViewControllers/SetTransferTicketsExpiryDateViewController.swift index 2b3c9f141..3b9915c0a 100644 --- a/Trust/Transfer/ViewControllers/SetTransferTicketsExpiryDateViewController.swift +++ b/Trust/Transfer/ViewControllers/SetTransferTicketsExpiryDateViewController.swift @@ -239,7 +239,7 @@ class SetTransferTicketsExpiryDateViewController: UIViewController { header.configure(title: viewModel.headerTitle) - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: ticketHolder)) linkExpiryDateLabel.textAlignment = .center linkExpiryDateLabel.textColor = viewModel.choiceLabelColor @@ -253,20 +253,6 @@ class SetTransferTicketsExpiryDateViewController: UIViewController { ticketView.stateLabel.isHidden = true - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.venueLabel.text = viewModel.venue - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match - descriptionLabel.textAlignment = .center descriptionLabel.numberOfLines = 0 descriptionLabel.textColor = viewModel.descriptionLabelColor diff --git a/Trust/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift b/Trust/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift index e2639279f..c57c9eb5b 100644 --- a/Trust/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift +++ b/Trust/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift @@ -125,7 +125,7 @@ class TransferTicketsQuantitySelectionViewController: UIViewController { subtitleLabel.font = viewModel.subtitleFont subtitleLabel.text = viewModel.subtitleText - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: viewModel.ticketHolder)) quantityStepper.borderWidth = 1 quantityStepper.clipsToBounds = true @@ -134,20 +134,6 @@ class TransferTicketsQuantitySelectionViewController: UIViewController { ticketView.stateLabel.isHidden = true - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.venueLabel.text = viewModel.venue - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match - nextButton.setTitleColor(viewModel.buttonTitleColor, for: .normal) nextButton.backgroundColor = viewModel.buttonBackgroundColor nextButton.titleLabel?.font = viewModel.buttonFont diff --git a/Trust/Transfer/ViewControllers/TransferTicketsViaWalletAddressViewController.swift b/Trust/Transfer/ViewControllers/TransferTicketsViaWalletAddressViewController.swift index 32a94a070..ed10ea3d0 100644 --- a/Trust/Transfer/ViewControllers/TransferTicketsViaWalletAddressViewController.swift +++ b/Trust/Transfer/ViewControllers/TransferTicketsViaWalletAddressViewController.swift @@ -113,24 +113,10 @@ class TransferTicketsViaWalletAddressViewController: UIViewController { header.configure(title: viewModel.headerTitle) - ticketView.configure(viewModel: .init()) + ticketView.configure(viewModel: .init(ticketHolder: ticketHolder)) ticketView.stateLabel.isHidden = true - ticketView.ticketCountLabel.text = viewModel.ticketCount - - ticketView.venueLabel.text = viewModel.venue - - ticketView.dateLabel.text = viewModel.date - - ticketView.cityLabel.text = viewModel.city - - ticketView.categoryLabel.text = viewModel.category - - ticketView.teamsLabel.text = viewModel.teams - - ticketView.matchLabel.text = viewModel.match - targetAddressTextField.label.text = R.string.localizable.aSendRecipientAddressTitle() targetAddressTextField.configureOnce() diff --git a/Trust/Transfer/ViewModels/ChooseTicketTransferModeViewControllerViewModel.swift b/Trust/Transfer/ViewModels/ChooseTicketTransferModeViewControllerViewModel.swift index 13babc9ce..62af82955 100644 --- a/Trust/Transfer/ViewModels/ChooseTicketTransferModeViewControllerViewModel.swift +++ b/Trust/Transfer/ViewModels/ChooseTicketTransferModeViewControllerViewModel.swift @@ -31,32 +31,4 @@ struct ChooseTicketTransferModeViewControllerViewModel { return Fonts.regular(size: 16)! } } - - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } } diff --git a/Trust/Transfer/ViewModels/SetTransferTicketsExpiryDateViewControllerViewModel.swift b/Trust/Transfer/ViewModels/SetTransferTicketsExpiryDateViewControllerViewModel.swift index da749132a..d887acf63 100644 --- a/Trust/Transfer/ViewModels/SetTransferTicketsExpiryDateViewControllerViewModel.swift +++ b/Trust/Transfer/ViewModels/SetTransferTicketsExpiryDateViewControllerViewModel.swift @@ -28,34 +28,6 @@ struct SetTransferTicketsExpiryDateViewControllerViewModel { return Fonts.regular(size: 20)! } - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } - var descriptionLabelText: String { return R.string.localizable.aWalletTicketTokenTransferMagicLinkDescriptionTitle() } diff --git a/Trust/Transfer/ViewModels/TransferTicketsQuantitySelectionViewModel.swift b/Trust/Transfer/ViewModels/TransferTicketsQuantitySelectionViewModel.swift index efb37ced4..32fa17321 100644 --- a/Trust/Transfer/ViewModels/TransferTicketsQuantitySelectionViewModel.swift +++ b/Trust/Transfer/ViewModels/TransferTicketsQuantitySelectionViewModel.swift @@ -44,35 +44,7 @@ struct TransferTicketsQuantitySelectionViewModel { return Colors.appBackground } - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - var subtitleText: String { return R.string.localizable.aWalletTicketTokenTransferQuantityTitle() } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } } diff --git a/Trust/Transfer/ViewModels/TransferTicketsViaWalletAddressViewControllerViewModel.swift b/Trust/Transfer/ViewModels/TransferTicketsViaWalletAddressViewControllerViewModel.swift index 5920afdff..bc66c8b1a 100644 --- a/Trust/Transfer/ViewModels/TransferTicketsViaWalletAddressViewControllerViewModel.swift +++ b/Trust/Transfer/ViewModels/TransferTicketsViaWalletAddressViewControllerViewModel.swift @@ -27,36 +27,4 @@ struct TransferTicketsViaWalletAddressViewControllerViewModel { var buttonFont: UIFont { return Fonts.regular(size: 20)! } - - var ticketCount: String { - return "x\(ticketHolder.tickets.count)" - } - - var seatRange: String { - return ticketHolder.seatRange - } - - var city: String { - return ticketHolder.city - } - - var category: String { - return String(ticketHolder.category) - } - - var teams: String { - return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB) - } - - var match: String { - return "M\(ticketHolder.match)" - } - - var venue: String { - return ticketHolder.venue - } - - var date: String { - return ticketHolder.date.formatAsShortDateString(overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier) - } }