mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Merge pull request #4362 from jmacxx/fix_altcoins_instant_acc
Fix altcoin instant account creation / deletion issues
This commit is contained in:
commit
9ab39c2a8b
3 changed files with 16 additions and 9 deletions
|
@ -110,6 +110,7 @@ public class AssetsForm extends PaymentMethodForm {
|
||||||
tradeInstant = tradeInstantCheckBox.isSelected();
|
tradeInstant = tradeInstantCheckBox.isSelected();
|
||||||
if (tradeInstant)
|
if (tradeInstant)
|
||||||
new Popup().information(Res.get("payment.altcoin.tradeInstant.popup")).show();
|
new Popup().information(Res.get("payment.altcoin.tradeInstant.popup")).show();
|
||||||
|
paymentLimitationsTextField.setText(getLimitationsText());
|
||||||
});
|
});
|
||||||
|
|
||||||
gridPane.getChildren().remove(tradeInstantCheckBox);
|
gridPane.getChildren().remove(tradeInstantCheckBox);
|
||||||
|
|
|
@ -53,6 +53,7 @@ import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.ToggleButton;
|
import javafx.scene.control.ToggleButton;
|
||||||
import javafx.scene.control.Tooltip;
|
import javafx.scene.control.Tooltip;
|
||||||
import javafx.scene.layout.FlowPane;
|
import javafx.scene.layout.FlowPane;
|
||||||
|
@ -86,6 +87,7 @@ public abstract class PaymentMethodForm {
|
||||||
|
|
||||||
protected int gridRowFrom;
|
protected int gridRowFrom;
|
||||||
InputTextField accountNameTextField;
|
InputTextField accountNameTextField;
|
||||||
|
protected TextField paymentLimitationsTextField;
|
||||||
ToggleButton useCustomAccountNameToggleButton;
|
ToggleButton useCustomAccountNameToggleButton;
|
||||||
protected ComboBox<TradeCurrency> currencyComboBox;
|
protected ComboBox<TradeCurrency> currencyComboBox;
|
||||||
|
|
||||||
|
@ -164,22 +166,20 @@ public abstract class PaymentMethodForm {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addLimitations(boolean isDisplayForm) {
|
protected String getLimitationsText() {
|
||||||
|
final PaymentAccount paymentAccount = getPaymentAccount();
|
||||||
long hours = paymentAccount.getMaxTradePeriod() / 3600_000;
|
long hours = paymentAccount.getMaxTradePeriod() / 3600_000;
|
||||||
|
|
||||||
final TradeCurrency tradeCurrency;
|
final TradeCurrency tradeCurrency;
|
||||||
if (paymentAccount.getSingleTradeCurrency() != null)
|
if (paymentAccount.getSingleTradeCurrency() != null)
|
||||||
tradeCurrency = paymentAccount.getSingleTradeCurrency();
|
tradeCurrency = paymentAccount.getSingleTradeCurrency();
|
||||||
else if (paymentAccount.getSelectedTradeCurrency() != null)
|
else if (paymentAccount.getSelectedTradeCurrency() != null)
|
||||||
tradeCurrency = paymentAccount.getSelectedTradeCurrency();
|
tradeCurrency = paymentAccount.getSelectedTradeCurrency();
|
||||||
else if (!paymentAccount.getTradeCurrencies().isEmpty())
|
else if (!paymentAccount.getTradeCurrencies().isEmpty() && paymentAccount.getTradeCurrencies().get(0) != null)
|
||||||
tradeCurrency = paymentAccount.getTradeCurrencies().get(0);
|
tradeCurrency = paymentAccount.getTradeCurrencies().get(0);
|
||||||
else
|
else
|
||||||
tradeCurrency = paymentAccount instanceof AssetAccount ?
|
tradeCurrency = paymentAccount instanceof AssetAccount ?
|
||||||
CurrencyUtil.getAllSortedCryptoCurrencies().iterator().next() :
|
CurrencyUtil.getAllSortedCryptoCurrencies().iterator().next() :
|
||||||
CurrencyUtil.getDefaultTradeCurrency();
|
CurrencyUtil.getDefaultTradeCurrency();
|
||||||
|
|
||||||
|
|
||||||
final boolean isAddAccountScreen = paymentAccount.getAccountName() == null;
|
final boolean isAddAccountScreen = paymentAccount.getAccountName() == null;
|
||||||
final long accountAge = !isAddAccountScreen ? accountAgeWitnessService.getMyAccountAge(paymentAccount.getPaymentAccountPayload()) : 0L;
|
final long accountAge = !isAddAccountScreen ? accountAgeWitnessService.getMyAccountAge(paymentAccount.getPaymentAccountPayload()) : 0L;
|
||||||
|
|
||||||
|
@ -196,9 +196,14 @@ public abstract class PaymentMethodForm {
|
||||||
formatter.formatCoinWithCode(Coin.valueOf(accountAgeWitnessService.getMyTradeLimit(
|
formatter.formatCoinWithCode(Coin.valueOf(accountAgeWitnessService.getMyTradeLimit(
|
||||||
paymentAccount, tradeCurrency.getCode(), OfferPayload.Direction.SELL))),
|
paymentAccount, tradeCurrency.getCode(), OfferPayload.Direction.SELL))),
|
||||||
DisplayUtils.formatAccountAge(accountAge));
|
DisplayUtils.formatAccountAge(accountAge));
|
||||||
|
return limitationsText;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addLimitations(boolean isDisplayForm) {
|
||||||
|
final boolean isAddAccountScreen = paymentAccount.getAccountName() == null;
|
||||||
|
|
||||||
if (isDisplayForm) {
|
if (isDisplayForm) {
|
||||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), limitationsText);
|
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), getLimitationsText());
|
||||||
|
|
||||||
String accountSigningStateText;
|
String accountSigningStateText;
|
||||||
MaterialDesignIcon icon;
|
MaterialDesignIcon icon;
|
||||||
|
@ -233,8 +238,9 @@ public abstract class PaymentMethodForm {
|
||||||
accountSigningField.setContent(icon, accountSigningStateText, "", 0.4);
|
accountSigningField.setContent(icon, accountSigningStateText, "", 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else {
|
||||||
addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), limitationsText);
|
paymentLimitationsTextField = addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), getLimitationsText()).second;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(paymentAccount instanceof AssetAccount)) {
|
if (!(paymentAccount instanceof AssetAccount)) {
|
||||||
if (isAddAccountScreen) {
|
if (isAddAccountScreen) {
|
||||||
|
|
|
@ -221,7 +221,7 @@ public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAc
|
||||||
gridRow = paymentMethodForm.getGridRow();
|
gridRow = paymentMethodForm.getGridRow();
|
||||||
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(root, ++gridRow, Res.get("shared.deleteAccount"), Res.get("shared.cancel"));
|
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(root, ++gridRow, Res.get("shared.deleteAccount"), Res.get("shared.cancel"));
|
||||||
Button deleteAccountButton = tuple.first;
|
Button deleteAccountButton = tuple.first;
|
||||||
deleteAccountButton.setOnAction(event -> onDeleteAccount(paymentMethodForm.getPaymentAccount()));
|
deleteAccountButton.setOnAction(event -> onDeleteAccount(paymentAccount));
|
||||||
Button cancelButton = tuple.second;
|
Button cancelButton = tuple.second;
|
||||||
cancelButton.setOnAction(event -> removeSelectAccountForm());
|
cancelButton.setOnAction(event -> removeSelectAccountForm());
|
||||||
GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan());
|
GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan());
|
||||||
|
|
Loading…
Add table
Reference in a new issue