Compare commits

...

1 commit

Author SHA1 Message Date
Akinwale Ariwodola
667024ebb7 new_android reward 2020-03-20 16:59:10 +01:00
4 changed files with 14 additions and 9 deletions

7
dist/bundle.es.js vendored
View file

@ -506,6 +506,7 @@ rewards.TYPE_REWARD_CODE = 'reward_code';
rewards.TYPE_SUBSCRIPTION = 'subscription'; rewards.TYPE_SUBSCRIPTION = 'subscription';
rewards.YOUTUBE_CREATOR = 'youtube_creator'; rewards.YOUTUBE_CREATOR = 'youtube_creator';
rewards.TYPE_DAILY_VIEW = 'daily_view'; rewards.TYPE_DAILY_VIEW = 'daily_view';
rewards.TYPE_NEW_ANDROID = 'new_android';
rewards.claimReward = (type, rewardParams) => { rewards.claimReward = (type, rewardParams) => {
function requestReward(resolve, reject, params) { function requestReward(resolve, reject, params) {
@ -1815,18 +1816,18 @@ function doClaimRewardType(rewardType, options = {}) {
const state = getState(); const state = getState();
const userIsRewardApproved = selectUserIsRewardApproved(state); const userIsRewardApproved = selectUserIsRewardApproved(state);
const unclaimedRewards = selectUnclaimedRewards(state); const unclaimedRewards = selectUnclaimedRewards(state);
const reward = rewardType === rewards.TYPE_REWARD_CODE ? { const reward = rewardType === rewards.TYPE_REWARD_CODE || rewardType === rewards.TYPE_NEW_ANDROID ? {
reward_type: rewards.TYPE_REWARD_CODE reward_type: rewards.TYPE_REWARD_CODE
} : unclaimedRewards.find(ur => ur.reward_type === rewardType); // Try to claim the email reward right away, even if we haven't called reward_list yet } : unclaimedRewards.find(ur => ur.reward_type === rewardType); // Try to claim the email reward right away, even if we haven't called reward_list yet
if (rewardType !== rewards.TYPE_REWARD_CODE || rewardType !== rewards.TYPE_CONFIRM_EMAIL || rewardType !== rewards.TYPE_DAILY_VIEW) { if (rewardType !== rewards.TYPE_REWARD_CODE || rewardType !== rewards.TYPE_CONFIRM_EMAIL || rewardType !== rewards.TYPE_DAILY_VIEW || rewardType !== rewards.TYPE_NEW_ANDROID) {
if (!reward || reward.transaction_id) { if (!reward || reward.transaction_id) {
// already claimed or doesn't exist, do nothing // already claimed or doesn't exist, do nothing
return; return;
} }
} }
if (!userIsRewardApproved && rewardType !== rewards.TYPE_CONFIRM_EMAIL && rewardType !== rewards.TYPE_REWARD_CODE) { if (!userIsRewardApproved && rewardType !== rewards.TYPE_CONFIRM_EMAIL && rewardType !== rewards.TYPE_REWARD_CODE && rewardType !== rewards.TYPE_NEW_ANDROID) {
if (!options || !options.failSilently && rewards.callbacks.rewardApprovalRequested) { if (!options || !options.failSilently && rewards.callbacks.rewardApprovalRequested) {
rewards.callbacks.rewardApprovalRequested(); rewards.callbacks.rewardApprovalRequested();
} }

7
dist/bundle.js vendored
View file

@ -1294,6 +1294,7 @@ rewards.TYPE_REWARD_CODE = 'reward_code';
rewards.TYPE_SUBSCRIPTION = 'subscription'; rewards.TYPE_SUBSCRIPTION = 'subscription';
rewards.YOUTUBE_CREATOR = 'youtube_creator'; rewards.YOUTUBE_CREATOR = 'youtube_creator';
rewards.TYPE_DAILY_VIEW = 'daily_view'; rewards.TYPE_DAILY_VIEW = 'daily_view';
rewards.TYPE_NEW_ANDROID = 'new_android';
rewards.claimReward = function (type, rewardParams) { rewards.claimReward = function (type, rewardParams) {
function requestReward(resolve, reject, params) { function requestReward(resolve, reject, params) {
@ -4400,20 +4401,20 @@ function doClaimRewardType(rewardType) {
var state = getState(); var state = getState();
var userIsRewardApproved = Object(redux_selectors_user__WEBPACK_IMPORTED_MODULE_3__["selectUserIsRewardApproved"])(state); var userIsRewardApproved = Object(redux_selectors_user__WEBPACK_IMPORTED_MODULE_3__["selectUserIsRewardApproved"])(state);
var unclaimedRewards = Object(redux_selectors_rewards__WEBPACK_IMPORTED_MODULE_2__["selectUnclaimedRewards"])(state); var unclaimedRewards = Object(redux_selectors_rewards__WEBPACK_IMPORTED_MODULE_2__["selectUnclaimedRewards"])(state);
var reward = rewardType === rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE ? { var reward = rewardType === rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE || rewardType === rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_NEW_ANDROID ? {
reward_type: rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE reward_type: rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE
} : unclaimedRewards.find(function (ur) { } : unclaimedRewards.find(function (ur) {
return ur.reward_type === rewardType; return ur.reward_type === rewardType;
}); // Try to claim the email reward right away, even if we haven't called reward_list yet }); // Try to claim the email reward right away, even if we haven't called reward_list yet
if (rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE || rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_CONFIRM_EMAIL || rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_DAILY_VIEW) { if (rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE || rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_CONFIRM_EMAIL || rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_DAILY_VIEW || rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_NEW_ANDROID) {
if (!reward || reward.transaction_id) { if (!reward || reward.transaction_id) {
// already claimed or doesn't exist, do nothing // already claimed or doesn't exist, do nothing
return; return;
} }
} }
if (!userIsRewardApproved && rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_CONFIRM_EMAIL && rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE) { if (!userIsRewardApproved && rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_CONFIRM_EMAIL && rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_REWARD_CODE && rewardType !== rewards__WEBPACK_IMPORTED_MODULE_5__["default"].TYPE_NEW_ANDROID) {
if (!options || !options.failSilently && rewards__WEBPACK_IMPORTED_MODULE_5__["default"].callbacks.rewardApprovalRequested) { if (!options || !options.failSilently && rewards__WEBPACK_IMPORTED_MODULE_5__["default"].callbacks.rewardApprovalRequested) {
rewards__WEBPACK_IMPORTED_MODULE_5__["default"].callbacks.rewardApprovalRequested(); rewards__WEBPACK_IMPORTED_MODULE_5__["default"].callbacks.rewardApprovalRequested();
} }

View file

@ -33,7 +33,7 @@ export function doClaimRewardType(rewardType, options = {}) {
const userIsRewardApproved = selectUserIsRewardApproved(state); const userIsRewardApproved = selectUserIsRewardApproved(state);
const unclaimedRewards = selectUnclaimedRewards(state); const unclaimedRewards = selectUnclaimedRewards(state);
const reward = const reward =
rewardType === rewards.TYPE_REWARD_CODE rewardType === rewards.TYPE_REWARD_CODE || rewardType === rewards.TYPE_NEW_ANDROID
? { reward_type: rewards.TYPE_REWARD_CODE } ? { reward_type: rewards.TYPE_REWARD_CODE }
: unclaimedRewards.find(ur => ur.reward_type === rewardType); : unclaimedRewards.find(ur => ur.reward_type === rewardType);
@ -41,7 +41,8 @@ export function doClaimRewardType(rewardType, options = {}) {
if ( if (
rewardType !== rewards.TYPE_REWARD_CODE || rewardType !== rewards.TYPE_REWARD_CODE ||
rewardType !== rewards.TYPE_CONFIRM_EMAIL || rewardType !== rewards.TYPE_CONFIRM_EMAIL ||
rewardType !== rewards.TYPE_DAILY_VIEW rewardType !== rewards.TYPE_DAILY_VIEW ||
rewardType !== rewards.TYPE_NEW_ANDROID
) { ) {
if (!reward || reward.transaction_id) { if (!reward || reward.transaction_id) {
// already claimed or doesn't exist, do nothing // already claimed or doesn't exist, do nothing
@ -52,7 +53,8 @@ export function doClaimRewardType(rewardType, options = {}) {
if ( if (
!userIsRewardApproved && !userIsRewardApproved &&
rewardType !== rewards.TYPE_CONFIRM_EMAIL && rewardType !== rewards.TYPE_CONFIRM_EMAIL &&
rewardType !== rewards.TYPE_REWARD_CODE rewardType !== rewards.TYPE_REWARD_CODE &&
rewardType !== rewards.TYPE_NEW_ANDROID
) { ) {
if (!options || (!options.failSilently && rewards.callbacks.rewardApprovalRequested)) { if (!options || (!options.failSilently && rewards.callbacks.rewardApprovalRequested)) {
rewards.callbacks.rewardApprovalRequested(); rewards.callbacks.rewardApprovalRequested();

View file

@ -16,6 +16,7 @@ rewards.TYPE_REWARD_CODE = 'reward_code';
rewards.TYPE_SUBSCRIPTION = 'subscription'; rewards.TYPE_SUBSCRIPTION = 'subscription';
rewards.YOUTUBE_CREATOR = 'youtube_creator'; rewards.YOUTUBE_CREATOR = 'youtube_creator';
rewards.TYPE_DAILY_VIEW = 'daily_view'; rewards.TYPE_DAILY_VIEW = 'daily_view';
rewards.TYPE_NEW_ANDROID = 'new_android';
rewards.claimReward = (type, rewardParams) => { rewards.claimReward = (type, rewardParams) => {
function requestReward(resolve, reject, params) { function requestReward(resolve, reject, params) {