Skip to content

Commit

Permalink
Merge pull request #21820 from brave/ksmith-solana-fixups-2
Browse files Browse the repository at this point in the history
Rewards self-custody linking improvements
  • Loading branch information
zenparsing authored Jan 31, 2024
2 parents 3a3aa0b + e237ffe commit df82987
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
18 changes: 7 additions & 11 deletions components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1292,21 +1292,17 @@ std::vector<std::string> RewardsServiceImpl::GetExternalWalletProviders()

if (IsBitFlyerCountry()) {
providers.push_back(internal::constant::kWalletBitflyer);
return providers;
}

if (GetCountryCode() == "IN") {
} else if (GetCountryCode() == "IN") {
providers.push_back(internal::constant::kWalletZebPay);
return providers;
}

providers.push_back(internal::constant::kWalletUphold);
} else {
providers.push_back(internal::constant::kWalletUphold);

#if BUILDFLAG(ENABLE_GEMINI_WALLET)
if (base::FeatureList::IsEnabled(features::kGeminiFeature)) {
providers.push_back(internal::constant::kWalletGemini);
}
if (base::FeatureList::IsEnabled(features::kGeminiFeature)) {
providers.push_back(internal::constant::kWalletGemini);
}
#endif
}

if (base::FeatureList::IsEnabled(
features::kAllowSelfCustodyProvidersFeature)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ void LinkageChecker::Stop() {
}

void LinkageChecker::CheckLinkage() {
if (!ShouldPerformCheck()) {
if (check_in_progress_ || !ShouldPerformCheck()) {
return;
}
check_in_progress_ = true;
endpoints::RequestFor<endpoints::GetWallet>(engine()).Send(base::BindOnce(
&LinkageChecker::CheckLinkageCallback, weak_factory_.GetWeakPtr()));
}
Expand Down Expand Up @@ -146,6 +147,7 @@ void LinkageChecker::UpdateSelfCustodyAvailableDict(

void LinkageChecker::CheckLinkageCallback(
endpoints::GetWallet::Result&& result) {
check_in_progress_ = false;
if (!result.has_value()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LinkageChecker : public RewardsEngineHelper {
void UpdateSelfCustodyAvailableDict(endpoints::GetWallet::Value& value);
void CheckLinkageCallback(endpoints::GetWallet::Result&& result);

bool check_in_progress_ = false;
base::RepeatingTimer timer_;
base::WeakPtrFactory<LinkageChecker> weak_factory_{this};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void SolanaWalletProvider::OnWalletLinked(const std::string& address) {
}

engine().SetState(state::kExternalWalletType, std::string(WalletType()));
engine().SetState(state::kAutoContributeEnabled, false);
client().ExternalWalletConnected();
engine().database()->SaveEventLog(
log::kWalletVerified,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const root = styled.div.attrs({
left: 0;
bottom: 0;
right: 0;
overscroll-behavior: contain;
font: ${leo.font.default.regular};
background: ${leo.color.container.background};
overflow: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export function ConnectWalletModal (props: Props) {
const [selectedProvider, setSelectedProvider] =
React.useState<ExternalWalletProvider | null>(null)

React.useEffect(() => {
// While this overlay is displayed, hide any scrollbars attached to the
// document body, as that can result in two visible scrollbars on some
// platforms.
document.body.style.overflow = 'hidden';
return () => { document.body.style.overflow = ''; }
}, []);

if (props.providers.length === 0) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const localeStrings = {
rewardsConnectAccount: 'Connect account',
rewardsNotNow: 'Not now',
rewardsSelfCustodyInviteHeader: 'Receive BAT directly to a self-custody crypto address',
rewardsSelfCustodyInviteText: 'We’ve added a new option for paying out monthly BAT rewards. Connect a custodial account, or a self-custody wallet to receive Rewards.',
rewardsSelfCustodyInviteText: 'We’ve added a new way for you to receive your monthly BAT rewards. Connect an account from one of our partners or use the new self-custody option to start earning now.',
rewardsVBATNoticeTitle1: 'Action required: Connect a custodial account or your vBAT will be lost',
rewardsVBATNoticeText1: 'On $1, we will be discontinuing support for existing virtual BAT balances. Connect a custodial account before this date so we can transfer your earned balance to your custodial account, otherwise your balance will be lost.',
rewardsVBATNoticeTitle2: 'You still have time to contribute your vBAT to your favorite creators',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const localeStrings = {
rewardsSelectCountryHeader: 'Select your country',
rewardsSelectCountryText: 'To continue using Brave Rewards, select your country so we can show you the right options and ads for your region. $1Privacy Policy$2',
rewardsSelfCustodyInviteHeader: 'Receive BAT directly to a self-custody crypto address',
rewardsSelfCustodyInviteText: 'We’ve added a new option for paying out monthly BAT rewards. Connect a custodial account, or a self-custody wallet to receive Rewards.',
rewardsSelfCustodyInviteText: 'We’ve added a new way for you to receive your monthly BAT rewards. Connect an account from one of our partners or use the new self-custody option to start earning now.',
rewardsSettings: 'Rewards settings',
rewardsStartUsingRewards: 'Start using Rewards',
rewardsTokenGrantTitle: 'A token grant is available!',
Expand Down
2 changes: 1 addition & 1 deletion components/resources/rewards_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
Receive BAT directly to a self-custody crypto address
</message>
<message name="IDS_REWARDS_SELF_CUSTODY_INVITE_TEXT" desc="">
We’ve added a new option for paying out monthly BAT rewards. Connect a custodial account, or a self-custody wallet to receive Rewards.
We’ve added a new way for you to receive your monthly BAT rewards. Connect an account from one of our partners or use the new self-custody option to start earning now.
</message>

<!-- Tip panel -->
Expand Down

0 comments on commit df82987

Please sign in to comment.