diff --git a/common/src/main/java/bisq/common/app/DevEnv.java b/common/src/main/java/bisq/common/app/DevEnv.java index 30e8f641a7..a5691d9a2d 100644 --- a/common/src/main/java/bisq/common/app/DevEnv.java +++ b/common/src/main/java/bisq/common/app/DevEnv.java @@ -58,7 +58,7 @@ public class DevEnv { private static boolean daoActivated = false; public static boolean isDaoActivated() { - return daoActivated; + return false; } public static void setDaoActivated(boolean daoActivated) { diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 38ea709add..411db03a67 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -376,6 +376,7 @@ createOffer.warning.sellBelowMarketPrice=You will always get {0}% less than the createOffer.warning.buyAboveMarketPrice=You will always pay {0}% more than the current market price as the price of your offer will be continuously updated. createOffer.tradeFee.descriptionBTCOnly=Trade fee createOffer.tradeFee.descriptionBSQEnabled=Select trade fee currency +createOffer.tradeFee.fiatAndPercent=≈ {0} / {1} of trade amount # new entries createOffer.placeOfferButton=Review: Place offer to {0} bitcoin diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index 6c3c71ea24..be528576e8 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -259,6 +259,13 @@ public abstract class MutableOfferView extends boolean currencyForMakerFeeBtc = model.getDataModel().isCurrencyForMakerFeeBtc(); tradeFeeInBtcToggle.setSelected(currencyForMakerFeeBtc); tradeFeeInBsqToggle.setSelected(!currencyForMakerFeeBtc); + + if (!DevEnv.isDaoActivated()) { + tradeFeeInBtcToggle.setVisible(false); + tradeFeeInBtcToggle.setManaged(false); + tradeFeeInBsqToggle.setVisible(false); + tradeFeeInBsqToggle.setManaged(false); + } } } @@ -785,8 +792,10 @@ public abstract class MutableOfferView extends private void setIsCurrencyForMakerFeeBtc(boolean isCurrencyForMakerFeeBtc) { model.setIsCurrencyForMakerFeeBtc(isCurrencyForMakerFeeBtc); - tradeFeeInBtcTextField.setOpacity(isCurrencyForMakerFeeBtc ? 1 : 0.3); - tradeFeeInBsqTextField.setOpacity(isCurrencyForMakerFeeBtc ? 0.3 : 1); + if (DevEnv.isDaoActivated()) { + tradeFeeInBtcTextField.setOpacity(isCurrencyForMakerFeeBtc ? 1 : 0.3); + tradeFeeInBsqTextField.setOpacity(isCurrencyForMakerFeeBtc ? 0.3 : 1); + } } private Label createPopoverLabel(String text) { @@ -1343,7 +1352,6 @@ public abstract class MutableOfferView extends tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton(); tradeFeeInBsqToggle.setText("BSQ"); tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5)); - //tradeFeeInBsqToggle.setRotate(90); VBox tradeFeeToggleButtonBox = new VBox(); tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java index ddfaf214dd..a955123044 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java @@ -497,13 +497,35 @@ public abstract class MutableOfferViewModel ext Optional optionalBtcFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBtc, true, preferences, priceFeedService, bsqFormatter); String btcFeeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBtc, optionalBtcFeeInFiat, btcFormatter); - tradeFeeInBtcWithFiat.set(btcFeeWithFiatAmount); + if (DevEnv.isDaoActivated()) { + tradeFeeInBtcWithFiat.set(btcFeeWithFiatAmount); + } else { + tradeFeeInBtcWithFiat.set(btcFormatter.formatCoinWithCode(makerFeeAsCoin)); + } Coin makerFeeInBsq = dataModel.getMakerFeeInBsq(); Optional optionalBsqFeeInFiat = OfferUtil.getFeeInUserFiatCurrency(makerFeeInBsq, false, preferences, priceFeedService, bsqFormatter); String bsqFeeWithFiatAmount = OfferUtil.getFeeWithFiatAmount(makerFeeInBsq, optionalBsqFeeInFiat, bsqFormatter); - tradeFeeInBsqWithFiat.set(bsqFeeWithFiatAmount); + if (DevEnv.isDaoActivated()) { + tradeFeeInBsqWithFiat.set(bsqFeeWithFiatAmount); + } else { + // Before DAO is enabled we show fee as fiat and % in second line + String feeInFiatAsString; + if (optionalBtcFeeInFiat != null && optionalBtcFeeInFiat.isPresent()) { + feeInFiatAsString = btcFormatter.formatVolumeWithCode(optionalBtcFeeInFiat.get()); + } else { + feeInFiatAsString = Res.get("shared.na"); + } + + double amountAsLong = (double) dataModel.getAmount().get().value; + double makerFeeInBtcAsLong = (double) makerFeeInBtc.value; + double percent = makerFeeInBtcAsLong / amountAsLong; + + tradeFeeInBsqWithFiat.set(Res.get("createOffer.tradeFee.fiatAndPercent", + feeInFiatAsString, + btcFormatter.formatToPercentWithSymbol(percent))); + } } tradeFeeCurrencyCode.set(dataModel.isCurrencyForMakerFeeBtc() ? Res.getBaseCurrencyCode() : "BSQ"); tradeFeeDescription.set(DevEnv.isDaoActivated() ? Res.get("createOffer.tradeFee.descriptionBSQEnabled") :