add lock symbol when confirming private offers

This commit is contained in:
woodser 2025-04-13 12:03:04 -04:00 committed by GitHub
parent 57c2408d07
commit f1c09161f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 92 additions and 59 deletions

View file

@ -211,7 +211,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
xmrDirectionInfo = direction == OfferDirection.SELL ? toReceive : toSpend;
} else if (placeOfferHandlerOptional.isPresent()) {
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
DisplayUtils.getOfferDirectionForCreateOffer(direction, currencyCode), firstRowDistance);
DisplayUtils.getOfferDirectionForCreateOffer(direction, currencyCode, offer.isPrivateOffer()), firstRowDistance);
counterCurrencyDirectionInfo = direction == OfferDirection.SELL ? toReceive : toSpend;
xmrDirectionInfo = direction == OfferDirection.BUY ? toReceive : toSpend;
} else {

View file

@ -34,6 +34,7 @@ import java.util.Optional;
@Slf4j
public class DisplayUtils {
private static final int SCALE = 3;
private static final String LOCKED = ".locked";
public static String formatDateTime(Date date) {
return FormattingUtils.formatDateTime(date, true);
@ -118,16 +119,16 @@ public class DisplayUtils {
public static String getDirectionWithCode(OfferDirection direction, String currencyCode, boolean isPrivate) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode))
return (direction == OfferDirection.BUY) ? Res.get(isPrivate ? "shared.buyCurrencyLocked" : "shared.buyCurrency", Res.getBaseCurrencyCode()) : Res.get(isPrivate ? "shared.sellCurrencyLocked" : "shared.sellCurrency", Res.getBaseCurrencyCode());
return (direction == OfferDirection.BUY) ? Res.get("shared.buyCurrency" + (isPrivate ? LOCKED : ""), Res.getBaseCurrencyCode()) : Res.get("shared.sellCurrency" + (isPrivate ? LOCKED : ""), Res.getBaseCurrencyCode());
else
return (direction == OfferDirection.SELL) ? Res.get(isPrivate ? "shared.buyCurrencyLocked" : "shared.buyCurrency", currencyCode) : Res.get(isPrivate ? "shared.sellCurrencyLocked" : "shared.sellCurrency", currencyCode);
return (direction == OfferDirection.SELL) ? Res.get("shared.buyCurrency" + (isPrivate ? LOCKED : ""), currencyCode) : Res.get("shared.sellCurrency" + (isPrivate ? LOCKED : ""), currencyCode);
}
public static String getDirectionBothSides(OfferDirection direction, boolean isLocked) {
public static String getDirectionBothSides(OfferDirection direction, boolean isPrivate) {
String currencyCode = Res.getBaseCurrencyCode();
return direction == OfferDirection.BUY ?
Res.get(isLocked ? "formatter.makerTakerLocked" : "formatter.makerTaker", currencyCode, Res.get("shared.buyer"), currencyCode, Res.get("shared.seller")) :
Res.get(isLocked ? "formatter.makerTakerLocked" : "formatter.makerTaker", currencyCode, Res.get("shared.seller"), currencyCode, Res.get("shared.buyer"));
Res.get("formatter.makerTaker" + (isPrivate ? LOCKED : ""), currencyCode, Res.get("shared.buyer"), currencyCode, Res.get("shared.seller")) :
Res.get("formatter.makerTaker" + (isPrivate ? LOCKED : ""), currencyCode, Res.get("shared.seller"), currencyCode, Res.get("shared.buyer"));
}
public static String getDirectionForBuyer(boolean isMyOffer, String currencyCode) {
@ -170,16 +171,16 @@ public class DisplayUtils {
}
}
public static String getOfferDirectionForCreateOffer(OfferDirection direction, String currencyCode) {
public static String getOfferDirectionForCreateOffer(OfferDirection direction, String currencyCode, boolean isPrivate) {
String baseCurrencyCode = Res.getBaseCurrencyCode();
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
return direction == OfferDirection.BUY ?
Res.get("formatter.youAreCreatingAnOffer.traditional", Res.get("shared.buy"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.traditional", Res.get("shared.sell"), baseCurrencyCode);
Res.get("formatter.youAreCreatingAnOffer.traditional" + (isPrivate ? LOCKED : ""), Res.get("shared.buy"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.traditional" + (isPrivate ? LOCKED : ""), Res.get("shared.sell"), baseCurrencyCode);
} else {
return direction == OfferDirection.SELL ?
Res.get("formatter.youAreCreatingAnOffer.crypto", Res.get("shared.buy"), currencyCode, Res.get("shared.selling"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.crypto", Res.get("shared.sell"), currencyCode, Res.get("shared.buying"), baseCurrencyCode);
Res.get("formatter.youAreCreatingAnOffer.crypto" + (isPrivate ? LOCKED : ""), Res.get("shared.buy"), currencyCode, Res.get("shared.selling"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.crypto" + (isPrivate ? LOCKED : ""), Res.get("shared.sell"), currencyCode, Res.get("shared.buying"), baseCurrencyCode);
}
}