Skip to content

Commit cd47c55

Browse files
committed
Display welcome notification when user connects external wallet
1 parent 04f83ad commit cd47c55

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

app/brave_generated_resources.grd

+6
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,12 @@ Or change later at <ph name="SETTINGS_EXTENIONS_LINK">$2<ex>brave://settings/ext
645645
<message name="IDS_BRAVE_ADS_NOTIFICATION_AD_ACCESSIBLE_NAME" desc="Text to be spoken when a notification ad is shown">
646646
Brave Notification Ad
647647
</message>
648+
<message name="IDS_BRAVE_ADS_NOTIFICATION_EXTERNAL_WALLET_CONNECTED_TITLE" desc="The notification title to show when an external wallet is connected">
649+
&#x1F389; You're now earning for Brave Ads!
650+
</message>
651+
<message name="IDS_BRAVE_ADS_NOTIFICATION_EXTERNAL_WALLET_CONNECTED_BODY" desc="The notification body to show when an external wallet is connected">
652+
For example, you earn whenever a notification like this appears on your screen. You don't need to click to earn.
653+
</message>
648654

649655
<!-- Brave Search -->
650656
<message name="IDS_SETTINGS_WEB_DISCOVERY_LABEL" desc="Description that shows settings for toggle Web Discovery">

components/brave_ads/browser/ads_service_impl.cc

+17
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "brave/components/brave_rewards/common/pref_names.h"
6161
#include "brave/components/brave_rewards/common/rewards_flags.h"
6262
#include "brave/components/l10n/common/locale_util.h"
63+
#include "brave/components/l10n/common/localization_util.h"
6364
#include "brave/grit/brave_generated_resources.h"
6465
#include "build/build_config.h"
6566
#include "chrome/browser/browser_process.h"
@@ -2101,6 +2102,22 @@ void AdsServiceImpl::OnRewardsWalletUpdated() {
21012102

21022103
void AdsServiceImpl::OnExternalWalletConnected() {
21032104
SetBooleanPref(prefs::kShouldMigrateVerifiedRewardsUser, true);
2105+
2106+
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
2107+
if (!IsEnabled() || !CheckIfCanShowNotificationAds()) {
2108+
return;
2109+
}
2110+
2111+
base::Value::Dict dict;
2112+
dict.Set("title",
2113+
brave_l10n::GetLocalizedResourceUTF16String(
2114+
IDS_BRAVE_ADS_NOTIFICATION_EXTERNAL_WALLET_CONNECTED_TITLE));
2115+
dict.Set("body",
2116+
brave_l10n::GetLocalizedResourceUTF16String(
2117+
IDS_BRAVE_ADS_NOTIFICATION_EXTERNAL_WALLET_CONNECTED_BODY));
2118+
dict.Set("uuid", base::GUID::GenerateRandomV4().AsLowercaseString());
2119+
ShowNotificationAd(std::move(dict));
2120+
#endif
21042121
}
21052122

21062123
void AdsServiceImpl::OnCompleteReset(const bool success) {

0 commit comments

Comments
 (0)