Merge branch 'master' into fix-issuer-name

pull/298/head
James Sangalli 7 years ago committed by GitHub
commit b986abef04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Trust/Tokens/ViewControllers/TicketsViewController.swift
  2. 4
      Trust/Tokens/ViewControllers/TokensViewController.swift
  3. 17
      Trust/Tokens/ViewModels/TicketTokenViewCellViewModel.swift
  4. 18
      Trust/Tokens/ViewModels/TicketsViewControllerHeaderViewModel.swift
  5. 2
      Trust/Tokens/Views/TicketTokenViewCell.swift
  6. 5
      Trust/Tokens/Views/TicketsViewControllerHeader.swift

@ -122,7 +122,7 @@ class TicketsViewController: UIViewController {
tableView.dataSource = self
if let tokenObject = tokenObject {
header.configure(viewModel: .init(tokenObject: tokenObject))
header.configure(viewModel: .init(config: tokensStorage.config, tokenObject: tokenObject))
tableView.tableHeaderView = header
}

@ -247,12 +247,14 @@ extension TokensViewController: UITableViewDelegate {
return cellViewModel.cellHeight
case .stormBird:
let cellViewModel = TicketTokenViewCellViewModel(
config: dataStore.config,
token: token,
ticker: viewModel.ticker(for: token)
)
return cellViewModel.cellHeight
case .stormBirdOrder:
let cellViewModel = TicketTokenViewCellViewModel(
config: dataStore.config,
token: token,
ticker: viewModel.ticker(for: token)
)
@ -319,6 +321,7 @@ extension TokensViewController: UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: TicketTokenViewCell.identifier, for: indexPath) as! TicketTokenViewCell
cell.configure(
viewModel: .init(
config: dataStore.config,
token: token,
ticker: viewModel.ticker(for: token)
)
@ -329,6 +332,7 @@ extension TokensViewController: UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: TicketTokenViewCell.identifier, for: indexPath) as! TicketTokenViewCell
cell.configure(
viewModel: .init(
config: dataStore.config,
token: token,
ticker: viewModel.ticker(for: token)
)

@ -8,12 +8,15 @@ struct TicketTokenViewCellViewModel {
private let shortFormatter = EtherNumberFormatter.short
private let token: TokenObject
let config: Config
let ticker: CoinTicker?
init(
config: Config,
token: TokenObject,
ticker: CoinTicker?
) {
self.config = config
self.token = token
self.ticker = ticker
}
@ -28,7 +31,19 @@ struct TicketTokenViewCellViewModel {
}
var issuer: String {
return "\(R.string.localizable.aWalletContentsIssuerTitle()): \(R.string.localizable.ticketIssuer())"
if config.server == .main {
return "\(R.string.localizable.aWalletContentsIssuerTitle()): \(R.string.localizable.ticketIssuer())"
} else {
return ""
}
}
var issuerSeparator: String {
if issuer.isEmpty {
return ""
} else {
return "|"
}
}
var blockChainName: String {

@ -4,9 +4,11 @@ import UIKit
import BigInt
struct TicketsViewControllerHeaderViewModel {
let config: Config
private let tokenObject: TokenObject
init(tokenObject: TokenObject) {
init(config: Config, tokenObject: TokenObject) {
self.config = config
self.tokenObject = tokenObject
}
@ -15,7 +17,19 @@ struct TicketsViewControllerHeaderViewModel {
}
var issuer: String {
return "\(R.string.localizable.aWalletContentsIssuerTitle()): \(R.string.localizable.ticketIssuer())"
if config.server == .main {
return "\(R.string.localizable.aWalletContentsIssuerTitle()): \(R.string.localizable.ticketIssuer())"
} else {
return ""
}
}
var issuerSeparator: String {
if issuer.isEmpty {
return ""
} else {
return "|"
}
}
var blockChainName: String {

@ -72,6 +72,6 @@ class TicketTokenViewCell: UITableViewCell {
separator.textColor = viewModel.subtitleColor
separator.font = viewModel.subtitleFont
separator.text = "|"
separator.text = viewModel.issuerSeparator
}
}

@ -65,9 +65,8 @@ class TicketsViewControllerHeader: UIView {
} else {
issuerLabel.text = issuer
}
separator.textColor = viewModel.subtitleColor
separator.font = viewModel.subtitleFont
separator.text = "|"
separator.text = viewModel.issuerSeparator
}
}
}

Loading…
Cancel
Save