display actual XMR amount in offerFromUnsignedAccount warning instead of hardcoded 0.01 BTC

This commit is contained in:
premek 2021-05-16 02:09:58 +02:00 committed by woodser
parent be3494e54d
commit 2be32fcb8d
18 changed files with 64 additions and 63 deletions

View file

@ -1227,7 +1227,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
PaymentMethod.hasChargebackRisk(dataModel.getPaymentAccount().getPaymentMethod(), dataModel.getTradeCurrency().getCode())) {
Coin checkAmount = dataModel.getMinAmount().get() == null ? dataModel.getAmount().get() : dataModel.getMinAmount().get();
if (checkAmount != null && !checkAmount.isGreaterThan(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT)) {
GUIUtil.showMakeOfferToUnsignedAccountWarning();
GUIUtil.showMakeOfferToUnsignedAccountWarning(btcFormatter);
}
}
}

View file

@ -1252,7 +1252,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
// warn if you are selling BTC to unsigned account (#5343)
if (model.isSellingToAnUnsignedAccount(offer) && !takeOfferFromUnsignedAccountWarningDisplayed) {
takeOfferFromUnsignedAccountWarningDisplayed = true;
UserThread.runAfter(GUIUtil::showTakeOfferFromUnsignedAccountWarning, 500, TimeUnit.MILLISECONDS);
UserThread.runAfter(() -> GUIUtil.showTakeOfferFromUnsignedAccountWarning(formatter), 500, TimeUnit.MILLISECONDS);
}
}

View file

@ -39,6 +39,7 @@ import bisq.core.locale.Res;
import bisq.core.locale.TradeCurrency;
import bisq.core.monetary.Price;
import bisq.core.monetary.Volume;
import bisq.core.offer.OfferRestrictions;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.PaymentAccountList;
import bisq.core.payment.payload.PaymentMethod;
@ -699,18 +700,18 @@ public class GUIUtil {
return t.cast(parent);
}
public static void showTakeOfferFromUnsignedAccountWarning() {
public static void showTakeOfferFromUnsignedAccountWarning(CoinFormatter coinFormatter) {
String key = "confirmTakeOfferFromUnsignedAccount";
new Popup().warning(Res.get("payment.takeOfferFromUnsignedAccount.warning"))
new Popup().warning(Res.get("payment.takeOfferFromUnsignedAccount.warning", coinFormatter.formatCoinWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT)))
.width(900)
.closeButtonText(Res.get("shared.iConfirm"))
.dontShowAgainId(key)
.show();
}
public static void showMakeOfferToUnsignedAccountWarning() {
public static void showMakeOfferToUnsignedAccountWarning(CoinFormatter coinFormatter) {
String key = "confirmMakeOfferToUnsignedAccount";
new Popup().warning(Res.get("payment.makeOfferToUnsignedAccount.warning"))
new Popup().warning(Res.get("payment.makeOfferToUnsignedAccount.warning", coinFormatter.formatCoinWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT)))
.width(900)
.closeButtonText(Res.get("shared.iConfirm"))
.dontShowAgainId(key)