Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve warning when BSQ swap offer is removed #5891

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ private void onRemoveOpenOffer(OpenOffer openOffer) {
if (model.isBootstrappedOrShowPopup()) {
String key = "RemoveOfferWarning";
if (DontShowAgainLookup.showAgain(key)) {
new Popup().warning(Res.get("popup.warning.removeOffer", model.getMakerFeeAsString(openOffer)))
String message = model.hasMakerFee(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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ResultHandler;

import org.bitcoinj.core.Coin;

import com.google.inject.Inject;

import javax.inject.Named;
Expand Down Expand Up @@ -181,6 +183,11 @@ boolean isBootstrappedOrShowPopup() {
return GUIUtil.isBootstrappedOrShowPopup(p2PService);
}

public boolean hasMakerFee(OpenOffer openOffer) {
Coin makerFee = openOffer.getOffer().getMakerFee();
return makerFee.isPositive();
}

public String getMakerFeeAsString(OpenOffer openOffer) {
Offer offer = openOffer.getOffer();
return offer.isCurrencyForMakerFeeBtc() ?
Expand Down