From 2a0d57c42cbb88199d2966f141bfa9b5980a544a Mon Sep 17 00:00:00 2001 From: Vitaly Katz Date: Thu, 15 Sep 2022 14:17:45 +0200 Subject: [PATCH 1/3] gh-2672 Add redeem deadline warning --- .../ClaimedAmountInputCell.swift | 4 +++ .../ClaimedAmountInputCell.xib | 31 +++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift index 577302287..5698a36a1 100644 --- a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift +++ b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift @@ -11,9 +11,11 @@ import UIKit class ClaimedAmountInputCell: UITableViewCell { @IBOutlet private weak var titleLabel: UILabel! @IBOutlet private weak var descriptionLabel: UILabel! + @IBOutlet private weak var redeemWarningLabel: UILabel! @IBOutlet private weak var amountTextField: TokenAmountField! private var maxButton: UIButton! + private let fieldDelegate = TokenAmountTextDelegate() var didEndValidating: (_ error: String?) -> Void = { _ in } { @@ -44,6 +46,8 @@ class ClaimedAmountInputCell: UITableViewCell { descriptionLabel.text = "Select all tokens or custom amount." descriptionLabel.setStyle(.secondary) + redeemWarningLabel.setStyle(.footnote2.color(UIColor(hex: "#B2BBC0"))) + amountTextField.setToken(image: UIImage(named: "ico-safe-token-logo-circle")) maxButton = UIButton(type: .custom) diff --git a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.xib b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.xib index b088447c1..95cf1379c 100644 --- a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.xib +++ b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.xib @@ -11,35 +11,35 @@ - - + + - + - + - + - - + + @@ -48,9 +48,19 @@ + + + + @@ -64,9 +74,10 @@ + - + From 586a7056e9b0e5654bb20dfe8cbf209abcde7649 Mon Sep 17 00:00:00 2001 From: Vitaly Katz Date: Thu, 15 Sep 2022 14:42:25 +0200 Subject: [PATCH 2/3] gh-2672 Hide redeem deadline warning if allocation was redeemed --- .../ClaimTokensViewController.swift | 8 +++++++- .../ClaimedAmountInputCell.swift | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift index 2158ee83d..7daae1c73 100644 --- a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift +++ b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift @@ -365,6 +365,7 @@ extension ClaimTokensViewController: UITableViewDelegate, UITableViewDataSource inputAmount = cell.value claimButton.isEnabled = (error == nil) && claimButtonEnabled } + cell.redeemDeadlineWarning = !data.isRedeemed return cell case .selectedDelegate: @@ -384,6 +385,8 @@ extension ClaimTokensViewController: UITableViewDelegate, UITableViewDataSource var totalValue: String var availableRange: Range + + var isRedeemed: Bool } func displayValues(from claimData: ClaimingAppController.ClaimingData) -> DisplayValues { @@ -409,6 +412,8 @@ extension ClaimTokensViewController: UITableViewDelegate, UITableViewDataSource ) } + let isRedeemed = claimData.isRedeemed + // components and total of vested amount let userVestedAmount: Sol.UInt128? = claimData.availableAmount(for: userAllocation, at: timestamp) let ecoVestedAmount: Sol.UInt128? = claimData.availableAmount(for: ecosystemAllocation, at: timestamp) @@ -486,7 +491,8 @@ extension ClaimTokensViewController: UITableViewDelegate, UITableViewDataSource unvestedAmountTooltip: unvestedAmountTooltip, unvestedStyle: lightBoxStyle, totalValue: allocationText, - availableRange: availableRange + availableRange: availableRange, + isRedeemed: isRedeemed ) } diff --git a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift index 5698a36a1..45b3100c5 100644 --- a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift +++ b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift @@ -38,6 +38,11 @@ class ClaimedAmountInputCell: UITableViewCell { fieldDelegate.isUsingMaxValue } + var redeemDeadlineWarning: Bool { + get { !redeemWarningLabel.isHidden } + set { redeemWarningLabel.isHidden = !newValue } + } + override func awakeFromNib() { super.awakeFromNib() titleLabel.text = "How much do you want to claim?" From 3575119a014993293b509f2e3d3e392ed19c0fbf Mon Sep 17 00:00:00 2001 From: Vitaly Katz Date: Thu, 15 Sep 2022 15:39:35 +0200 Subject: [PATCH 3/3] gh-2672 PR comments --- .../ClaimTokensViewController.swift | 2 +- .../ClaimedAmountInputCell.swift | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift index 7daae1c73..17c35b016 100644 --- a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift +++ b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimTokensViewController.swift @@ -365,7 +365,7 @@ extension ClaimTokensViewController: UITableViewDelegate, UITableViewDataSource inputAmount = cell.value claimButton.isEnabled = (error == nil) && claimButtonEnabled } - cell.redeemDeadlineWarning = !data.isRedeemed + cell.set(redeemDeadlineLabelVisible: !data.isRedeemed) return cell case .selectedDelegate: diff --git a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift index 45b3100c5..45f08442f 100644 --- a/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift +++ b/Multisig/UI/ClaimToken/ClaimingAmountViewController/ClaimedAmountInputCell.swift @@ -38,11 +38,6 @@ class ClaimedAmountInputCell: UITableViewCell { fieldDelegate.isUsingMaxValue } - var redeemDeadlineWarning: Bool { - get { !redeemWarningLabel.isHidden } - set { redeemWarningLabel.isHidden = !newValue } - } - override func awakeFromNib() { super.awakeFromNib() titleLabel.text = "How much do you want to claim?" @@ -70,6 +65,9 @@ class ClaimedAmountInputCell: UITableViewCell { fieldDelegate.setMaxValue() } + func set(redeemDeadlineLabelVisible: Bool) { + redeemWarningLabel.isHidden = !redeemDeadlineLabelVisible + } } import Solidity