mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
balances corrected on transfer screens
This commit is contained in:
parent
f462546f07
commit
5afc3cee22
@ -201,21 +201,17 @@ const WalletContainer = ({
|
|||||||
const _navigate = async (transferType, fundType) => {
|
const _navigate = async (transferType, fundType) => {
|
||||||
let balance;
|
let balance;
|
||||||
|
|
||||||
switch (fundType) {
|
if (transferType === 'transfer_token' && fundType === 'STEEM') {
|
||||||
case 'STEEM':
|
|
||||||
balance = Math.round(walletData.balance * 1000) / 1000;
|
balance = Math.round(walletData.balance * 1000) / 1000;
|
||||||
break;
|
}
|
||||||
case 'SBD':
|
if (transferType === 'transfer_token' && fundType === 'SBD') {
|
||||||
balance = Math.round(walletData.sbdBalance * 1000) / 1000;
|
balance = Math.round(walletData.sbdBalance * 1000) / 1000;
|
||||||
break;
|
}
|
||||||
case 'SAVING_STEEM':
|
if (transferType === 'withdraw_steem' && fundType === 'STEEM') {
|
||||||
balance = Math.round(walletData.savingBalance * 1000) / 1000;
|
balance = Math.round(walletData.savingBalance * 1000) / 1000;
|
||||||
break;
|
}
|
||||||
case 'SAVING_SBD':
|
if (transferType === 'withdraw_sbd' && fundType === 'SBD') {
|
||||||
balance = Math.round(walletData.savingBalanceSbd * 1000) / 1000;
|
balance = Math.round(walletData.savingBalanceSbd * 1000) / 1000;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPinCodeOpen) {
|
if (isPinCodeOpen) {
|
||||||
|
@ -34,6 +34,8 @@ class TransferContainer extends Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
fundType: props.navigation.getParam('fundType', ''),
|
fundType: props.navigation.getParam('fundType', ''),
|
||||||
|
balance: props.navigation.getParam('balance', ''),
|
||||||
|
transferType: props.navigation.getParam('transferType', ''),
|
||||||
selectedAccount: props.currentAccount,
|
selectedAccount: props.currentAccount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -63,33 +65,28 @@ class TransferContainer extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchBalance = username => {
|
fetchBalance = username => {
|
||||||
const { fundType } = this.state;
|
const { fundType, transferType } = this.state;
|
||||||
|
|
||||||
getAccount(username).then(async account => {
|
getAccount(username).then(async account => {
|
||||||
let balance;
|
let balance;
|
||||||
switch (fundType) {
|
|
||||||
case 'STEEM':
|
if (transferType === 'transfer_token' && fundType === 'STEEM') {
|
||||||
balance = account[0].balance.replace(fundType, '');
|
balance = account[0].balance.replace(fundType, '');
|
||||||
break;
|
}
|
||||||
case 'SBD':
|
if (transferType === 'transfer_token' && fundType === 'SBD') {
|
||||||
balance = account[0].sbd_balance.replace(fundType, '');
|
balance = account[0].sbd_balance.replace(fundType, '');
|
||||||
break;
|
}
|
||||||
case 'ESTM':
|
if (transferType === 'points' && fundType === 'ESTM') {
|
||||||
this._getUserPointsBalance(username);
|
this._getUserPointsBalance(username);
|
||||||
break;
|
}
|
||||||
case 'SAVING_STEEM':
|
if (transferType === 'transfer_to_saving' && fundType === 'STEEM') {
|
||||||
this.setState({ fundType: 'STEEM' });
|
balance = account[0].balance.replace(fundType, '');
|
||||||
balance = account[0].savings_balance.replace(' STEEM', '');
|
}
|
||||||
break;
|
if (transferType === 'transfer_to_saving' && fundType === 'SBD') {
|
||||||
case 'SAVING_SBD':
|
balance = account[0].sbd_balance.replace(fundType, '');
|
||||||
this.setState({ fundType: 'STEEM DOLLAR' });
|
}
|
||||||
balance = account[0].savings_sbd_balance.replace(' SBD', '');
|
if (transferType === 'powerUp' && fundType === 'STEEM') {
|
||||||
break;
|
|
||||||
case 'STEEM_POWER':
|
|
||||||
balance = account[0].balance.replace(fundType, '');
|
balance = account[0].balance.replace(fundType, '');
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const local = await getUserDataWithUsername(username);
|
const local = await getUserDataWithUsername(username);
|
||||||
|
@ -31,10 +31,19 @@ class TransferView extends Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
from: props.currentAccountName,
|
from: props.currentAccountName,
|
||||||
destination: props.transferType === 'powerUp' ? props.currentAccountName : '',
|
destination:
|
||||||
|
props.transferType === 'powerUp' ||
|
||||||
|
props.transferType === 'withdraw_steem' ||
|
||||||
|
props.transferType === 'withdraw_steem'
|
||||||
|
? props.currentAccountName
|
||||||
|
: '',
|
||||||
amount: '',
|
amount: '',
|
||||||
memo: '',
|
memo: '',
|
||||||
isUsernameValid: !!(props.transferType === 'powerUp' && props.currentAccountName),
|
isUsernameValid: !!(
|
||||||
|
props.transferType === 'powerUp' ||
|
||||||
|
props.transferType === 'withdraw_steem' ||
|
||||||
|
(props.transferType === 'withdraw_steem' && props.currentAccountName)
|
||||||
|
),
|
||||||
steemConnectTransfer: false,
|
steemConnectTransfer: false,
|
||||||
isTransfering: false,
|
isTransfering: false,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user