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 2, 2019
1 parent 2423a10 commit 8064d4b
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 5 deletions.
6 changes: 5 additions & 1 deletion browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ 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 },

{ "rewardsOffText5", IDS_BRAVE_UI_REWARDS_OFF_TEXT_5 },
{ "serviceTextToggle", IDS_BRAVE_UI_SERVICE_TEXT_TOGGLE },
{ "serviceTextWelcome", IDS_BRAVE_UI_SERVICE_TEXT_WELCOME }
}
}, {
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
14 changes: 14 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,18 @@ export class App extends React.Component<Props, State> {
})
}

openTOS () {
chrome.tabs.create({
url: 'https://brave.com/terms-of-use'
})
}

openPrivacyPolicy () {
chrome.tabs.create({
url: 'https://brave.com/privacy#rewards'
})
}

get actions () {
return this.props.actions
}
Expand All @@ -73,6 +85,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,18 @@ class SettingsPage extends React.Component<Props, {}> {
}
}

openTOS () {
chrome.tabs.create({
url: 'https://brave.com/terms-of-use'
})
}

openPrivacyPolicy () {
chrome.tabs.create({
url: 'https://brave.com/privacy#rewards'
})
}

getGrantClaims = () => {
const { grants } = this.props.rewardsData

Expand Down Expand Up @@ -138,7 +150,14 @@ class SettingsPage extends React.Component<Props, {}> {
onToggle={this.onToggle}
enabled={enabledMain}
testId={'enableMain'}
onTOSClick={this.openPrivacyPolicy}
onPrivacyClick={this.openTOS}
/>
{
!enabledMain
? <DisabledBox />
: null
}
<AdsBox />
<ContributeBox />
<DonationBox />
Expand Down
3 changes: 3 additions & 0 deletions components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@
<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_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 @@ -422,6 +424,7 @@
<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_TEXT_5" 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#bd9f9b188313205cc69f766654e5c6054850463c",
"css-loader": "^2.1.1",
"csstype": "^2.5.5",
"deep-freeze-node": "^1.1.3",
Expand Down

0 comments on commit 8064d4b

Please sign in to comment.