Skip to content

Commit

Permalink
Hide Later button in adaptive captcha notification instead of disabli…
Browse files Browse the repository at this point in the history
…ng it
  • Loading branch information
emerick committed Nov 12, 2021
1 parent 4608fbf commit 900bbb5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions browser/brave_ads/tooltips/ads_tooltips_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AdsTooltipsController::~AdsTooltipsController() = default;
void AdsTooltipsController::ShowCaptchaTooltip(
const std::string& payment_id,
const std::string& captcha_id,
bool enable_cancel_button,
bool include_cancel_button,
ShowScheduledCaptchaCallback show_captcha_callback,
SnoozeScheduledCaptchaCallback snooze_captcha_callback) {
const std::u16string title = l10n_util::GetStringUTF16(
Expand All @@ -36,12 +36,13 @@ void AdsTooltipsController::ShowCaptchaTooltip(
IDS_BRAVE_ADS_SCHEDULED_CAPTCHA_NOTIFICATION_BODY);
const std::u16string ok_button_text = l10n_util::GetStringUTF16(
IDS_BRAVE_ADS_SCHEDULED_CAPTCHA_NOTIFICATION_OK_BUTTON_TEXT);
const std::u16string cancel_button_text = l10n_util::GetStringUTF16(
std::u16string cancel_button_text = l10n_util::GetStringUTF16(
IDS_BRAVE_ADS_SCHEDULED_CAPTCHA_NOTIFICATION_CANCEL_BUTTON_TEXT);

brave_tooltips::BraveTooltipAttributes tooltip_attributes(
title, body, ok_button_text, cancel_button_text);
tooltip_attributes.set_cancel_button_enabled(enable_cancel_button);
title, body, ok_button_text,
include_cancel_button ? cancel_button_text : u"");
tooltip_attributes.set_cancel_button_enabled(include_cancel_button);
auto captcha_tooltip = std::make_unique<AdsCaptchaTooltip>(
std::move(show_captcha_callback), std::move(snooze_captcha_callback),
tooltip_attributes, payment_id, captcha_id);
Expand Down
2 changes: 1 addition & 1 deletion browser/brave_ads/tooltips/ads_tooltips_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AdsTooltipsController : public AdsTooltipsDelegate,
void ShowCaptchaTooltip(
const std::string& payment_id,
const std::string& captcha_id,
bool enable_cancel_button,
bool include_cancel_button,
ShowScheduledCaptchaCallback show_captcha_callback,
SnoozeScheduledCaptchaCallback snooze_captcha_callback) override;
void CloseCaptchaTooltip() override;
Expand Down
4 changes: 2 additions & 2 deletions browser/brave_ads/tooltips/ads_tooltips_delegate_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ AdsTooltipsDelegateImpl::AdsTooltipsDelegateImpl(Profile* profile)
void AdsTooltipsDelegateImpl::ShowCaptchaTooltip(
const std::string& payment_id,
const std::string& captcha_id,
bool enable_cancel_button,
bool include_cancel_button,
ShowScheduledCaptchaCallback show_captcha_callback,
SnoozeScheduledCaptchaCallback snooze_captcha_callback) {
ads_tooltips_controller_.ShowCaptchaTooltip(
payment_id, captcha_id, enable_cancel_button,
payment_id, captcha_id, include_cancel_button,
std::move(show_captcha_callback), std::move(snooze_captcha_callback));
}

Expand Down
2 changes: 1 addition & 1 deletion browser/brave_ads/tooltips/ads_tooltips_delegate_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AdsTooltipsDelegateImpl : public AdsTooltipsDelegate {
void ShowCaptchaTooltip(
const std::string& payment_id,
const std::string& captcha_id,
bool enable_cancel_button,
bool include_cancel_button,
ShowScheduledCaptchaCallback show_captcha_callback,
SnoozeScheduledCaptchaCallback snooze_captcha_callback) override;
void CloseCaptchaTooltip() override;
Expand Down
2 changes: 1 addition & 1 deletion components/brave_ads/browser/ads_tooltips_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AdsTooltipsDelegate {
virtual void ShowCaptchaTooltip(
const std::string& payment_id,
const std::string& captcha_id,
bool enable_cancel_button,
bool include_cancel_button,
ShowScheduledCaptchaCallback show_captcha_callback,
SnoozeScheduledCaptchaCallback snooze_captcha_callback) = 0;

Expand Down

0 comments on commit 900bbb5

Please sign in to comment.