mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
REF: send/receive btns
This commit is contained in:
parent
8fbd2c6ad1
commit
a5862cb76e
@ -30,6 +30,14 @@ export class AbstractWallet {
|
||||
return this.balance;
|
||||
}
|
||||
|
||||
allowReceive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
allowSend() {
|
||||
return this.getBalance() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns delta of unconfirmed balance. For example, if theres no
|
||||
* unconfirmed balance its 0
|
||||
|
@ -79,11 +79,20 @@ export default class WalletsList extends Component {
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
let showSend = false;
|
||||
let showReceive = false;
|
||||
let wallets = BlueApp.getWallets();
|
||||
let wallet = wallets[this.lastSnappedTo || 0];
|
||||
if (wallet) {
|
||||
showSend = wallet.allowSend();
|
||||
showReceive = wallet.allowReceive();
|
||||
}
|
||||
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
isTransactionsLoading: false,
|
||||
showReceiveButton: (BlueApp.getWallets().length > 0 && true) || false,
|
||||
showSendButton: (BlueApp.getWallets().length > 0 && true) || false,
|
||||
showReceiveButton: showReceive,
|
||||
showSendButton: showSend,
|
||||
showRereshButton: (BlueApp.getWallets().length > 0 && true) || false,
|
||||
dataSource: ds.cloneWithRows(
|
||||
BlueApp.getTransactions(this.lastSnappedTo || 0),
|
||||
@ -126,11 +135,21 @@ export default class WalletsList extends Component {
|
||||
|
||||
if (index < BlueApp.getWallets().length) {
|
||||
// do not show for last card
|
||||
|
||||
let showSend = false;
|
||||
let showReceive = false;
|
||||
let wallets = BlueApp.getWallets();
|
||||
let wallet = wallets[this.lastSnappedTo || 0];
|
||||
if (wallet) {
|
||||
showSend = wallet.allowSend();
|
||||
showReceive = wallet.allowReceive();
|
||||
}
|
||||
|
||||
setTimeout(
|
||||
() =>
|
||||
this.setState({
|
||||
showReceiveButton: true,
|
||||
showSendButton: true,
|
||||
showReceiveButton: showReceive,
|
||||
showSendButton: showSend,
|
||||
showRereshButton: true,
|
||||
}),
|
||||
50,
|
||||
@ -375,7 +394,7 @@ export default class WalletsList extends Component {
|
||||
})()}
|
||||
|
||||
{(() => {
|
||||
if (this.state.showReceiveButton) {
|
||||
if (this.state.showSendButton) {
|
||||
return (
|
||||
<BlueSendButtonIcon
|
||||
onPress={() => {
|
||||
|
Loading…
Reference in New Issue
Block a user