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. 3
      Trust/Tokens/Views/TicketsViewControllerHeader.swift

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

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

@ -8,12 +8,15 @@ struct TicketTokenViewCellViewModel {
private let shortFormatter = EtherNumberFormatter.short private let shortFormatter = EtherNumberFormatter.short
private let token: TokenObject private let token: TokenObject
let config: Config
let ticker: CoinTicker? let ticker: CoinTicker?
init( init(
config: Config,
token: TokenObject, token: TokenObject,
ticker: CoinTicker? ticker: CoinTicker?
) { ) {
self.config = config
self.token = token self.token = token
self.ticker = ticker self.ticker = ticker
} }
@ -28,7 +31,19 @@ struct TicketTokenViewCellViewModel {
} }
var issuer: String { 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 { var blockChainName: String {

@ -4,9 +4,11 @@ import UIKit
import BigInt import BigInt
struct TicketsViewControllerHeaderViewModel { struct TicketsViewControllerHeaderViewModel {
let config: Config
private let tokenObject: TokenObject private let tokenObject: TokenObject
init(tokenObject: TokenObject) { init(config: Config, tokenObject: TokenObject) {
self.config = config
self.tokenObject = tokenObject self.tokenObject = tokenObject
} }
@ -15,7 +17,19 @@ struct TicketsViewControllerHeaderViewModel {
} }
var issuer: String { 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 { var blockChainName: String {

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

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