Display USD #135

Merged
akinwale merged 5 commits from usd into master 2020-03-26 15:13:57 +01:00
3 changed files with 10 additions and 7 deletions
Showing only changes of commit f0a2027d57 - Show all commits

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectBalance } from 'lbry-redux';
import { selectUnclaimedRewardValue } from 'lbryinc';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import FloatingWalletBalance from './view';
const select = state => ({
@ -11,7 +11,4 @@ const select = state => ({
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
});
export default connect(
select,
null
)(FloatingWalletBalance);
export default connect(select, null)(FloatingWalletBalance);

View file

@ -34,6 +34,7 @@ const select = state => ({
unreadSubscriptions: selectUnreadSubscriptions(state),
viewMode: selectViewMode(state),
firstRunCompleted: selectFirstRunCompleted(state),
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
showSuggestedSubs: selectShowSuggestedSubs(state),
timeItem: selectTimeItem(state),
sdkReady: selectSdkReady(state),

View file

@ -73,7 +73,7 @@ class SubscriptionsPage extends React.PureComponent {
Lbryio.getExchangeRates().then(rates => {
if (!isNaN(rates.LBC_USD)) {
this.setState({ usdExchangeRate: rates.LBC_USD }, () => {
if (sdkReady && parseFloat(this.state.usdExchangeRate) > 0) {
if (sdkReady && parseFloat(this.state.usdExchangeRate) > 0 && user && !user.is_reward_approved) {
this.showRewardsAvailable();
}
});
@ -116,7 +116,12 @@ class SubscriptionsPage extends React.PureComponent {
}
showRewardsAvailable = () => {
const { navigation, unclaimedRewardAmount } = this.props;
const { navigation, unclaimedRewardAmount, rewardsNotInterested } = this.props;
if (rewardsNotInterested) {
this.setState({ showRewardsNag: false });
return;
}
this.setState({ showRewardsNag: false }, () => {
Snackbar.show({
title: __('Did you know that you can earn free credits worth up to %amount%?', {