Skip to content

Commit

Permalink
Uplift of #10137 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-browser-releases authored and zenparsing committed Sep 29, 2021
1 parent dd281d9 commit 09a1718
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,8 @@ void CustomizeWebUIHTMLSource(const std::string &name,
{ "postHeaderTwitter", IDS_BRAVE_REWARDS_TIP_POST_HEADER_TWITTER },
{ "rewardsBannerText1", IDS_BRAVE_UI_REWARDS_BANNER_TEXT1 },
{ "sendDonation", IDS_BRAVE_UI_SEND_DONATION },
{ "siteBannerConnectedText", IDS_BRAVE_UI_SITE_BANNER_CONNECTED_TEXT },
{ "siteBannerNoticeNote", IDS_BRAVE_UI_SITE_BANNER_NOTICE_NOTE },
{ "siteBannerNoticeNotRegistered", IDS_BRAVE_UI_SITE_BANNER_NOTICE_NOT_REGISTERED }, // NOLINT
{ "siteBannerNoticeText", IDS_BRAVE_UI_SITE_BANNER_NOTICE_TEXT },
{ "sorryToSeeYouGo", IDS_BRAVE_REWARDS_TIP_SORRY_TO_SEE_YOU_GO },
{ "supportThisCreator", IDS_BRAVE_REWARDS_TIP_SUPPORT_THIS_CREATOR },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import {
PublisherStatus,
ExternalWalletInfo,
ExternalWalletStatus,
MediaMetaData,
BalanceInfo
MediaMetaData
} from '../lib/interfaces'

import { HostContext } from '../lib/host_context'
Expand Down Expand Up @@ -162,11 +161,12 @@ function getVerifiedIcon (publisherInfo: PublisherInfo) {

function showUnverifiedNotice (
publisherInfo: PublisherInfo,
balanceInfo?: BalanceInfo,
externalWalletInfo?: ExternalWalletInfo
) {
// Show the notice if the publisher is not registered
if (publisherInfo.status === PublisherStatus.NOT_VERIFIED) {
// Show the notice if the publisher is not registered, or if the publisher
// does not have a verified payment address
if (publisherInfo.status === PublisherStatus.NOT_VERIFIED ||
publisherInfo.status === PublisherStatus.CONNECTED) {
return true
}

Expand All @@ -192,28 +192,22 @@ function showUnverifiedNotice (
return externalWalletInfo.type !== 'gemini'
}

// Show the notice if the user does not have any brave funds
const hasBraveFunds = Boolean(balanceInfo && (
balanceInfo.wallets['anonymous'] ||
balanceInfo.wallets['blinded']))

return !hasBraveFunds
return false
}

function getUnverifiedNotice (
locale: Locale,
publisherInfo: PublisherInfo,
balanceInfo: BalanceInfo | undefined,
walletInfo: ExternalWalletInfo | undefined
) {
if (!showUnverifiedNotice(publisherInfo, balanceInfo, walletInfo)) {
if (!showUnverifiedNotice(publisherInfo, walletInfo)) {
return null
}

const { getString } = locale

const text = getString(publisherInfo.status === PublisherStatus.CONNECTED
? 'siteBannerConnectedText'
const text = getString(publisherInfo.status === PublisherStatus.NOT_VERIFIED
? 'siteBannerNoticeNotRegistered'
: 'siteBannerNoticeText')

return (
Expand Down Expand Up @@ -330,15 +324,12 @@ export function PublisherBanner () {

const [publisherInfo, setPublisherInfo] = React.useState(
host.state.publisherInfo)
const [balanceInfo, setBalanceInfo] = React.useState(
host.state.balanceInfo)
const [walletInfo, setWalletInfo] = React.useState(
host.state.externalWalletInfo)

React.useEffect(() => {
return host.addListener((state) => {
setPublisherInfo(state.publisherInfo)
setBalanceInfo(state.balanceInfo)
setWalletInfo(state.externalWalletInfo)
})
}, [host])
Expand Down Expand Up @@ -377,7 +368,7 @@ export function PublisherBanner () {
<style.socialLinks>
{getSocialLinks(publisherInfo)}
</style.socialLinks>
{getUnverifiedNotice(locale, publisherInfo, balanceInfo, walletInfo)}
{getUnverifiedNotice(locale, publisherInfo, walletInfo)}
<style.title>
{getTitle(locale, publisherInfo, mediaMetaData)}
</style.title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const localeStrings = {
postHeaderTwitter: '$1’s tweet',
rewardsBannerText1: 'You can support this content creator by sending a tip. It’s a way of thanking them for making great content. Verified creators get paid for their tips during the first week of each calendar month.',
sendDonation: 'Send Tip',
siteBannerConnectedText: 'This Brave Verified Creator has not yet configured their account to receive contributions from Brave users. Your browser will keep trying to contribute until they verify, or until 90 days have passed.',
siteBannerNoticeNote: 'NOTE:',
siteBannerNoticeText: 'This creator has not yet signed up to receive contributions from Brave users. Your browser will keep trying to contribute until they verify, or until 90 days have passed.',
siteBannerNoticeNotRegistered: 'This creator is not signed up yet. Any tip you make will remain pending in your wallet and retry automatically for 90 days.',
siteBannerNoticeText: 'This creator is currently not configured to receive tips from your wallet. Any tip you make will remain pending in your wallet and retry automatically for 90 days. Learn more.',
sorryToSeeYouGo: 'Sorry to see you go…',
supportThisCreator: 'Support this creator',
thanksForTheSupport: 'Thanks for the support!',
Expand Down
2 changes: 1 addition & 1 deletion components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@
<message name="IDS_BRAVE_UI_REWARDS_CREATING_TEXT" desc="">Creating wallet</message>
<message name="IDS_BRAVE_UI_SITE_BANNER_NOTICE_NOTE" desc="">NOTE:</message>
<message name="IDS_BRAVE_UI_SITE_BANNER_NOTICE_TEXT" desc="">This creator is currently not configured to receive tips from your wallet. Any tip you make will remain pending in your wallet and retry automatically for 90 days.</message>
<message name="IDS_BRAVE_UI_SITE_BANNER_CONNECTED_TEXT" desc="Text shown for connected publishers that are not fully verified on site banner">This Brave Verified Creator has not yet configured their account to receive contributions from Brave users. Your browser will keep trying to contribute until they verify, or until 90 days have passed.</message>
<message name="IDS_BRAVE_UI_SITE_BANNER_NOTICE_NOT_REGISTERED" desc="">This creator is not signed up yet. Any tip you make will remain pending in your wallet and retry automatically for 90 days.</message>
<message name="IDS_BRAVE_UI_SITE_UNVERIFIED_TEXT_MORE" desc="">Learn more.</message>
<message name="IDS_BRAVE_UI_PENDING_CONTRIBUTIONS" desc="Title of pending contribution modal">Pending contributions</message>
<message name="IDS_BRAVE_UI_PENDING_TYPE_RECURRING" desc="Name of recurring tip type">Monthly Contribution</message>
Expand Down

0 comments on commit 09a1718

Please sign in to comment.