mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-24 22:39:23 -04:00
Add fee check to take offer, display spinner and txt, cleanup eventhandlers, hide support tickets tab for arbitr. if not arbitr.
This commit is contained in:
parent
eefafab977
commit
2d7aecd2ed
41 changed files with 583 additions and 286 deletions
|
@ -284,27 +284,24 @@ public class WalletService {
|
|||
// Listener
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public AddressConfidenceListener addAddressConfidenceListener(AddressConfidenceListener listener) {
|
||||
public void addAddressConfidenceListener(AddressConfidenceListener listener) {
|
||||
addressConfidenceListeners.add(listener);
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void removeAddressConfidenceListener(AddressConfidenceListener listener) {
|
||||
addressConfidenceListeners.remove(listener);
|
||||
}
|
||||
|
||||
public TxConfidenceListener addTxConfidenceListener(TxConfidenceListener listener) {
|
||||
public void addTxConfidenceListener(TxConfidenceListener listener) {
|
||||
txConfidenceListeners.add(listener);
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void removeTxConfidenceListener(TxConfidenceListener listener) {
|
||||
txConfidenceListeners.remove(listener);
|
||||
}
|
||||
|
||||
public BalanceListener addBalanceListener(BalanceListener listener) {
|
||||
public void addBalanceListener(BalanceListener listener) {
|
||||
balanceListeners.add(listener);
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void removeBalanceListener(BalanceListener listener) {
|
||||
|
@ -667,12 +664,12 @@ public class WalletService {
|
|||
private class BitsquareWalletEventListener extends AbstractWalletEventListener {
|
||||
@Override
|
||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
notifyBalanceListeners();
|
||||
notifyBalanceListeners(tx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
notifyBalanceListeners();
|
||||
notifyBalanceListeners(tx);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -691,7 +688,7 @@ public class WalletService {
|
|||
txConfidenceListener.onTransactionConfidenceChanged(tx.getConfidence()));
|
||||
}
|
||||
|
||||
private void notifyBalanceListeners() {
|
||||
private void notifyBalanceListeners(Transaction tx) {
|
||||
for (BalanceListener balanceListener : balanceListeners) {
|
||||
Coin balance;
|
||||
if (balanceListener.getAddress() != null)
|
||||
|
@ -699,7 +696,7 @@ public class WalletService {
|
|||
else
|
||||
balance = getAvailableBalance();
|
||||
|
||||
balanceListener.onBalanceChanged(balance);
|
||||
balanceListener.onBalanceChanged(balance, tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package io.bitsquare.btc.listeners;
|
|||
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
|
||||
public class BalanceListener {
|
||||
private Address address;
|
||||
|
@ -35,6 +36,6 @@ public class BalanceListener {
|
|||
}
|
||||
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
public void onBalanceChanged(Coin balance) {
|
||||
public void onBalanceChanged(Coin balance, Transaction tx) {
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import io.bitsquare.trade.Trade;
|
|||
import io.bitsquare.trade.protocol.trade.tasks.TradeTask;
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.fxmisc.easybind.EasyBind;
|
||||
import org.fxmisc.easybind.Subscription;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -51,12 +52,12 @@ public class SetupDepositBalanceListener extends TradeTask {
|
|||
|
||||
WalletService walletService = processModel.getWalletService();
|
||||
Address address = walletService.getAddressEntryByOfferId(trade.getId()).getAddress();
|
||||
balanceListener = walletService.addBalanceListener(new BalanceListener(address) {
|
||||
balanceListener = new BalanceListener(address) {
|
||||
@Override
|
||||
public void onBalanceChanged(Coin balance) {
|
||||
public void onBalanceChanged(Coin balance, Transaction tx) {
|
||||
updateBalance(balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
walletService.addBalanceListener(balanceListener);
|
||||
|
||||
tradeStateSubscription = EasyBind.subscribe(trade.stateProperty(), newValue -> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue