Improve warning when BSQ swap offer is removed

This commit is contained in:
Christoph Atteneder 2021-12-03 12:21:03 +01:00
parent 981d6ff000
commit ec5f217f2f
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B
3 changed files with 12 additions and 1 deletions

View file

@ -2973,6 +2973,7 @@ popup.warning.chainNotSynced=The Bisq wallet blockchain height is not synced cor
You can check the blockchain height in Settings/Network Info. If more than one block passes and this problem persists it may be stalled, in which case you should do an SPV resync. [HYPERLINK:https://bisq.wiki/Resyncing_SPV_file]
popup.warning.daoNeedsResync=Your Bisq DAO state needs to be resynced.\n\nPlease navigate to DAO Network Monitor menu and follow the prompts to resync the DAO state.
popup.warning.removeOffer=Are you sure you want to remove that offer?\nThe maker fee of {0} will be lost if you remove that offer.
popup.warning.removeNoFeeOffer=Are you sure you want to remove that offer?\nNo maker fee will be lost if you remove that offer.
popup.warning.tooLargePercentageValue=You cannot set a percentage of 100% or larger.
popup.warning.examplePercentageValue=Please enter a percentage number like \"5.4\" for 5.4%
popup.warning.noPriceFeedAvailable=There is no price feed available for that currency. You cannot use a percent based price.\nPlease select the fixed price.

View file

@ -396,7 +396,10 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
if (model.isBootstrappedOrShowPopup()) {
String key = "RemoveOfferWarning";
if (DontShowAgainLookup.showAgain(key)) {
new Popup().warning(Res.get("popup.warning.removeOffer", model.getMakerFeeAsString(openOffer)))
String message = model.isMakerFee(openOffer) ?
Res.get("popup.warning.removeOffer", model.getMakerFeeAsString(openOffer)) :
Res.get("popup.warning.removeNoFeeOffer");
new Popup().warning(message)
.actionButtonText(Res.get("shared.removeOffer"))
.onAction(() -> doRemoveOpenOffer(openOffer))
.closeButtonText(Res.get("shared.dontRemoveOffer"))

View file

@ -38,6 +38,8 @@ import bisq.network.p2p.P2PService;
import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ResultHandler;
import org.bitcoinj.core.Coin;
import com.google.inject.Inject;
import javax.inject.Named;
@ -181,6 +183,11 @@ class OpenOffersViewModel extends ActivatableWithDataModel<OpenOffersDataModel>
return GUIUtil.isBootstrappedOrShowPopup(p2PService);
}
public boolean isMakerFee(OpenOffer openOffer) {
Coin makerFee = openOffer.getOffer().getMakerFee();
return makerFee != null && makerFee.isPositive();
}
public String getMakerFeeAsString(OpenOffer openOffer) {
Offer offer = openOffer.getOffer();
return offer.isCurrencyForMakerFeeBtc() ?