Skip to content

Commit 2b1d81b

Browse files
authored
Merge pull request #1969 from MixinNetwork/feature/trade
Switch to advanced trade on certain errors
2 parents 6ce04d0 + fb96b00 commit 2b1d81b

File tree

9 files changed

+137
-54
lines changed

9 files changed

+137
-54
lines changed

Mixin/Resources/en.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"address_validity_reminder" = "The address %1$@(%2$@) has not been used for over %3$@ days. Please check if the address is still valid.";
6161
"addresses" = "Addresses";
6262
"admin" = "Admin";
63+
"advanced_trade" = "Advanced Trade";
6364
"agree_hint" = "By proceeding, you agree to the %@ and %@.";
6465
"albums" = "Albums";
6566
"alert" = "Alert";
@@ -1430,7 +1431,7 @@
14301431
"swap_failed" = "Swap Failed";
14311432
"swap_invalid_amount" = "No available quote found. Please try a different amount.";
14321433
"swap_message_success" = "Your transaction has been sent to network and will be processed within a few minutes.";
1433-
"swap_no_available_quote" = "No available quote found. Please try a different token.";
1434+
"swap_no_available_quote" = "No available quote found. Please try a different token. Try placing a limit order? No restrictions on amount or token.";
14341435
"swap_not_supported" = "%@ swapping is not supported.";
14351436
"swap_order_paid" = "Paid";
14361437
"swap_order_received" = "Received";

Mixin/Resources/es.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"address_validity_reminder" = "The address %1$@(%2$@) has not been used for over %3$@ days. Please check if the address is still valid.";
6161
"addresses" = "Addresses";
6262
"admin" = "Administrador";
63+
"advanced_trade" = "Advanced Trade";
6364
"agree_hint" = "Al continuar, aceptas el %@ y el %@.";
6465
"albums" = "Álbumes";
6566
"alert" = "Alert";
@@ -1430,7 +1431,7 @@
14301431
"swap_failed" = "Swap Failed";
14311432
"swap_invalid_amount" = "No available quote found. Please try a different amount.";
14321433
"swap_message_success" = "Your transaction has been sent to network and will be processed within a few minutes.";
1433-
"swap_no_available_quote" = "No available quote found. Please try a different token.";
1434+
"swap_no_available_quote" = "No available quote found. Please try a different token. Try placing a limit order? No restrictions on amount or token.";
14341435
"swap_not_supported" = "%@ swapping is not supported.";
14351436
"swap_order_paid" = "Paid";
14361437
"swap_order_received" = "Received";

Mixin/Resources/ja.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"address_validity_reminder" = "The address %1$@(%2$@) has not been used for over %3$@ days. Please check if the address is still valid.";
6161
"addresses" = "Addresses";
6262
"admin" = "管理者";
63+
"advanced_trade" = "Advanced Trade";
6364
"agree_hint" = "%@と%@に同意し次へ進む";
6465
"albums" = "アルバム";
6566
"alert" = "Alert";
@@ -1430,7 +1431,7 @@
14301431
"swap_failed" = "Swap Failed";
14311432
"swap_invalid_amount" = "No available quote found. Please try a different amount.";
14321433
"swap_message_success" = "Your transaction has been sent to network and will be processed within a few minutes.";
1433-
"swap_no_available_quote" = "No available quote found. Please try a different token.";
1434+
"swap_no_available_quote" = "No available quote found. Please try a different token. Try placing a limit order? No restrictions on amount or token.";
14341435
"swap_not_supported" = "%@ swapping is not supported.";
14351436
"swap_order_paid" = "Paid";
14361437
"swap_order_received" = "Received";

Mixin/Resources/ru.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"address_validity_reminder" = "The address %1$@(%2$@) has not been used for over %3$@ days. Please check if the address is still valid.";
6161
"addresses" = "Addresses";
6262
"admin" = "Администратор";
63+
"advanced_trade" = "Advanced Trade";
6364
"agree_hint" = "Продолжая, вы соглашаетесь с %@ и %@.";
6465
"albums" = "Альбомы";
6566
"alert" = "Alert";
@@ -1430,7 +1431,7 @@
14301431
"swap_failed" = "Swap Failed";
14311432
"swap_invalid_amount" = "No available quote found. Please try a different amount.";
14321433
"swap_message_success" = "Your transaction has been sent to network and will be processed within a few minutes.";
1433-
"swap_no_available_quote" = "No available quote found. Please try a different token.";
1434+
"swap_no_available_quote" = "No available quote found. Please try a different token. Try placing a limit order? No restrictions on amount or token.";
14341435
"swap_not_supported" = "%@ swapping is not supported.";
14351436
"swap_order_paid" = "Paid";
14361437
"swap_order_received" = "Received";

