Skip to content

Commit

Permalink
Update the length of double in p2p trading.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowheat committed Oct 23, 2018
1 parent 665c8a9 commit bf1834d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ class OrderDetailViewController: UIViewController, UIScrollViewDelegate {
let price = order.originalOrder.amountBuy / order.originalOrder.amountSell
if order.originalOrder.side.lowercased() == "buy" {
let value = 1 / price
amountInfoLabel.text = "\(value.withCommas(12).trailingZero()) \(order.originalOrder.tokenBuy)/\(order.originalOrder.tokenSell)"
amountInfoLabel.text = "\(value.withCommas(8).trailingZero()) \(order.originalOrder.tokenBuy)/\(order.originalOrder.tokenSell)"
} else {
let value = price
amountInfoLabel.text = "\(value.withCommas(12).trailingZero()) \(order.originalOrder.tokenSell)/\(order.originalOrder.tokenBuy)"
amountInfoLabel.text = "\(value.withCommas(8).trailingZero()) \(order.originalOrder.tokenSell)/\(order.originalOrder.tokenBuy)"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,29 @@ class OrderQRCodeViewController: UIViewController {

priceBuyLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
priceBuyLabel.theme_textColor = GlobalPicker.contrastTextColor
priceBuyLabel.text = "\(price.withCommas()) \(order.tokenBuy)"
var lengthPriceBuy = 6
if price > 100 {
lengthPriceBuy = 4
} else if price < 1 {
// 8 is too long
lengthPriceBuy = 6
}
priceBuyLabel.text = "\(price.withCommas(lengthPriceBuy)) \(order.tokenBuy)"

unitSellLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
unitSellLabel.theme_textColor = GlobalPicker.contrastTextLightColor
unitSellLabel.text = "1 \(order.tokenBuy)"

priceSellLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
priceSellLabel.theme_textColor = GlobalPicker.contrastTextColor
priceSellLabel.text = "\((1/price).withCommas()) \(order.tokenSell)"
var lengthPriceSell = 6
if (1/price) > 100 {
lengthPriceSell = 4
} else if (1/price) < 1 {
// 8 is too long
lengthPriceSell = 6
}
priceSellLabel.text = "\((1/price).withCommas(lengthPriceSell)) \(order.tokenSell)"

buyEqualLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
buyEqualLabel.theme_textColor = GlobalPicker.contrastTextDarkColor
Expand Down
2 changes: 1 addition & 1 deletion loopr-ios/Trade/P2POrderHistoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class P2POrderHistoryViewController: UIViewController, UITableViewDelegate, UITa
setBackButton()
historyTableView.dataSource = self
historyTableView.delegate = self
historyTableView.tableFooterView = UIView()
historyTableView.tableFooterView = UIView(frame: .zero)
historyTableView.separatorStyle = .none
let headerView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 8))
headerView.theme_backgroundColor = ColorPicker.backgroundColor
Expand Down
2 changes: 1 addition & 1 deletion loopr-ios/Trade/TradeConfirmationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class TradeConfirmationViewController: UIViewController {
tokenSView.update(type: .sell, symbol: order.tokenSell, amount: order.amountSell)
let price = order.amountBuy / order.amountSell
let value = order.side == "buy" ? 1 / price : price
priceValueLabel.text = "\(value.withCommas()) \(order.market)"
priceValueLabel.text = "\(value.withCommas(8)) \(order.market)"
if let price = PriceDataManager.shared.getPrice(of: "LRC") {
let total = (price * order.lrcFee).currency
LRCFeeValueLabel.text = "\(order.lrcFee.withCommas(3)) LRC ≈ \(total)"
Expand Down
4 changes: 2 additions & 2 deletions loopr-ios/Trade/TradeReviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ class TradeReviewViewController: UIViewController {

priceBuyLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
priceBuyLabel.theme_textColor = GlobalPicker.contrastTextColor
priceBuyLabel.text = "\(price.withCommas()) \(order.tokenBuy)"
priceBuyLabel.text = "\(price.withCommas(6)) \(order.tokenBuy)"

unitSellLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
unitSellLabel.theme_textColor = GlobalPicker.contrastTextLightColor
unitSellLabel.text = "1 \(order.tokenBuy)"

priceSellLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
priceSellLabel.theme_textColor = GlobalPicker.contrastTextColor
priceSellLabel.text = "\((1/price).withCommas()) \(order.tokenSell)"
priceSellLabel.text = "\((1/price).withCommas(6)) \(order.tokenSell)"

buyEqualLabel.font = FontConfigManager.shared.getCharactorFont(size: 11)
buyEqualLabel.theme_textColor = GlobalPicker.contrastTextDarkColor
Expand Down

0 comments on commit bf1834d

Please sign in to comment.