From e40914e29ac226b07ef8fdbc20030ea46ddc3941 Mon Sep 17 00:00:00 2001 From: ryanml Date: Mon, 1 Apr 2019 19:30:36 -0700 Subject: [PATCH] Fixes brave/brave-browser#3124, adds TOS modules to Rewards OptIn points --- browser/ui/webui/brave_webui_source.cc | 10 ++++++++-- .../brave_rewards/_locales/en_US/messages.json | 4 ++++ .../brave_rewards/background/api/locale_api.ts | 1 + .../extension/brave_rewards/components/app.tsx | 2 ++ .../resources/ui/components/app.tsx | 10 ++++++++++ .../resources/ui/components/settingsPage.tsx | 17 ++++++++++++++++- .../resources/brave_components_strings.grd | 7 ++++++- package-lock.json | 4 ++-- package.json | 2 +- 9 files changed, 50 insertions(+), 7 deletions(-) diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index a8753b7d96b7..64ca5caee44d 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -389,7 +389,6 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "rewardsContributeAttention", IDS_BRAVE_UI_REWARDS_CONTRIBUTE_ATTENTION }, // NOLINT { "rewardsContributeAttentionScore", IDS_BRAVE_UI_REWARDS_CONTRIBUTE_ATTENTION_SCORE }, // NOLINT { "rewardsContributeText1", IDS_BRAVE_UI_REWARDS_CONTRIBUTE_TEXT1 }, - { "rewardsOffText1", IDS_BRAVE_UI_REWARDS_OFF_TEXT1 }, { "rewardsOffText2", IDS_BRAVE_UI_REWARDS_OFF_TEXT2 }, { "rewardsOffText3", IDS_BRAVE_UI_REWARDS_OFF_TEXT3 }, { "rewardsOffText4", IDS_BRAVE_UI_REWARDS_OFF_TEXT4 }, @@ -450,7 +449,14 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "whyBraveRewards", IDS_BRAVE_UI_WHY_BRAVE_REWARDS }, { "whyBraveRewardsDesc1", IDS_BRAVE_UI_WHY_BRAVE_REWARDS_DESC_1 }, { "whyBraveRewardsDesc2", IDS_BRAVE_UI_WHY_BRAVE_REWARDS_DESC_2 }, - { "yourWallet", IDS_BRAVE_UI_YOUR_WALLET } + { "yourWallet", IDS_BRAVE_UI_YOUR_WALLET }, + + { "and", IDS_BRAVE_UI_AND }, + { "privacyPolicy", IDS_BRAVE_UI_PRIVACY_POLICY }, + { "rewardsOffText5", IDS_BRAVE_UI_REWARDS_OFF_TEXT5 }, + { "serviceTextToggle", IDS_BRAVE_UI_SERVICE_TEXT_TOGGLE }, + { "serviceTextWelcome", IDS_BRAVE_UI_SERVICE_TEXT_WELCOME }, + { "termsOfService", IDS_BRAVE_UI_TERMS_OF_SERVICE } } }, { std::string("sync"), { diff --git a/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json b/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json index a487cea1abed..2eda806df35d 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json +++ b/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json @@ -384,5 +384,9 @@ "contributionTips": { "message": "Contributions & Tips", "description": "Title for monthly tips processed notification" + }, + "serviceTextPanelWelcome": { + "message": "By clicking ‘Join Rewards’, you indicate that you have read and agree to the", + "description": "Terms of service panel opt-in text" } } diff --git a/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts b/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts index 415cb707a07d..7880f827e285 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts +++ b/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts @@ -84,6 +84,7 @@ export const getUIMessages = (): Record => { 'rewardsContributeAttentionScore', 'rewardsSummary', 'serviceText', + 'serviceTextPanelWelcome', 'termsOfService', 'tipsProcessedNotification', 'tokenGrant', diff --git a/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx b/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx index 329fae0b4a35..baa8329477cb 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx +++ b/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx @@ -203,6 +203,8 @@ export class RewardsPanel extends React.Component { optInAction={this.onCreate} optInErrorAction={this.onCreate} moreLink={this.openRewards} + onTOSClick={this.openTOS} + onPrivacyClick={this.openPrivacyPolicy} /> ) } diff --git a/components/brave_rewards/resources/ui/components/app.tsx b/components/brave_rewards/resources/ui/components/app.tsx index a26a93f234f8..42d1de8b745b 100644 --- a/components/brave_rewards/resources/ui/components/app.tsx +++ b/components/brave_rewards/resources/ui/components/app.tsx @@ -53,6 +53,14 @@ export class App extends React.Component { }) } + openTOS () { + window.open('https://brave.com/terms-of-use', '_blank') + } + + openPrivacyPolicy () { + window.open('https://brave.com/privacy#rewards', '_blank') + } + get actions () { return this.props.actions } @@ -73,6 +81,8 @@ export class App extends React.Component { { !walletCreated ? { } } + openTOS () { + window.open('https://brave.com/terms-of-use', '_blank') + } + + openPrivacyPolicy () { + window.open('https://brave.com/privacy#rewards', '_blank') + } + getGrantClaims = () => { const { grants } = this.props.rewardsData @@ -138,7 +146,14 @@ class SettingsPage extends React.Component { onToggle={this.onToggle} enabled={enabledMain} testId={'enableMain'} + onTOSClick={this.openTOS} + onPrivacyClick={this.openPrivacyPolicy} /> + { + !enabledMain + ? + : null + } diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index b94a775b7fac..44d5268706b2 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -305,6 +305,11 @@ Support your favorite sites just by browsing – or tip a site any time you like. Auto-Contribute Brave Rewards + and + Privacy Policy + Terms of Service + By turning on Brave Rewards, you indicate that you have read and agree to the + By clicking ‘Yes, I'm in!’, you indicate that you have read and agree to the Creating wallet Your attention is valuable. Earn by viewing privacy-respecting ads, and pay it forward to support content creators you love. Yes, I'm In! @@ -418,10 +423,10 @@ Attention Attention You’re currently supporting - With your old browser, you paid to browse the web by viewing ads with your valuable attention. You spent your valuable time downloading invasive ad technology that transmitted your valuable private data to advertisers — without your consent. Today, Brave welcomes you to the new internet. One where your time is valued, your personal data is kept private, and you actually get paid for your attention. + With your old browser, you paid to browse the web by viewing ads with your valuable attention. You spent your valuable time downloading invasive ad technology that transmitted your valuable private data to advertisers — without your consent. Sadly, no tokens yet. 3 ways to fill your wallet: You can add funds. diff --git a/package-lock.json b/package-lock.json index 5b6c210f329f..f3e35badf8ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1597,8 +1597,8 @@ } }, "brave-ui": { - "version": "github:brave/brave-ui#44513d1b6c27f4bcdf2564baef092af9fabf5665", - "from": "github:brave/brave-ui#44513d1b6c27f4bcdf2564baef092af9fabf5665", + "version": "github:brave/brave-ui#d59401050d87a59bc15f743dab8ce06454b08671", + "from": "github:brave/brave-ui#d59401050d87a59bc15f743dab8ce06454b08671", "dev": true, "requires": { "@ctrl/tinycolor": "^2.2.1", diff --git a/package.json b/package.json index a197048a66e3..7b3badbc3152 100644 --- a/package.json +++ b/package.json @@ -277,7 +277,7 @@ "@types/react-redux": "6.0.4", "@types/redux-logger": "^3.0.7", "awesome-typescript-loader": "^5.2.1", - "brave-ui": "github:brave/brave-ui#44513d1b6c27f4bcdf2564baef092af9fabf5665", + "brave-ui": "github:brave/brave-ui#d59401050d87a59bc15f743dab8ce06454b08671", "css-loader": "^2.1.1", "csstype": "^2.5.5", "deep-freeze-node": "^1.1.3",