From 1b6f6fdb5622abf93c55953e7b8501121d7ede12 Mon Sep 17 00:00:00 2001 From: brave-builds Date: Tue, 31 Mar 2020 15:57:50 +0000 Subject: [PATCH] Uplift of #5066 (squashed) to beta --- components/brave_new_tab_ui/rewards-utils.ts | 2 +- .../brave_rewards/resources/android_page/utils.ts | 11 ----------- .../extension/brave_rewards/background/storage.ts | 2 +- components/brave_rewards/resources/page/utils.ts | 11 ----------- components/definitions/newTab.d.ts | 2 +- components/definitions/rewards.d.ts | 2 +- components/definitions/rewardsExtensions.d.ts | 2 +- 7 files changed, 5 insertions(+), 27 deletions(-) diff --git a/components/brave_new_tab_ui/rewards-utils.ts b/components/brave_new_tab_ui/rewards-utils.ts index ce0cba99c187..5ce6aa0c0c97 100644 --- a/components/brave_new_tab_ui/rewards-utils.ts +++ b/components/brave_new_tab_ui/rewards-utils.ts @@ -7,5 +7,5 @@ export const getTotalContributions = (report: NewTab.RewardsBalanceReport) => { return 0.0 } - return report.tips + report.contribute + report.donation + return report.tips + report.contribute + report.monthly } diff --git a/components/brave_rewards/resources/android_page/utils.ts b/components/brave_rewards/resources/android_page/utils.ts index 7ba2dd7bf545..aa05b32db5a6 100644 --- a/components/brave_rewards/resources/android_page/utils.ts +++ b/components/brave_rewards/resources/android_page/utils.ts @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -import BigNumber from 'bignumber.js' - export let actions: any = null export const getActions = () => actions @@ -40,15 +38,6 @@ export const generateContributionMonthly = (list: number[], rates: Record { - if (!report) { - return '0.0' - } - - const tips = new BigNumber(report.tips) - return new BigNumber(report.donation).plus(tips).dividedBy('1e18').toFixed(1, BigNumber.ROUND_DOWN) -} - export const tipsListTotal = (list: Rewards.Publisher[]) => { if (list.length === 0) { return 0.0 diff --git a/components/brave_rewards/resources/extension/brave_rewards/background/storage.ts b/components/brave_rewards/resources/extension/brave_rewards/background/storage.ts index 70c71c706fc8..5c12219fdb9a 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/background/storage.ts +++ b/components/brave_rewards/resources/extension/brave_rewards/background/storage.ts @@ -19,7 +19,7 @@ export const defaultState: RewardsExtension.State = { balanceReport: { ads: 0.0, contribute: 0.0, - donation: 0.0, + monthly: 0.0, grant: 0.0, tips: 0.0 }, diff --git a/components/brave_rewards/resources/page/utils.ts b/components/brave_rewards/resources/page/utils.ts index 7ba2dd7bf545..aa05b32db5a6 100644 --- a/components/brave_rewards/resources/page/utils.ts +++ b/components/brave_rewards/resources/page/utils.ts @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -import BigNumber from 'bignumber.js' - export let actions: any = null export const getActions = () => actions @@ -40,15 +38,6 @@ export const generateContributionMonthly = (list: number[], rates: Record { - if (!report) { - return '0.0' - } - - const tips = new BigNumber(report.tips) - return new BigNumber(report.donation).plus(tips).dividedBy('1e18').toFixed(1, BigNumber.ROUND_DOWN) -} - export const tipsListTotal = (list: Rewards.Publisher[]) => { if (list.length === 0) { return 0.0 diff --git a/components/definitions/newTab.d.ts b/components/definitions/newTab.d.ts index 6ef6127f321c..b933e59999bf 100644 --- a/components/definitions/newTab.d.ts +++ b/components/definitions/newTab.d.ts @@ -126,7 +126,7 @@ declare namespace NewTab { export interface RewardsBalanceReport { ads: number contribute: number - donation: number + monthly: number grant: number tips: number } diff --git a/components/definitions/rewards.d.ts b/components/definitions/rewards.d.ts index b81207e9276c..7a9a9d51c0d1 100644 --- a/components/definitions/rewards.d.ts +++ b/components/definitions/rewards.d.ts @@ -203,7 +203,7 @@ declare namespace Rewards { export interface BalanceReport { ads: number contribute: number - donation: number + monthly: number grant: number tips: number } diff --git a/components/definitions/rewardsExtensions.d.ts b/components/definitions/rewardsExtensions.d.ts index 332d365e4729..edfbcaf9cace 100644 --- a/components/definitions/rewardsExtensions.d.ts +++ b/components/definitions/rewardsExtensions.d.ts @@ -119,7 +119,7 @@ declare namespace RewardsExtension { export interface BalanceReport { ads: number contribute: number - donation: number + monthly: number grant: number tips: number }