Fix bugs with dispute msg, fix styles

This commit is contained in:
Manfred Karrer 2016-02-15 12:03:26 +01:00
parent 2049e384dc
commit 54a0fe9cc0
14 changed files with 82 additions and 42 deletions

View file

@ -166,6 +166,8 @@ public class DisputeManager {
onDisputeResultMessage((DisputeResultMessage) message); onDisputeResultMessage((DisputeResultMessage) message);
else if (message instanceof PeerPublishedPayoutTxMessage) else if (message instanceof PeerPublishedPayoutTxMessage)
onDisputedPayoutTxMessage((PeerPublishedPayoutTxMessage) message); onDisputedPayoutTxMessage((PeerPublishedPayoutTxMessage) message);
else
log.warn("Unsupported message at dispatchMessage.\nmessage=" + message);
} }
public void sendOpenNewDisputeMessage(Dispute dispute) { public void sendOpenNewDisputeMessage(Dispute dispute) {

View file

@ -860,7 +860,7 @@ textfield */
-fx-text-fill: #3c3c3c; -fx-text-fill: #3c3c3c;
-fx-background-color: linear-gradient(to bottom, #fcfcfc, #e5e5e5); -fx-background-color: linear-gradient(to bottom, #fcfcfc, #e5e5e5);
-fx-background-radius: 5 5 5 5; -fx-background-radius: 5 5 5 5;
-fx-background-insets: 10; -fx-background-insets: 5 5 20 20;
-fx-effect: dropshadow(gaussian, #434343, 10, 0, 0, 0); -fx-effect: dropshadow(gaussian, #000000, 15, 0, 2, 2);
} }

View file

@ -221,15 +221,6 @@ public class MainViewModel implements ViewModel {
} }
///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
void onSplashScreenRemoved() {
isSplashScreenRemoved.set(true);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Initialisation // Initialisation
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -419,13 +410,25 @@ public class MainViewModel implements ViewModel {
setupMarketPriceFeed(); setupMarketPriceFeed();
tacPopup.showIfNeeded(); tacPopup.showIfNeeded();
notificationCenter.onAllServicesInitialized();
// now show app
showAppScreen.set(true); showAppScreen.set(true);
} }
///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
// After showAppScreen is set and splash screen is faded out
void onSplashScreenRemoved() {
isSplashScreenRemoved.set(true);
// Delay that as we want to know what is the current path of the navigation which is set
// in MainView showAppScreen handler
notificationCenter.onAllServicesAndViewsInitialized();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// States // States
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -56,9 +56,11 @@ public class TransactionsListItem {
Coin valueSentToMe = transaction.getValueSentToMe(walletService.getWallet()); Coin valueSentToMe = transaction.getValueSentToMe(walletService.getWallet());
Coin valueSentFromMe = transaction.getValueSentFromMe(walletService.getWallet()); Coin valueSentFromMe = transaction.getValueSentFromMe(walletService.getWallet());
Coin amountAsCoin;
Address address = null; Address address = null;
if (valueSentToMe.isZero()) { if (valueSentToMe.isZero()) {
amount.set("-" + formatter.formatCoin(valueSentFromMe)); amountAsCoin = valueSentFromMe;
amount.set("-" + formatter.formatCoin(amountAsCoin));
for (TransactionOutput transactionOutput : transaction.getOutputs()) { for (TransactionOutput transactionOutput : transaction.getOutputs()) {
if (!transactionOutput.isMine(walletService.getWallet())) { if (!transactionOutput.isMine(walletService.getWallet())) {
@ -72,7 +74,8 @@ public class TransactionsListItem {
} }
} }
} else if (valueSentFromMe.isZero()) { } else if (valueSentFromMe.isZero()) {
amount.set(formatter.formatCoin(valueSentToMe)); amountAsCoin = valueSentToMe;
amount.set(formatter.formatCoin(amountAsCoin));
direction = "Received with:"; direction = "Received with:";
received = true; received = true;
@ -86,7 +89,8 @@ public class TransactionsListItem {
} }
} }
} else { } else {
amount.set(formatter.formatCoin(valueSentToMe.subtract(valueSentFromMe))); amountAsCoin = valueSentToMe.subtract(valueSentFromMe);
amount.set(formatter.formatCoin(amountAsCoin));
boolean outgoing = false; boolean outgoing = false;
for (TransactionOutput transactionOutput : transaction.getOutputs()) { for (TransactionOutput transactionOutput : transaction.getOutputs()) {
if (!transactionOutput.isMine(walletService.getWallet())) { if (!transactionOutput.isMine(walletService.getWallet())) {
@ -126,7 +130,10 @@ public class TransactionsListItem {
trade.getPayoutTx().getHashAsString().equals(txId)) { trade.getPayoutTx().getHashAsString().equals(txId)) {
details = "MultiSig payout: " + tradable.getShortId(); details = "MultiSig payout: " + tradable.getShortId();
} else if (trade.getDisputeState() == Trade.DisputeState.DISPUTE_CLOSED) { } else if (trade.getDisputeState() == Trade.DisputeState.DISPUTE_CLOSED) {
details = "Payout after dispute: " + tradable.getShortId(); if (valueSentToMe.isPositive())
details = "Refund from dispute: " + tradable.getShortId();
else
details = "Nothing refunded from dispute: " + tradable.getShortId();
} else { } else {
details = "Unknown reason: " + tradable.getShortId(); details = "Unknown reason: " + tradable.getShortId();
} }
@ -139,7 +146,15 @@ public class TransactionsListItem {
addressEntryOptional.get().getContext() == AddressEntry.Context.ARBITRATOR) addressEntryOptional.get().getContext() == AddressEntry.Context.ARBITRATOR)
details = received ? "Received funds" : "Withdrawn from wallet"; details = received ? "Received funds" : "Withdrawn from wallet";
else*/ else*/
details = received ? "Received funds" : "Withdrawn from wallet"; if (amountAsCoin.isZero()) {
details = "No refund from dispute";
} else {
details = received ? "Received funds" : "Withdrawn from wallet";
}
if (received)
details = amountAsCoin.isPositive() ? "Received funds" : "No refund from dispute";
else
details = amountAsCoin.isNegative() ? "Withdrawn from wallet" : "No refund from dispute";
} }
date.set(formatter.formatDateTime(transaction.getUpdateTime())); date.set(formatter.formatDateTime(transaction.getUpdateTime()));

View file

@ -168,11 +168,11 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
Stream<Tradable> concat1 = Stream.concat(openOfferManager.getOpenOffers().stream(), tradeManager.getTrades().stream()); Stream<Tradable> concat1 = Stream.concat(openOfferManager.getOpenOffers().stream(), tradeManager.getTrades().stream());
Stream<Tradable> concat2 = Stream.concat(concat1, closedTradableManager.getClosedTrades().stream()); Stream<Tradable> concat2 = Stream.concat(concat1, closedTradableManager.getClosedTrades().stream());
Stream<Tradable> concat3 = Stream.concat(concat2, failedTradesManager.getFailedTrades().stream()); Stream<Tradable> concat3 = Stream.concat(concat2, failedTradesManager.getFailedTrades().stream());
Set<Tradable> concated = concat3.collect(Collectors.toSet()); Set<Tradable> all = concat3.collect(Collectors.toSet());
List<TransactionsListItem> listItems = walletService.getWallet().getRecentTransactions(1000, true).stream() List<TransactionsListItem> listItems = walletService.getWallet().getRecentTransactions(1000, true).stream()
.map(transaction -> { .map(transaction -> {
Optional<Tradable> tradableOptional = concated.stream() Optional<Tradable> tradableOptional = all.stream()
.filter(e -> { .filter(e -> {
String txId = transaction.getHashAsString(); String txId = transaction.getHashAsString();
if (e instanceof OpenOffer) if (e instanceof OpenOffer)

View file

@ -21,7 +21,7 @@ public class Notification extends Popup {
private boolean hasBeenDisplayed; private boolean hasBeenDisplayed;
public Notification() { public Notification() {
width = 320; width = 345; // 320 visible bg because of insets
NotificationCenter.add(this); NotificationCenter.add(this);
} }
@ -123,7 +123,7 @@ public class Notification extends Popup {
@Override @Override
protected void createGridPane() { protected void createGridPane() {
super.createGridPane(); super.createGridPane();
gridPane.setPadding(new Insets(20, 20, 20, 20)); gridPane.setPadding(new Insets(15, 15, 30, 30));
} }
@Override @Override

View file

@ -6,6 +6,8 @@ import io.bitsquare.arbitration.DisputeManager;
import io.bitsquare.common.UserThread; import io.bitsquare.common.UserThread;
import io.bitsquare.gui.Navigation; import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.MainView;
import io.bitsquare.gui.main.disputes.DisputesView;
import io.bitsquare.gui.main.disputes.trader.TraderDisputeView;
import io.bitsquare.gui.main.portfolio.PortfolioView; import io.bitsquare.gui.main.portfolio.PortfolioView;
import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView; import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView;
import io.bitsquare.trade.Trade; import io.bitsquare.trade.Trade;
@ -71,7 +73,7 @@ public class NotificationCenter {
EasyBind.subscribe(preferences.useAnimationsProperty(), useAnimations -> NotificationCenter.useAnimations = useAnimations); EasyBind.subscribe(preferences.useAnimationsProperty(), useAnimations -> NotificationCenter.useAnimations = useAnimations);
} }
public void onAllServicesInitialized() { public void onAllServicesAndViewsInitialized() {
tradeManager.getTrades().addListener((ListChangeListener<Trade>) change -> { tradeManager.getTrades().addListener((ListChangeListener<Trade>) change -> {
change.next(); change.next();
if (change.wasRemoved()) { if (change.wasRemoved()) {
@ -200,27 +202,31 @@ public class NotificationCenter {
private void onDisputeStateChanged(Trade trade, Trade.DisputeState disputeState) { private void onDisputeStateChanged(Trade trade, Trade.DisputeState disputeState) {
Log.traceCall(disputeState.toString()); Log.traceCall(disputeState.toString());
String message = null; String message = null;
switch (disputeState) { if (disputeManager.findOwnDispute(trade.getId()).isPresent()) {
case NONE: boolean supportTicket = disputeManager.findOwnDispute(trade.getId()).get().isSupportTicket();
break; switch (disputeState) {
case DISPUTE_REQUESTED: case NONE:
break; break;
case DISPUTE_STARTED_BY_PEER: case DISPUTE_REQUESTED:
if (disputeManager.findOwnDispute(trade.getId()).isPresent()) { break;
if (disputeManager.findOwnDispute(trade.getId()).get().isSupportTicket()) case DISPUTE_STARTED_BY_PEER:
message = "Your trading peer has encountered technical problems and requested support for trade with ID " + trade.getShortId() + ".\n" + message = supportTicket ? "Your trading peer has opened a support ticket." : "Your trading peer has requested a dispute.";
"Please await further instructions from the arbitrator.\n" + break;
"Your funds are safe and will be refunded as soon the problem is resolved."; case DISPUTE_CLOSED:
else message = supportTicket ? "The support ticket hase been closed." : "The dispute has been closed.";
message = "Your trading peer has requested a dispute for trade with ID " + trade.getShortId() + "."; break;
}
if (message != null) {
Notification notification = new Notification().disputeHeadLine(trade.getShortId()).message(message);
if (navigation.getCurrentPath() != null && !navigation.getCurrentPath().contains(TraderDisputeView.class)) {
notification.actionButtonText("Go to \"Support\"")
.onAction(() -> navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class))
.show();
} else {
notification.show();
} }
break; }
case DISPUTE_CLOSED:
message = "A support ticket for trade with ID " + trade.getShortId() + " has been closed.";
break;
} }
if (message != null)
new Notification().tradeHeadLine(trade.getShortId()).message(message).show();
} }
} }

View file

@ -52,7 +52,9 @@ public class DisplayAlertMessagePopup extends Popup {
headLine = "Important information!"; headLine = "Important information!";
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addContent(); addContent();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }

View file

@ -71,7 +71,9 @@ public class EmptyWalletPopup extends Popup {
width = 700; width = 700;
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addContent(); addContent();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }

View file

@ -64,8 +64,10 @@ public class EnterPrivKeyPopup extends Popup {
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addInputFields(); addInputFields();
addButtons(); addButtons();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }

View file

@ -49,7 +49,9 @@ public class OpenEmergencyTicketPopup extends Popup {
width = 700; width = 700;
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addContent(); addContent();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }

View file

@ -58,8 +58,10 @@ public class SelectDepositTxPopup extends Popup {
width = 700; width = 700;
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addContent(); addContent();
addCloseButton(); addCloseButton();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }

View file

@ -68,7 +68,9 @@ public class SendAlertMessagePopup extends Popup {
width = 600; width = 600;
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addContent(); addContent();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }

View file

@ -83,8 +83,10 @@ public class WalletPasswordPopup extends Popup {
createGridPane(); createGridPane();
addHeadLine(); addHeadLine();
addSeparator();
addInputFields(); addInputFields();
addButtons(); addButtons();
applyStyles();
PopupManager.queueForDisplay(this); PopupManager.queueForDisplay(this);
} }