new_android reward

This commit is contained in:
Akinwale Ariwodola 2020-03-20 17:00:18 +01:00
parent a5953dcef0
commit 4c4d561f30
7 changed files with 35 additions and 4 deletions

View file

@ -16,7 +16,7 @@
"@expo/vector-icons": "^8.1.0", "@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3", "gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#69ffd110dbf3633e5847f61f008751edec033017", "lbry-redux": "lbryio/lbry-redux#69ffd110dbf3633e5847f61f008751edec033017",
"lbryinc": "lbryio/lbryinc#021ac75d9aa2db488cfff8e9be320402f038f955", "lbryinc": "lbryio/lbryinc#667024ebb7cb207609273174ca422cee47469270",
"lodash": ">=4.17.11", "lodash": ">=4.17.11",
"merge": ">=1.2.1", "merge": ">=1.2.1",
"moment": "^2.22.1", "moment": "^2.22.1",

View file

@ -54,7 +54,9 @@ import {
} from 'lbry-redux'; } from 'lbry-redux';
import { import {
Lbryio, Lbryio,
rewards as REWARD_TYPES,
doBlackListedOutpointsSubscribe, doBlackListedOutpointsSubscribe,
doClaimRewardType,
doFilteredOutpointsSubscribe, doFilteredOutpointsSubscribe,
doGetSync, doGetSync,
doUserCheckEmailVerified, doUserCheckEmailVerified,
@ -372,6 +374,28 @@ class AppWithNavigationState extends React.Component {
); );
}; };
checkNewAndroidReward = () => {
const { dispatch, doToast } = this.props;
const claimRewardCallback = err => {
if (err) {
// an error occurred, do not display anything
return;
}
// reward successfully claimed
NativeModules.UtilityModule.setNativeBooleanSetting(Constants.SETTING_NEW_ANDROID_REWARD_CLAIMED, true);
};
NativeModules.UtilityModule.getNativeBooleanSetting(Constants.SETTING_NEW_ANDROID_REWARD_CLAIMED, false).then(
rewardClaimed => {
if (!rewardClaimed) {
dispatch(
doClaimRewardType(REWARD_TYPES.TYPE_NEW_ANDROID, { notifyError: false, callback: claimRewardCallback }),
);
}
},
);
};
handleSdkReady = () => { handleSdkReady = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch(doSetSdkReady()); dispatch(doSetSdkReady());
@ -398,6 +422,8 @@ class AppWithNavigationState extends React.Component {
} }
}); });
}); });
this.checkNewAndroidReward();
}; };
handleAccountUnlockFailed() { handleAccountUnlockFailed() {

View file

@ -70,7 +70,9 @@ class FileItem extends React.PureComponent {
const outpointsToHide = !blackListedOutpoints const outpointsToHide = !blackListedOutpoints
? filteredOutpoints ? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints); : blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout); shouldHide = outpointsToHide.some(
outpoint => outpoint && outpoint.txid === claim.txid && outpoint.nout === claim.nout,
);
} }
if (shouldHide) { if (shouldHide) {
// don't display blacklisted or filtered outpoints on the Your tags page // don't display blacklisted or filtered outpoints on the Your tags page

View file

@ -45,6 +45,7 @@ const Constants = {
SETTING_REWARDS_NOT_INTERESTED: 'rewardsNotInterested', SETTING_REWARDS_NOT_INTERESTED: 'rewardsNotInterested',
SETTING_DEVICE_WALLET_SYNCED: 'deviceWalletSynced', SETTING_DEVICE_WALLET_SYNCED: 'deviceWalletSynced',
SETTING_DHT_ENABLED: 'dhtEnabled', SETTING_DHT_ENABLED: 'dhtEnabled',
SETTING_NEW_ANDROID_REWARD_CLAIMED: 'newAndroidRewardClaimed',
ACTION_SDK_READY: 'SDK_READY', ACTION_SDK_READY: 'SDK_READY',

View file

@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import { SETTINGS, doUpdateBlockHeight, doPopulateSharedUserState, doToast } from 'lbry-redux'; import { SETTINGS, doUpdateBlockHeight, doPopulateSharedUserState, doToast } from 'lbry-redux';
import { import {
doAuthenticate, doAuthenticate,
doClaimRewardType,
doInstallNewWithParams, doInstallNewWithParams,
doFetchMySubscriptions, doFetchMySubscriptions,
doFetchRewardedContent, doFetchRewardedContent,

View file

@ -159,6 +159,7 @@ class SplashScreen extends React.PureComponent {
this.getUserSettings(); this.getUserSettings();
}); });
}); });
this.navigateToMain(); this.navigateToMain();
return; return;
} }

View file

@ -4599,9 +4599,9 @@ lbry-redux@lbryio/lbry-redux#69ffd110dbf3633e5847f61f008751edec033017:
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
lbryinc@lbryio/lbryinc#021ac75d9aa2db488cfff8e9be320402f038f955: lbryinc@lbryio/lbryinc#667024ebb7cb207609273174ca422cee47469270:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/021ac75d9aa2db488cfff8e9be320402f038f955" resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/667024ebb7cb207609273174ca422cee47469270"
dependencies: dependencies:
reselect "^3.0.0" reselect "^3.0.0"