Add rocket icon to xmr offers which have enabled autoconf

Add info to tooltip and to offer window
Add center css to actions column. It looks weird that title is left aligned and button is centered.
only "last-column", "avatar-column" worked, making an new style e.g. center-column did not succeed... css is not my friend....
Shorten "Time since signing" to "Signed since" header to avoid truncation
This commit is contained in:
chimp1984 2020-09-29 00:45:31 -05:00
parent 7280fb822d
commit f46e132195
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
8 changed files with 46 additions and 6 deletions

View File

@ -504,6 +504,21 @@ public class Offer implements NetworkPayload, PersistablePayload {
return offerPayload.isUseReOpenAfterAutoClose();
}
public boolean isXmrAutoConf() {
if (!isXmr()) {
return false;
}
if (getExtraDataMap() == null || !getExtraDataMap().containsKey(OfferPayload.XMR_AUTO_CONF)) {
return false;
}
return getExtraDataMap().get(OfferPayload.XMR_AUTO_CONF).equals(OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE);
}
public boolean isXmr() {
return getCurrencyCode().equals("XMR");
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -87,6 +87,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
public static final String CAPABILITIES = "capabilities";
// If maker is seller and has xmrAutoConf enabled it is set to "1" otherwise it is not set
public static final String XMR_AUTO_CONF = "xmrAutoConf";
public static final String XMR_AUTO_CONF_ENABLED_VALUE = "1";
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -358,7 +358,7 @@ public class OfferUtil {
preferences.getAutoConfirmSettingsList().stream()
.filter(e -> e.getCurrencyCode().equals("XMR"))
.filter(AutoConfirmSettings::isEnabled)
.forEach(e -> extraDataMap.put(OfferPayload.XMR_AUTO_CONF, "1"));
.forEach(e -> extraDataMap.put(OfferPayload.XMR_AUTO_CONF, OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE));
}
return extraDataMap.isEmpty() ? null : extraDataMap;

View File

@ -338,7 +338,7 @@ offerbook.offerersAcceptedBankSeats=Accepted seat of bank countries (taker):\n {
offerbook.availableOffers=Available offers
offerbook.filterByCurrency=Filter by currency
offerbook.filterByPaymentMethod=Filter by payment method
offerbook.timeSinceSigning=Time since signing
offerbook.timeSinceSigning=Signed since
offerbook.timeSinceSigning.info=This account was verified and {0}
offerbook.timeSinceSigning.info.arbitrator=signed by an arbitrator and can sign peer accounts
offerbook.timeSinceSigning.info.peer=signed by a peer, waiting for limits to be lifted
@ -347,6 +347,7 @@ offerbook.timeSinceSigning.info.signer=signed by peer and can sign peer accounts
offerbook.timeSinceSigning.info.banned=account was banned
offerbook.timeSinceSigning.daysSinceSigning={0} days
offerbook.timeSinceSigning.daysSinceSigning.long={0} since signing
offerbook.xmrAutoConf=Is auto-confirm enabled
offerbook.timeSinceSigning.help=When you successfully complete a trade with a peer who has a signed payment account, your payment account is signed.\n\
{0} days later, the initial limit of {1} is lifted and your account can sign other peers'' payment accounts.

View File

@ -68,6 +68,7 @@ import org.bitcoinj.core.Coin;
import javax.inject.Inject;
import javax.inject.Named;
import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.GlyphIcons;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
@ -867,7 +868,11 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
if (model.isOfferBanned(item.getOffer())) {
setGraphic(new AutoTooltipLabel(model.getPaymentMethod(item)));
} else {
field = new HyperlinkWithIcon(model.getPaymentMethod(item));
if (item.getOffer().isXmrAutoConf()) {
field = new HyperlinkWithIcon(model.getPaymentMethod(item), AwesomeIcon.ROCKET);
} else {
field = new HyperlinkWithIcon(model.getPaymentMethod(item));
}
field.setOnAction(event -> offerDetailsWindow.show(item.getOffer()));
field.setTooltip(new Tooltip(model.getPaymentMethodToolTip(item)));
setGraphic(field);
@ -937,6 +942,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
setSortable(false);
}
};
column.getStyleClass().addAll("last-column", "avatar-column");
column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
column.setCellFactory(
new Callback<>() {

View File

@ -433,6 +433,13 @@ class OfferBookViewModel extends ActivatableViewModel {
result = Res.getWithCol("shared.paymentMethod") + " " + Res.get(offer.getPaymentMethod().getId());
result += "\n" + Res.getWithCol("shared.currency") + " " + CurrencyUtil.getNameAndCode(offer.getCurrencyCode());
if (offer.isXmr()) {
String isAutoConf = offer.isXmrAutoConf() ?
Res.get("shared.yes") :
Res.get("shared.no");
result += "\n" + Res.getWithCol("offerbook.xmrAutoConf") + " " + isAutoConf;
}
String countryCode = offer.getCountryCode();
if (isF2F(offer)) {
if (countryCode != null) {

View File

@ -87,7 +87,9 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, User user, KeyRing keyRing,
public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
User user,
KeyRing keyRing,
Navigation navigation) {
this.formatter = formatter;
this.user = user;
@ -148,7 +150,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
private void addContent() {
gridPane.getColumnConstraints().get(0).setMinWidth(224);
int rows = 5;
int rows = 6;
List<String> acceptedBanks = offer.getAcceptedBankIds();
boolean showAcceptedBanks = acceptedBanks != null && !acceptedBanks.isEmpty();
List<String> acceptedCountryCodes = offer.getAcceptedCountryCodes();
@ -255,6 +257,14 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), method);
}
}
if (offer.isXmr()) {
String isAutoConf = offer.isXmrAutoConf() ?
Res.get("shared.yes") :
Res.get("shared.no");
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerbook.xmrAutoConf"), isAutoConf);
}
if (showAcceptedBanks) {
if (paymentMethod.equals(PaymentMethod.SAME_BANK)) {
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.bankId"), acceptedBanks.get(0));

View File

@ -235,7 +235,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradingPeersOnion"),
trade.getTradingPeerNodeAddress().getFullAddress());
if (checkNotNull(trade.getOffer()).getCurrencyCode().equals("XMR") &&
if (checkNotNull(trade.getOffer()).isXmr() &&
trade.getAssetTxProofResult() != null &&
trade.getAssetTxProofResult() != AssetTxProofResult.UNDEFINED) {
// As the window is already overloaded we replace the tradingPeersPubKeyHash field with the auto-conf state