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

Only show approval icon for signer accounts #3552

Merged
merged 1 commit into from
Nov 6, 2019
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 @@ -23,6 +23,7 @@
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.DisplayUtils;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.GUIUtil;
import bisq.desktop.util.Layout;

import bisq.core.account.witness.AccountAgeWitness;
Expand Down Expand Up @@ -220,19 +221,12 @@ else if (!paymentAccount.getTradeCurrencies().isEmpty())
Res.get("offerbook.timeSinceSigning.daysSinceSigning",
daysSinceSigning));

switch (signState) {
case PEER_SIGNER:
case ARBITRATOR:
icon = MaterialDesignIcon.APPROVAL;
accountSigningStateText += " / " + timeSinceSigning;
break;
case PEER_INITIAL:
case PEER_LIMIT_LIFTED:
accountSigningStateText += " / " + timeSinceSigning;
default:
icon = MaterialDesignIcon.ALERT_CIRCLE_OUTLINE;
if (!signState.equals(AccountAgeWitnessService.SignState.UNSIGNED)) {
accountSigningStateText += " / " + timeSinceSigning;
}

icon = GUIUtil.getIconForSignState(signState);

InfoTextField accountSigningField = addCompactTopLabelInfoTextField(gridPane, ++gridRow, Res.get("shared.accountSigningState"),
accountSigningStateText).second;
//TODO: add additional information regarding account signing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import bisq.desktop.components.AutoTooltipLabel;
import bisq.desktop.components.InfoAutoTooltipLabel;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.GUIUtil;
import bisq.desktop.util.ImageUtil;

import bisq.core.account.sign.SignedWitnessService;
Expand All @@ -18,8 +19,6 @@

import org.apache.commons.lang3.StringUtils;

import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;

import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
Expand Down Expand Up @@ -126,15 +125,7 @@ public void updateItem(final PaymentAccount item, boolean empty) {
item.paymentAccountPayload));

String info = StringUtils.capitalize(signState.getPresentation());

switch (signState) {
case PEER_SIGNER:
case ARBITRATOR:
label.setIcon(MaterialDesignIcon.APPROVAL, info);
break;
default:
label.setIcon(MaterialDesignIcon.ALERT_CIRCLE_OUTLINE, info);
}
label.setIcon(GUIUtil.getIconForSignState(signState), info);
} else {
label.hideIcon();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,10 @@ public void updateItem(final OfferBookListItem item, boolean empty) {
String timeSinceSigning;

if (accountAgeWitnessService.hasSignedWitness(item.getOffer())) {
icon = MaterialDesignIcon.APPROVAL;
AccountAgeWitnessService.SignState signState = accountAgeWitnessService.getSignState(item.getOffer());
icon = GUIUtil.getIconForSignState(signState);
info = Res.get("offerbook.timeSinceSigning.info",
accountAgeWitnessService.getSignState(item.getOffer()).getPresentation());
signState.getPresentation());
long daysSinceSigning = TimeUnit.MILLISECONDS.toDays(
accountAgeWitnessService.getWitnessSignAge(item.getOffer(), new Date()));
timeSinceSigning = Res.get("offerbook.timeSinceSigning.daysSinceSigning",
Expand All @@ -1095,10 +1096,10 @@ public void updateItem(final OfferBookListItem item, boolean empty) {
boolean needsSigning = PaymentMethod.hasChargebackRisk(
item.getOffer().getPaymentMethod(), item.getOffer().getCurrencyCode());
if (needsSigning) {
icon = MaterialDesignIcon.ALERT_CIRCLE_OUTLINE;

AccountAgeWitnessService.SignState signState = accountAgeWitnessService.getSignState(item.getOffer());

icon = GUIUtil.getIconForSignState(signState);

if (!signState.equals(AccountAgeWitnessService.SignState.UNSIGNED)) {
info = Res.get("offerbook.timeSinceSigning.info", signState.getPresentation());
long daysSinceSigning = TimeUnit.MILLISECONDS.toDays(
Expand Down
6 changes: 6 additions & 0 deletions desktop/src/main/java/bisq/desktop/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1098,4 +1098,10 @@ public static String getBsqInUsd(Price bsqPrice,
Volume volumeByAmount = usdPrice.getVolumeByAmount(requiredBtc);
return DisplayUtils.formatVolumeWithCode(volumeByAmount);
}

public static MaterialDesignIcon getIconForSignState(AccountAgeWitnessService.SignState state) {
return (state.equals(AccountAgeWitnessService.SignState.ARBITRATOR) ||
state.equals(AccountAgeWitnessService.SignState.PEER_SIGNER)) ?
MaterialDesignIcon.APPROVAL : MaterialDesignIcon.ALERT_CIRCLE_OUTLINE;
}
}