don't show rewards nag if user is not interested
This commit is contained in:
parent
7e4e08ca30
commit
f0a2027d57
3 changed files with 10 additions and 7 deletions
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { selectBalance } from 'lbry-redux';
|
import { selectBalance } from 'lbry-redux';
|
||||||
import { selectUnclaimedRewardValue } from 'lbryinc';
|
import { selectUnclaimedRewardValue } from 'lbryinc';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import FloatingWalletBalance from './view';
|
import FloatingWalletBalance from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -11,7 +11,4 @@ const select = state => ({
|
||||||
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
|
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(select, null)(FloatingWalletBalance);
|
||||||
select,
|
|
||||||
null
|
|
||||||
)(FloatingWalletBalance);
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ const select = state => ({
|
||||||
unreadSubscriptions: selectUnreadSubscriptions(state),
|
unreadSubscriptions: selectUnreadSubscriptions(state),
|
||||||
viewMode: selectViewMode(state),
|
viewMode: selectViewMode(state),
|
||||||
firstRunCompleted: selectFirstRunCompleted(state),
|
firstRunCompleted: selectFirstRunCompleted(state),
|
||||||
|
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
|
||||||
showSuggestedSubs: selectShowSuggestedSubs(state),
|
showSuggestedSubs: selectShowSuggestedSubs(state),
|
||||||
timeItem: selectTimeItem(state),
|
timeItem: selectTimeItem(state),
|
||||||
sdkReady: selectSdkReady(state),
|
sdkReady: selectSdkReady(state),
|
||||||
|
|
|
@ -73,7 +73,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||||
Lbryio.getExchangeRates().then(rates => {
|
Lbryio.getExchangeRates().then(rates => {
|
||||||
if (!isNaN(rates.LBC_USD)) {
|
if (!isNaN(rates.LBC_USD)) {
|
||||||
this.setState({ usdExchangeRate: 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();
|
this.showRewardsAvailable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -116,7 +116,12 @@ class SubscriptionsPage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
showRewardsAvailable = () => {
|
showRewardsAvailable = () => {
|
||||||
const { navigation, unclaimedRewardAmount } = this.props;
|
const { navigation, unclaimedRewardAmount, rewardsNotInterested } = this.props;
|
||||||
|
if (rewardsNotInterested) {
|
||||||
|
this.setState({ showRewardsNag: false });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({ showRewardsNag: false }, () => {
|
this.setState({ showRewardsNag: false }, () => {
|
||||||
Snackbar.show({
|
Snackbar.show({
|
||||||
title: __('Did you know that you can earn free credits worth up to %amount%?', {
|
title: __('Did you know that you can earn free credits worth up to %amount%?', {
|
||||||
|
|
Loading…
Reference in a new issue