display total wallet balance. fix dispatch prop.
This commit is contained in:
parent
ee75a6bca6
commit
d16a614584
8 changed files with 23 additions and 23 deletions
|
@ -281,7 +281,7 @@ class AppWithNavigationState extends React.Component {
|
|||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { user } = this.props;
|
||||
const { dispatch, user } = this.props;
|
||||
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
|
||||
clearInterval(this.emailVerifyCheckInterval);
|
||||
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { selectBalance } from 'lbry-redux';
|
||||
import { selectTotalBalance } from 'lbry-redux';
|
||||
import { selectUnclaimedRewardValue } from 'lbryinc';
|
||||
import FloatingWalletBalance from './view';
|
||||
import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc';
|
||||
|
||||
const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
balance: selectTotalBalance(state),
|
||||
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
|
||||
});
|
||||
|
||||
|
|
|
@ -18,6 +18,12 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
|
|||
|
||||
return (
|
||||
<View style={[floatingButtonStyle.view, floatingButtonStyle.bottomRight]}>
|
||||
{unclaimedRewardAmount > 0 &&
|
||||
<TouchableOpacity style={floatingButtonStyle.pendingContainer}
|
||||
onPress={() => navigation && navigation.navigate({ routeName: 'Rewards' })} >
|
||||
<Icon name="award" size={18} style={floatingButtonStyle.rewardIcon} />
|
||||
<Text style={floatingButtonStyle.text}>{unclaimedRewardAmount}</Text>
|
||||
</TouchableOpacity>}
|
||||
<TouchableOpacity style={floatingButtonStyle.container}
|
||||
onPress={() => navigation && navigation.navigate({ routeName: 'WalletStack' })}>
|
||||
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
||||
|
@ -25,12 +31,6 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
|
|||
{(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
{unclaimedRewardAmount > 0 &&
|
||||
<TouchableOpacity style={floatingButtonStyle.pendingContainer}
|
||||
onPress={() => navigation && navigation.navigate({ routeName: 'Rewards' })} >
|
||||
<Icon name="award" size={18} style={floatingButtonStyle.rewardIcon} />
|
||||
<Text style={floatingButtonStyle.text}>{unclaimedRewardAmount}</Text>
|
||||
</TouchableOpacity>}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { selectBalance } from 'lbry-redux';
|
||||
import { selectTotalBalance } from 'lbry-redux';
|
||||
import WalletBalance from './view';
|
||||
|
||||
const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
balance: selectTotalBalance(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(WalletBalance);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// @flow
|
||||
import React from 'react';
|
||||
import { Image, Text, View } from 'react-native';
|
||||
import { formatCredits } from 'lbry-redux'
|
||||
import Address from '../address';
|
||||
import Button from '../button';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
import { Lbry, formatCredits } from 'lbry-redux'
|
||||
import Address from 'component/address';
|
||||
import Button from 'component/button';
|
||||
import walletStyle from 'styles/wallet';
|
||||
|
||||
type Props = {
|
||||
balance: number,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doBalanceSubscribe, doUpdateBlockHeight, doToast } from 'lbry-redux';
|
||||
import { doTotalBalanceSubscribe, doUpdateBlockHeight, doToast } from 'lbry-redux';
|
||||
import {
|
||||
doAuthenticate,
|
||||
doBlackListedOutpointsSubscribe,
|
||||
|
@ -23,7 +23,7 @@ const select = state => ({
|
|||
|
||||
const perform = dispatch => ({
|
||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
||||
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
|
||||
totalBalanceSubscribe: () => dispatch(doTotalBalanceSubscribe()),
|
||||
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
||||
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
|
||||
deleteCompleteBlobs: () => dispatch(doDeleteCompleteBlobs()),
|
||||
|
|
|
@ -137,7 +137,7 @@ class SplashScreen extends React.PureComponent {
|
|||
finishSplashScreen = () => {
|
||||
const {
|
||||
authenticate,
|
||||
balanceSubscribe,
|
||||
totalBalanceSubscribe,
|
||||
blacklistedOutpointsSubscribe,
|
||||
checkSubscriptionsInit,
|
||||
updateBlockHeight,
|
||||
|
@ -147,7 +147,7 @@ class SplashScreen extends React.PureComponent {
|
|||
|
||||
Lbry.resolve({ urls: 'lbry://one' }).then(() => {
|
||||
// Leave the splash screen
|
||||
balanceSubscribe();
|
||||
totalBalanceSubscribe();
|
||||
blacklistedOutpointsSubscribe();
|
||||
checkSubscriptionsInit();
|
||||
updateBlockHeight();
|
||||
|
|
|
@ -30,9 +30,9 @@ const floatingButtonStyle = StyleSheet.create({
|
|||
pendingContainer: {
|
||||
borderRadius: 24,
|
||||
padding: 14,
|
||||
paddingLeft: 70,
|
||||
paddingRight: 20,
|
||||
marginLeft: -60,
|
||||
paddingLeft: 20,
|
||||
paddingRight: 70,
|
||||
marginRight: -60,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: Colors.BrighterLbryGreen,
|
||||
|
|
Loading…
Reference in a new issue