Skip to content

Commit

Permalink
Merge pull request #16265 from brave/bn-disable-uplift-1.46
Browse files Browse the repository at this point in the history
[Brave News Uplift]: Don't show subscribe button until opted in to Brave News #16161
  • Loading branch information
kjozwiak authored Dec 8, 2022
2 parents b5a3918 + 68ba9e3 commit cb676f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion browser/ui/views/brave_actions/brave_news_action_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ BraveNewsActionView::BraveNewsActionView(Profile* profile,
profile->GetPrefs(),
base::BindRepeating(&BraveNewsActionView::Update,
base::Unretained(this)));
opted_in_.Init(brave_news::prefs::kBraveTodayOptedIn, profile->GetPrefs(),
base::BindRepeating(&BraveNewsActionView::Update,
base::Unretained(this)));
news_enabled_.Init(brave_news::prefs::kNewTabPageShowToday,
profile->GetPrefs(),
base::BindRepeating(&BraveNewsActionView::Update,
Expand Down Expand Up @@ -105,7 +108,8 @@ void BraveNewsActionView::Init() {
}

void BraveNewsActionView::Update() {
if (!should_show_.GetValue() || !news_enabled_.GetValue()) {
if (!should_show_.GetValue() || !opted_in_.GetValue() ||
!news_enabled_.GetValue()) {
SetVisible(false);
return;
}
Expand Down
1 change: 1 addition & 0 deletions browser/ui/views/brave_actions/brave_news_action_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class BraveNewsActionView : public views::LabelButton,
SkColor GetIconColor(bool subscribed) const;

BooleanPrefMember should_show_;
BooleanPrefMember opted_in_;
BooleanPrefMember news_enabled_;

base::raw_ptr<Profile> profile_;
Expand Down

0 comments on commit cb676f1

Please sign in to comment.