blockchainethereumblockchain-walleterc20erc721walletxdaidappdecentralizederc1155erc875iosswifttokens
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.8 KiB
110 lines
2.8 KiB
7 years ago
|
// Copyright © 2018 Stormbird PTE. LTD.
|
||
|
|
||
|
import UIKit
|
||
|
|
||
6 years ago
|
struct TokenCardRowViewModel {
|
||
6 years ago
|
var ticketHolder: TokenHolder?
|
||
7 years ago
|
|
||
7 years ago
|
var backgroundColor: UIColor {
|
||
|
return Colors.appWhite
|
||
|
}
|
||
|
|
||
|
var contentsBackgroundColor: UIColor {
|
||
|
return Colors.appWhite
|
||
|
}
|
||
|
|
||
|
var titleColor: UIColor {
|
||
|
return Colors.appText
|
||
|
}
|
||
|
|
||
|
var countColor: UIColor {
|
||
|
return Colors.appHighlightGreen
|
||
|
}
|
||
|
|
||
|
var subtitleColor: UIColor {
|
||
|
return UIColor(red: 112, green: 112, blue: 112)
|
||
|
}
|
||
|
|
||
|
var iconsColor: UIColor {
|
||
|
return Colors.appBackground
|
||
|
}
|
||
|
|
||
|
var ticketCountFont: UIFont {
|
||
|
return Fonts.bold(size: 21)!
|
||
|
}
|
||
|
|
||
|
var titleFont: UIFont {
|
||
|
return Fonts.light(size: 21)!
|
||
|
}
|
||
|
|
||
|
var venueFont: UIFont {
|
||
7 years ago
|
return Fonts.light(size: 16)!
|
||
7 years ago
|
}
|
||
|
|
||
|
var stateBackgroundColor: UIColor {
|
||
|
return UIColor(red: 151, green: 151, blue: 151)
|
||
|
}
|
||
|
|
||
|
var stateColor: UIColor {
|
||
|
return .white
|
||
|
}
|
||
|
|
||
|
var subtitleFont: UIFont {
|
||
7 years ago
|
if ScreenChecker().isNarrowScreen() {
|
||
|
return Fonts.semibold(size: 12)!
|
||
|
} else {
|
||
|
return Fonts.semibold(size: 15)!
|
||
|
}
|
||
7 years ago
|
}
|
||
7 years ago
|
|
||
|
var detailsFont: UIFont {
|
||
|
return Fonts.light(size: 16)!
|
||
|
}
|
||
7 years ago
|
|
||
|
var ticketCount: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
|
return "x\(ticketHolder.tickets.count)"
|
||
|
}
|
||
|
|
||
|
var city: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
let value = ticketHolder.values["locality"] ?? "N/A"
|
||
|
return ", \(value)"
|
||
7 years ago
|
}
|
||
|
|
||
|
var category: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
return ticketHolder.values["category"] as? String ?? "N/A"
|
||
7 years ago
|
}
|
||
|
|
||
|
var teams: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
let countryA = ticketHolder.values["countryA"] as? String ?? ""
|
||
|
let countryB = ticketHolder.values["countryB"] as? String ?? ""
|
||
|
return R.string.localizable.aWalletTicketTokenMatchVs(countryA, countryB)
|
||
7 years ago
|
}
|
||
|
|
||
|
var match: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
let value = ticketHolder.values["match"] as? Int ?? 0
|
||
|
return "M\(value)"
|
||
7 years ago
|
}
|
||
|
|
||
|
var venue: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
return ticketHolder.values["venue"] as? String ?? "N/A"
|
||
7 years ago
|
}
|
||
|
|
||
|
var date: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
let value = ticketHolder.values["time"] as? GeneralisedTime ?? GeneralisedTime()
|
||
|
return value.formatAsShortDateString()
|
||
7 years ago
|
}
|
||
|
|
||
|
var time: String {
|
||
|
guard let ticketHolder = ticketHolder else { return "" }
|
||
6 years ago
|
let value = ticketHolder.values["time"] as? GeneralisedTime ?? GeneralisedTime()
|
||
|
return value.format("h:mm a")
|
||
7 years ago
|
}
|
||
7 years ago
|
}
|