diff --git a/app/LoadingApp/LoadingApp.tsx b/app/LoadingApp/LoadingApp.tsx index 5b6bed47c..3bd0b76bb 100644 --- a/app/LoadingApp/LoadingApp.tsx +++ b/app/LoadingApp/LoadingApp.tsx @@ -73,7 +73,6 @@ import Launching from './Launching'; import simpleBiometrics from '../simpleBiometrics'; import selectingServer from '../selectingServer'; import { isEqual } from 'lodash'; -import { RPCWalletKindEnum } from '../rpc/enums/RPCWalletKindEnum'; import { RestoreFromTypeEnum } from '../AppState'; // no lazy load because slowing down screens. @@ -83,6 +82,7 @@ import Seed from '../../components/Seed'; import ImportUfvk from '../../components/Ufvk/ImportUfvk'; import ChainTypeToggle from '../../components/Components/ChainTypeToggle'; import { sendEmail } from '../sendEmail'; +import { RPCWalletKindEnum } from '../rpc/enums/RPCWalletKindEnum'; const en = require('../translations/en.json'); const es = require('../translations/es.json'); @@ -489,8 +489,18 @@ export class LoadingAppClass extends Component void; @@ -29,11 +31,25 @@ const Pools: React.FunctionComponent = ({ closeModal, setPrivacyOpti const context = useContext(ContextAppLoaded); const { totalBalance, info, translate, privacy, addLastSnackbar, somePending, language } = context; const { colors } = useTheme() as unknown as ThemeType; + const [orchardPool, setOrchardPool] = useState(true); + const [saplingPool, setSaplingPool] = useState(true); + const [transparentPool, setTransparentPool] = useState(true); moment.locale(language); - // because this screen is fired from more places than the menu. useEffect(() => { - (async () => await RPC.rpcSetInterruptSyncAfterBatch(GlobalConst.false))(); + (async () => { + // because this screen is fired from more places than the menu. + await RPC.rpcSetInterruptSyncAfterBatch(GlobalConst.false); + // checking the pools of this wallet + const walletKindStr: string = await RPCModule.execute(CommandEnum.walletKind, ''); + try { + const walletKindJSON: RPCWalletKindType = await JSON.parse(walletKindStr); + console.log(walletKindJSON); + setOrchardPool(walletKindJSON.orchard); + setSaplingPool(walletKindJSON.sapling); + setTransparentPool(walletKindJSON.transparent); + } catch (e) {} + })(); }, []); //console.log('render pools. Balance:', totalBalance); @@ -64,94 +80,113 @@ const Pools: React.FunctionComponent = ({ closeModal, setPrivacyOpti justifyContent: 'flex-start', }}> - {translate('pools.orchard-title') as string} - {totalBalance && ( <> - - - 0 && totalBalance.spendableOrchard === totalBalance.orchardBal - ? 1 - : 0.5, - }} - privacy={privacy} - /> - - - 0 && totalBalance.spendableOrchard === totalBalance.orchardBal - ? colors.primary - : 'red' - } - privacy={privacy} - /> - - - - - - {translate('pools.sapling-title') as string} - - - - 0 && totalBalance.spendablePrivate === totalBalance.privateBal - ? 1 - : 0.5, - }} - privacy={privacy} + {orchardPool && ( + <> + {translate('pools.orchard-title') as string} + + + + 0 && + totalBalance.spendableOrchard === totalBalance.orchardBal + ? 1 + : 0.5, + }} + privacy={privacy} + /> + + + 0 && totalBalance.spendableOrchard === totalBalance.orchardBal + ? colors.primary + : 'red' + } + privacy={privacy} + /> + + + + - - - 0 && totalBalance.spendablePrivate === totalBalance.privateBal - ? colors.syncing - : 'red' - } - privacy={privacy} - /> - - - - - - {translate('pools.transparent-title') as string} - - - - + )} + + {saplingPool && ( + <> + {translate('pools.sapling-title') as string} + + + + 0 && + totalBalance.spendablePrivate === totalBalance.privateBal + ? 1 + : 0.5, + }} + privacy={privacy} + /> + + + 0 && totalBalance.spendablePrivate === totalBalance.privateBal + ? colors.syncing + : 'red' + } + privacy={privacy} + /> + + + + - - + + )} + + {transparentPool && ( + <> + {translate('pools.transparent-title') as string} + + + + + + + + )} + {somePending && (