Skip to content

Commit

Permalink
Fixes brave/brave-browser#3124, adds TOS modules to Rewards OptIn points
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanml committed Apr 8, 2019
1 parent 2423a10 commit 5fabb98
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 7 deletions.
10 changes: 8 additions & 2 deletions browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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"), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const getUIMessages = (): Record<string, string> => {
'rewardsContributeAttentionScore',
'rewardsSummary',
'serviceText',
'serviceTextPanelWelcome',
'termsOfService',
'tipsProcessedNotification',
'tokenGrant',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ export class RewardsPanel extends React.Component<Props, State> {
optInAction={this.onCreate}
optInErrorAction={this.onCreate}
moreLink={this.openRewards}
onTOSClick={this.openTOS}
onPrivacyClick={this.openPrivacyPolicy}
/>
)
}
Expand Down
10 changes: 10 additions & 0 deletions components/brave_rewards/resources/ui/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ export class App extends React.Component<Props, State> {
})
}

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
}
Expand All @@ -73,6 +81,8 @@ export class App extends React.Component<Props, State> {
{
!walletCreated
? <WelcomePage
onTOSClick={this.openTOS}
onPrivacyClick={this.openPrivacyPolicy}
optInAction={this.onCreateWalletClicked}
creating={this.state.creating}
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { connect } from 'react-redux'

// Components
import { Column, Grid } from 'brave-ui/components'
import { MainToggle, SettingsPage as Page } from 'brave-ui/features/rewards'
import { DisabledBox, MainToggle, SettingsPage as Page } from 'brave-ui/features/rewards'
import PageWallet from './pageWallet'
import AdsBox from './adsBox'
import ContributeBox from './contributeBox'
Expand Down Expand Up @@ -99,6 +99,14 @@ class SettingsPage extends React.Component<Props, {}> {
}
}

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

Expand Down Expand Up @@ -138,7 +146,14 @@ class SettingsPage extends React.Component<Props, {}> {
onToggle={this.onToggle}
enabled={enabledMain}
testId={'enableMain'}
onTOSClick={this.openTOS}
onPrivacyClick={this.openPrivacyPolicy}
/>
{
!enabledMain
? <DisabledBox />
: null
}
<AdsBox />
<ContributeBox />
<DonationBox />
Expand Down
7 changes: 6 additions & 1 deletion components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@
<message name="IDS_BRAVE_UI_BRAVE_CONTRIBUTE_DESC" desc="">Support your favorite sites just by browsing – or tip a site any time you like.</message>
<message name="IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TITLE" desc="">Auto-Contribute</message>
<message name="IDS_BRAVE_UI_BRAVE_REWARDS" desc="">Brave Rewards</message>
<message name="IDS_BRAVE_UI_AND" desc="">and</message>
<message name="IDS_BRAVE_UI_PRIVACY_POLICY" desc="">Privacy Policy</message>
<message name="IDS_BRAVE_UI_TERMS_OF_SERVICE" desc="">Terms of Service</message>
<message name="IDS_BRAVE_UI_SERVICE_TEXT_TOGGLE" desc="">By turning on Brave Rewards, you indicate that you have read and agree to the</message>
<message name="IDS_BRAVE_UI_SERVICE_TEXT_WELCOME" desc="">By clicking ‘Yes, I'm in!’, you indicate that you have read and agree to the</message>
<message name="IDS_BRAVE_UI_BRAVE_REWARDS_CREATING_TEXT" desc="">Creating wallet</message>
<message name="IDS_BRAVE_UI_BRAVE_REWARDS_DESC" desc="">Your attention is valuable. Earn by viewing privacy-respecting ads, and pay it forward to support content creators you love.</message>
<message name="IDS_BRAVE_UI_BRAVE_REWARDS_OPT_IN_TEXT" desc="">Yes, I'm In!</message>
Expand Down Expand Up @@ -418,10 +423,10 @@
<message name="IDS_BRAVE_UI_REWARDS_CONTRIBUTE_ATTENTION" desc="">Attention</message>
<message name="IDS_BRAVE_UI_REWARDS_CONTRIBUTE_ATTENTION_SCORE" desc="">Attention</message>
<message name="IDS_BRAVE_UI_REWARDS_CONTRIBUTE_TEXT1" desc="">You’re currently supporting</message>
<message name="IDS_BRAVE_UI_REWARDS_OFF_TEXT1" desc="">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 —</message>
<message name="IDS_BRAVE_UI_REWARDS_OFF_TEXT2" desc="">without your consent.</message>
<message name="IDS_BRAVE_UI_REWARDS_OFF_TEXT3" desc="">Today, Brave welcomes you to the new internet.</message>
<message name="IDS_BRAVE_UI_REWARDS_OFF_TEXT4" desc="">One where your time is valued, your personal data is kept private, and you actually get paid for your attention.</message>
<message name="IDS_BRAVE_UI_REWARDS_OFF_TEXT5" desc="">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.</message>
<message name="IDS_BRAVE_UI_REWARDS_PANEL_EMPTY_TEXT1" desc="">Sadly, no tokens yet.</message>
<message name="IDS_BRAVE_UI_REWARDS_PANEL_EMPTY_TEXT2" desc="">3 ways to fill your wallet:</message>
<message name="IDS_BRAVE_UI_REWARDS_PANEL_EMPTY_TEXT3" desc="">You can add funds.</message>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5fabb98

Please sign in to comment.