Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTP / FTX fix group #9074

Merged
merged 5 commits into from
Jun 11, 2021
Merged

NTP / FTX fix group #9074

merged 5 commits into from
Jun 11, 2021

Conversation

petemill
Copy link
Member

@petemill petemill commented Jun 10, 2021

Fixes for New Tab Page, especially the FTX widget:

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

@petemill petemill self-assigned this Jun 10, 2021
@simonhong
Copy link
Member

simonhong commented Jun 11, 2021

@petemill I filed one more issue about FTX widget - brave/brave-browser#16358
IMO, it would be good to resolve this also because you're trying to resolve most of FTX issues in this PR.
Of course, handling it separately is also nice :)

@petemill
Copy link
Member Author

I think I won't solve that one, or will solve it later. I didn't feel we needed to save this as a preference yet:

I think this is a small issue or not an issue at all. It only matters for connecting and authenticating. So if the user doesn't authenticate for that page view then they have to choose the option when they do want to connect. The API calls made when not connected are not affected, so it has no effect.

@simonhong
Copy link
Member

I think I won't solve that one, or will solve it later. I didn't feel we needed to save this as a preference yet:

I think this is a small issue or not an issue at all. It only matters for connecting and authenticating. So if the user doesn't authenticate for that page view then they have to choose the option when they do want to connect. The API calls made when not connected are not affected, so it has no effect.

I filed that issue after seeing binance widget saves it in prefs.
but I agreed. ftx widget UI doesn't have any difference on that option and it's not used after connecting.

test/BUILD.gn Outdated Show resolved Hide resolved
@@ -295,6 +295,7 @@ class NewTabPage extends React.Component<Props, State> {
}

toggleShowFTX = () => {
this.props.actions.ftx.disconnect()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should apply this also to cryptodotcom widget :)

@petemill petemill force-pushed the ntp-fixes branch 2 times, most recently from 1507781 to 652a92d Compare June 11, 2021 05:39
Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

VLOG(1) << "Migrating hide widget pref...";
// If all the widgets are off, assume user wants no future widgets.
bool all_were_off = true;
for (auto* const pref_name : kWidgetPrefNames) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can use std::all_of here

const bool all_were_off = std::all_of(std::begin(kWidgetPrefNames), std::end(kWidgetPrefNames), [prefs](const char* const pref_names) {
  ...
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great tip, thanks!

@petemill
Copy link
Member Author

Android CI fail known unrelated issue.
Otherwise all CI passed.

@petemill petemill merged commit 2e2c4d8 into master Jun 11, 2021
@petemill petemill deleted the ntp-fixes branch June 11, 2021 17:00
@petemill petemill added this to the 1.27.x - Nightly milestone Jun 11, 2021
petemill added a commit that referenced this pull request Jun 14, 2021
@srirambv
Copy link
Contributor

Verification passed on

Brave 1.27.60 Chromium: 91.0.4472.101 (Official Build) nightly (x86_64)
Revision af52a90bf87030dd1523486a1cd3ae25c5d76c9b-refs/branch-heads/4472@{#1462}
OS macOS Version 10.15.7 (Build 19H114)

brave/brave-browser#16123

  • Verified zero balance text is shown and hidden by default
FTX.Zero.Balance.mov

brave/brave-browser#16347

  • Verified hiding the widget disconnects the authenticated state
FTX.Hide.widget.mov

brave/brave-browser#16351

  • Verified only clicking on NTP SI logo has clickthrough
NTP.Click.through.mov

brave/brave-browser#15977

  • Verified nothing is shown when manually enabling Brave News via customise NTP settings
Brave.News.mov

@srirambv
Copy link
Contributor

Verification passed on

Brave 1.27.60 Chromium: 91.0.4472.101 (Official Build) nightly (x86_64)
Revision af52a90bf87030dd1523486a1cd3ae25c5d76c9b-refs/branch-heads/4472@{#1462}
OS macOS Version 10.15.7 (Build 19H114)

brave/brave-browser#16123

  • Verified zero balance text is shown and hidden by default
FTX.Zero.Balance.mov

brave/brave-browser#16347

  • Verified hiding the widget disconnects the authenticated state
FTX.Hide.widget.mov

brave/brave-browser#16351

  • Verified only clicking on NTP SI logo has clickthrough
NTP.Click.through.mov

brave/brave-browser#15977

  • Verified nothing is shown when manually enabling Brave News via customise NTP settings
Brave.News.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants