diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js index 0e7366dca..aab6cdbf4 100644 --- a/ui/js/actions/content.js +++ b/ui/js/actions/content.js @@ -122,7 +122,7 @@ export function doUpdateLoadStatus(uri, outpoint) { } else if (fileInfo.completed) { // TODO this isn't going to get called if they reload the client before // the download finished - rewards.claimNextPurchaseReward() + rewards.claimEligiblePurchaseRewards() dispatch({ type: types.DOWNLOADING_COMPLETED, data: { diff --git a/ui/js/rewards.js b/ui/js/rewards.js index a77ccde01..a3ac1e958 100644 --- a/ui/js/rewards.js +++ b/ui/js/rewards.js @@ -76,6 +76,7 @@ rewards.TYPE_FIRST_CHANNEL = "new_channel", rewards.TYPE_FIRST_STREAM = "first_stream", rewards.TYPE_MANY_DOWNLOADS = "many_downloads", rewards.TYPE_FIRST_PUBLISH = "first_publish"; +rewards.TYPE_FEATURED_DOWNLOAD = "featured_download"; rewards.claimReward = function (type) { @@ -155,9 +156,10 @@ rewards.claimReward = function (type) { }); } -rewards.claimNextPurchaseReward = function() { +rewards.claimEligiblePurchaseRewards = function() { let types = {} types[rewards.TYPE_FIRST_STREAM] = false + types[rewards.TYPE_FEATURED_DOWNLOAD] = false types[rewards.TYPE_MANY_DOWNLOADS] = false lbryio.call('reward', 'list', {}).then((userRewards) => { userRewards.forEach((reward) => { @@ -166,11 +168,14 @@ rewards.claimNextPurchaseReward = function() { } }) let unclaimedType = Object.keys(types).find((type) => { - return types[type] === false; + return types[type] === false && type !== rewards.TYPE_FEATURED_DOWNLOAD; //handled below }) if (unclaimedType) { rewards.claimReward(unclaimedType); } + if (types[rewards.TYPE_FEATURED_DOWNLOAD] === false) { + rewards.claimReward(rewards.TYPE_FEATURED_DOWNLOAD) + } }, () => { }); }