Mixin/Resources/zh-Hans.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"address_validity_reminder" = "您已经超过 %3$@ 天没有使用地址 %1$@(%2$@),请注意检查地址是否仍然有效。";
6161
"addresses" = "地址";
6262
"admin" = "管理员";
63+
"advanced_trade" = "挂单交易";
6364
"agree_hint" = "继续使用即表示你同意 %@ 和 %@";
6465
"albums" = "相册";
6566
"alert" = "价格预警";
@@ -1430,7 +1431,7 @@
14301431
"swap_failed" = "交易失败";
14311432
"swap_invalid_amount" = "没有报价。请尝试修改金额。";
14321433
"swap_message_success" = "您的交易已发送至网络,将很快被处理。";
1433-
"swap_no_available_quote" = "没有报价。请尝试切换币种。";
1434+
"swap_no_available_quote" = "暂无报价,请尝试切换币种。试试挂单?不受金额和币种限制。";
14341435
"swap_not_supported" = "不支持 %@ 交易。";
14351436
"swap_order_paid" = "已支付";
14361437
"swap_order_received" = "已收到";

Mixin/Resources/zh-Hant.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"address_validity_reminder" = "您已經超過 %3$@ 天沒有使用地址 %1$@(%2$@),請注意檢查地址是否仍然有效。";
6161
"addresses" = "地址";
6262
"admin" = "管理員";
63+
"advanced_trade" = "掛單交易";
6364
"agree_hint" = "繼續使用即表示你同意 %@ 和 %@";
6465
"albums" = "相簿";
6566
"alert" = "價格預警";
@@ -1430,7 +1431,7 @@
14301431
"swap_failed" = "交易失敗";
14311432
"swap_invalid_amount" = "沒有報價。請嘗試修改金額。";
14321433
"swap_message_success" = "您的交易已傳送至網路,將很快被處理。";
1433-
"swap_no_available_quote" = "沒有報價。請嘗試切換幣種。";
1434+
"swap_no_available_quote" = "沒有報價。請嘗試切換幣種。試試掛單?不受金額和幣種限制。";
14341435
"swap_not_supported" = "不支援 %@ 交易。";
14351436
"swap_order_paid" = "已支付";
14361437
"swap_order_received" = "已收到";

Mixin/UserInterface/Controllers/Wallet/Trade/SwapPriceCell.swift

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,33 @@ final class SwapPriceCell: UICollectionViewCell {
66
@IBOutlet weak var footerInfoProgressView: CircularProgressView!
77
@IBOutlet weak var footerSpacingView: UIView!
88
@IBOutlet weak var togglePriceUnitButton: UIButton!
9+
@IBOutlet weak var advancedTradingHintStackView: UIStackView!
10+
@IBOutlet weak var advancedTradingHintButton: UIButton!
911

1012
override func awakeFromNib() {
1113
super.awakeFromNib()
1214
footerInfoButton.titleLabel?.setFont(
1315
scaledFor: .systemFont(ofSize: 14, weight: .regular),
1416
adjustForContentSize: true
1517
)
18+
advancedTradingHintButton.configuration = {
19+
var attributes = AttributeContainer()
20+
attributes.font = UIFontMetrics.default.scaledFont(
21+
for: .systemFont(ofSize: 14, weight: .medium)
22+
)
23+
attributes.foregroundColor = R.color.theme()
24+
var config: UIButton.Configuration = .plain()
25+
config.attributedTitle = AttributedString(
26+
R.string.localizable.advanced_trade(),
27+
attributes: attributes,
28+
)
29+
config.image = R.image.ic_accessory_disclosure()?.withRenderingMode(.alwaysTemplate)
30+
config.imagePadding = 10
31+
config.imagePlacement = .trailing
32+
config.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 16, bottom: 10, trailing: 16)
33+
return config
34+
}()
35+
advancedTradingHintButton.tintColor = R.color.theme()
1636
}
1737

1838
}
@@ -21,7 +41,7 @@ extension SwapPriceCell {
2141

2242
enum Content {
2343
case calculating
24-
case error(String)
44+
case error(description: String, advancedTradingHint: Bool)
2545
case price(String)
2646
}
2747

@@ -34,25 +54,29 @@ extension SwapPriceCell {
3454
footerInfoProgressView.isHidden = true
3555
footerSpacingView.isHidden = true
3656
togglePriceUnitButton.isHidden = true
37-
case .error(let description):
57+
advancedTradingHintStackView.isHidden = true
58+
case let .error(description, advancedTradingHint):
3859
footerInfoButton.setTitleColor(R.color.red(), for: .normal)
3960
footerInfoButton.setTitle(description, for: .normal)
4061
footerInfoButton.isHidden = false
4162
footerInfoProgressView.isHidden = true
4263
footerSpacingView.isHidden = true
4364
togglePriceUnitButton.isHidden = true
65+
advancedTradingHintStackView.isHidden = !advancedTradingHint
4466
case .price(let price):
4567
footerInfoButton.setTitleColor(R.color.text_tertiary(), for: .normal)
4668
footerInfoButton.setTitle(price, for: .normal)
4769
footerInfoButton.isHidden = false
4870
footerInfoProgressView.isHidden = false
4971
footerSpacingView.isHidden = false
5072
togglePriceUnitButton.isHidden = false
73+
advancedTradingHintStackView.isHidden = true
5174
case nil:
5275
footerInfoButton.isHidden = true
5376
footerInfoProgressView.isHidden = true
5477
footerSpacingView.isHidden = true
5578
togglePriceUnitButton.isHidden = true
79+
advancedTradingHintStackView.isHidden = true
5680
}
5781
}
5882

0 commit comments

Comments
 (0)