Merge pull request #6241 from jmacxx/buyer_start_payment_gui

Start payment screen reftext message & sizing fixes.
This commit is contained in:
Christoph Atteneder 2022-06-09 10:08:52 +02:00 committed by GitHub
commit 6fdd47917f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 52 additions and 6 deletions

View File

@ -73,6 +73,9 @@ public abstract class AssetsAccountPayload extends PaymentAccountPayload {
return getPaymentDetails();
}
@Override
public boolean showRefTextWarning() { return false; }
@Override
public byte[] getAgeWitnessInputData() {
return super.getAgeWitnessInputData(address.getBytes(StandardCharsets.UTF_8));

View File

@ -106,6 +106,9 @@ public final class CashByMailAccountPayload extends PaymentAccountPayload implem
Res.getWithCol("payment.postal.address") + " " + postalAddress;
}
@Override
public boolean showRefTextWarning() { return false; }
@Override
public byte[] getAgeWitnessInputData() {
// We use here the contact because the address alone seems to be too weak

View File

@ -118,6 +118,9 @@ public final class F2FAccountPayload extends CountryBasedPaymentAccountPayload {
return Res.getWithCol("payment.f2f.contact") + " " + contact;
}
@Override
public boolean showRefTextWarning() { return false; }
@Override
public byte[] getAgeWitnessInputData() {
// We use here the city because the address alone seems to be too weak

View File

@ -91,6 +91,9 @@ public final class HalCashAccountPayload extends PaymentAccountPayload {
return Res.getWithCol("payment.mobile") + " " + mobileNr;
}
@Override
public boolean showRefTextWarning() { return false; }
@Override
public byte[] getAgeWitnessInputData() {
return super.getAgeWitnessInputData(mobileNr.getBytes(StandardCharsets.UTF_8));

View File

@ -118,6 +118,9 @@ public class MoneyGramAccountPayload extends PaymentAccountPayload implements Pa
Res.getWithCol("payment.email") + " " + email;
}
@Override
public boolean showRefTextWarning() { return false; }
@Override
public byte[] getAgeWitnessInputData() {
String all = this.countryCode +

View File

@ -118,6 +118,8 @@ public abstract class PaymentAccountPayload implements NetworkPayload, UsedForTr
public abstract String getPaymentDetailsForTradePopup();
public boolean showRefTextWarning() { return true; }
public byte[] getSalt() {
checkArgument(excludeFromJsonDataMap.containsKey(SALT), "Salt must have been set in excludeFromJsonDataMap.");
return Utilities.decodeFromHex(excludeFromJsonDataMap.get(SALT));

View File

@ -126,6 +126,9 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
Res.getWithCol("payment.email") + " " + email;
}
@Override
public boolean showRefTextWarning() { return false; }
@Override
public byte[] getAgeWitnessInputData() {
String all = this.countryCode +

View File

@ -53,11 +53,13 @@ public class CashByMailForm extends PaymentMethodForm {
TextArea textAddress = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.postal.address"), "").second;
textAddress.setMinHeight(70);
textAddress.setMaxHeight(70);
textAddress.setEditable(false);
textAddress.setText(cbm.getPostalAddress());
TextArea textExtraInfo = addCompactTopLabelTextArea(gridPane, gridRow, 1, Res.get("payment.shared.extraInfo"), "").second;
textExtraInfo.setMinHeight(70);
textExtraInfo.setMaxHeight(70);
textExtraInfo.setEditable(false);
textExtraInfo.setText(cbm.getExtraInfo());
return gridRow;

View File

@ -63,6 +63,7 @@ public class F2FForm extends PaymentMethodForm {
f2fAccountPayload.getContact());
TextArea textArea = addTopLabelTextArea(gridPane, gridRow, 1, Res.get("payment.shared.extraInfo"), "").second;
textArea.setMinHeight(70);
textArea.setMaxHeight(70);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(offer.getExtraInfo());

View File

@ -70,6 +70,7 @@ public abstract class GeneralUsBankForm extends GeneralBankForm {
TextArea textAddress = addCompactTopLabelTextArea(gridPane, getIndexOfColumn(colIndex) == 0 ? ++gridRow : gridRow, getIndexOfColumn(colIndex++),
Res.get("payment.account.address"), "").second;
textAddress.setMinHeight(70);
textAddress.setMaxHeight(70);
textAddress.setEditable(false);
textAddress.setText(holderAddress);
}

View File

@ -57,6 +57,7 @@ public class TransferwiseUsdForm extends PaymentMethodForm {
if (address.length() > 0) {
TextArea textAddress = addCompactTopLabelTextArea(gridPane, gridRow, 0, Res.get("payment.account.address"), "").second;
textAddress.setMinHeight(70);
textAddress.setMaxHeight(70);
textAddress.setEditable(false);
textAddress.setText(address);
}

View File

@ -47,6 +47,7 @@ public class USPostalMoneyOrderForm extends PaymentMethodForm {
((USPostalMoneyOrderAccountPayload) paymentAccountPayload).getHolderName());
TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.postal.address"), "").second;
textArea.setMinHeight(70);
textArea.setMaxHeight(70);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(((USPostalMoneyOrderAccountPayload) paymentAccountPayload).getPostalAddress());

View File

@ -206,6 +206,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.openTrades"))));
tableView.setMinHeight(100);
tableView.setMaxHeight(350);
tradeIdColumn.setComparator(Comparator.comparing(o -> o.getTrade().getId()));
dateColumn.setComparator(Comparator.comparing(o -> o.getTrade().getDate()));
@ -305,7 +306,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
selectedSubView = model.dataModel.tradeManager.isBuyer(model.dataModel.getOffer()) ?
new BuyerSubView(model) : new SellerSubView(model);
selectedSubView.setMinHeight(460);
selectedSubView.setMinHeight(480);
VBox.setVgrow(selectedSubView, Priority.ALWAYS);
if (root.getChildren().size() == 2)
root.getChildren().add(selectedSubView);

View File

@ -19,6 +19,7 @@ package bisq.desktop.main.portfolio.pendingtrades.steps.buyer;
import bisq.desktop.components.AutoTooltipButton;
import bisq.desktop.components.BusyAnimation;
import bisq.desktop.components.SimpleMarkdownLabel;
import bisq.desktop.components.TextFieldWithCopyIcon;
import bisq.desktop.components.TitledGroupBg;
import bisq.desktop.components.paymentmethods.AchTransferForm;
@ -81,6 +82,7 @@ import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.SetXmrTxKeyWindow;
import bisq.desktop.main.portfolio.pendingtrades.PendingTradesViewModel;
import bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView;
import bisq.desktop.util.GUIUtil;
import bisq.desktop.util.Layout;
import bisq.desktop.util.Transitions;
@ -125,10 +127,7 @@ import org.fxmisc.easybind.Subscription;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static bisq.desktop.util.FormBuilder.addButtonBusyAnimationLabel;
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon;
import static bisq.desktop.util.FormBuilder.*;
import static com.google.common.base.Preconditions.checkNotNull;
public class BuyerStep2View extends TradeStepView {
@ -240,11 +239,15 @@ public class BuyerStep2View extends TradeStepView {
addTradeInfoBlock();
int rowSpanStart = gridRow;
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : "";
TitledGroupBg accountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 4,
Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodId)),
Layout.COMPACT_GROUP_DISTANCE);
GridPane.setColumnSpan(accountTitledGroupBg, 2);
TextFieldWithCopyIcon field = addTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 0,
Res.get("portfolio.pending.step2_buyer.amountToTransfer"),
model.getFiatVolume(),
@ -435,7 +438,13 @@ public class BuyerStep2View extends TradeStepView {
}
}
GridPane.setRowSpan(accountTitledGroupBg, gridRow - 1);
if (paymentAccountPayload.showRefTextWarning()) {
SimpleMarkdownLabel footerLabel = addSimpleMarkdownLabel(gridPane, ++gridRow, Res.get("portfolio.pending.step2_buyer.refTextWarn"), 10);
footerLabel.getStyleClass().add("medium-text");
GridPane.setColumnSpan(footerLabel, 2);
}
GridPane.setRowSpan(accountTitledGroupBg, gridRow - rowSpanStart);
Tuple4<Button, BusyAnimation, Label, HBox> tuple3 = addButtonBusyAnimationLabel(gridPane, ++gridRow, 0,
Res.get("portfolio.pending.step2_buyer.paymentStarted"), 10);
@ -447,6 +456,11 @@ public class BuyerStep2View extends TradeStepView {
busyAnimation = tuple3.second;
statusLabel = tuple3.third;
// fix GH issue 6238 - on small res screen, the payment started button cannot be reached
if (GUIUtil.isLimitedScreenHeight()) {
gridPane.setMinHeight(600); // make the scrollpane parent node activate its scrollbar
}
if (trade.getOffer().getCurrencyCode().equals("BSQ")) {
fillBsqButton = new AutoTooltipButton(Res.get("portfolio.pending.step2_buyer.fillInBsqWallet"));
hBox.getChildren().add(1, fillBsqButton);

View File

@ -97,6 +97,7 @@ import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
@ -1257,4 +1258,8 @@ public class GUIUtil {
}
TOP_ALTCOIN = tradeCurrency;
}
public static boolean isLimitedScreenHeight() {
return Screen.getPrimary().getVisualBounds().getHeight() < 800;
}
}