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

Start payment screen reftext message & sizing fixes. #6241

Merged
merged 1 commit into from Jun 9, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public String getPaymentDetailsForTradePopup() {
return getPaymentDetails();
}

@Override
public boolean showRefTextWarning() { return false; }

@Override
public byte[] getAgeWitnessInputData() {
return super.getAgeWitnessInputData(address.getBytes(StandardCharsets.UTF_8));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public String getPaymentDetailsForTradePopup() {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public String getPaymentDetailsForTradePopup() {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public String getPaymentDetailsForTradePopup() {
return Res.getWithCol("payment.mobile") + " " + mobileNr;
}

@Override
public boolean showRefTextWarning() { return false; }

@Override
public byte[] getAgeWitnessInputData() {
return super.getAgeWitnessInputData(mobileNr.getBytes(StandardCharsets.UTF_8));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public String getPaymentDetailsForTradePopup() {
Res.getWithCol("payment.email") + " " + email;
}

@Override
public boolean showRefTextWarning() { return false; }

@Override
public byte[] getAgeWitnessInputData() {
String all = this.countryCode +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ protected protobuf.PaymentAccountPayload.Builder getPaymentAccountPayloadBuilder

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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public String getPaymentDetailsForTradePopup() {
Res.getWithCol("payment.email") + " " + email;
}

@Override
public boolean showRefTextWarning() { return false; }

@Override
public byte[] getAgeWitnessInputData() {
String all = this.countryCode +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow,

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow,
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ protected static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAcco
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow,
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow,
((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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public void initialize() {
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()));
Expand Down Expand Up @@ -305,7 +306,7 @@ protected void activate() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

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;
Expand Down Expand Up @@ -80,6 +81,7 @@
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;

Expand Down Expand Up @@ -124,10 +126,7 @@
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 {
Expand Down Expand Up @@ -239,11 +238,15 @@ protected void addContent() {

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(),
Expand Down Expand Up @@ -431,7 +434,13 @@ protected void addContent() {
}
}

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);
Expand All @@ -443,6 +452,11 @@ protected void addContent() {
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);
Expand Down
5 changes: 5 additions & 0 deletions desktop/src/main/java/bisq/desktop/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

Expand Down Expand Up @@ -1257,4 +1258,8 @@ public static void updateTopAltcoin(Preferences preferences) {
}
TOP_ALTCOIN = tradeCurrency;
}

public static boolean isLimitedScreenHeight() {
return Screen.getPrimary().getVisualBounds().getHeight() < 800;
}
}