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

Add rewards everywhere onboarding #7050

Merged
merged 1 commit into from
Nov 10, 2020
Merged

Conversation

zenparsing
Copy link
Collaborator

@zenparsing zenparsing commented Nov 4, 2020

Resolves brave/brave-browser#12138

Adds rewards onboarding modals to:

  • Tip dialog
  • Rewards panel
  • Rewards page

Implementation notes (C++):

  • A rewards pref (kOnboarded, stored as a time value) was added to store whether a user had interacted with the onboarding experience. The onboarding modals are not displayed when this preference is not null.
  • The following methods were added to RewardsService
    • bool ShouldShowOnboarding(): returns true if the rewards onboarding UX should be shown to the user.
    • void SaveOnboardingResult(OnboardingResult result): sets the kOnboarded pref and optionally turns on both AC and ads (if result is OnboardingResult::kOptedIn).

Implementation notes (front-end):

  • New onboarding front-end code is added under shared/components/onboarding.
  • New storybook stories were added under "shared/components/onboarding".
  • Some modules were promoted from tip/lib and tip/components into shared/lib and shared/components, respectively.
  • A new component WithThemeVariables was added to inject brave theme variables as CSS custom properties.
  • LocalContext.Provider and WithThemeVariables was added to the rewards panel and rewards page top-level components.
  • An existing field in the rewards page store, store.ui.onBoardingDisplayed was renamed to store.ui.verifyOnboardingDisplayed to avoid naming confusion.

Submitter Checklist:

Test Plan:

Rewards Panel (dismissing case):

  • Start the browser with a clean profile.
  • Click the rewards badge.
    • Verify that "Earn Tokens & Give Back" modal is displayed within the rewards panel.
  • Click the "Terms of Service" link.
  • Close the new tab and re-open the rewards panel.
  • Click the "Privacy Policy" link.
  • Close the new tab and re-open the rewards panel.
  • Click the "X" button to close the onboarding modal.
  • Close the rewards panel.
  • Open the rewards panel.
    • Verify that onboarding modal is not displayed.
  • Navigate to brave://rewards
    • Verify that ads and auto-contribute are disabled.

Rewards panel (opting-in case):

  • Start the browser with a clean profile.
  • Click the rewards badge to open the rewards panel.
  • Click the "Start using Brave Rewards" button.
  • Close the rewards panel.
  • Open the rewards panel.
    • Verify that onboarding modal is not displayed.
  • Navigate to brave://rewards
    • Verify that ads and auto-contribute are enabled.

Inline tipping (dismissing case):

  • Start the browser with a clean profile.
  • Click the rewards badge to ensure that rewards extension is running.
  • Navigate to a Twitter user page (e.g. https://twitter.com/bravelaurenwags)
  • Click on an inline "Tip" button.
    • Verify that tip dialog is opened with an onboarding screen.
  • Click the "Terms of Service" link.
  • Close the new tab.
  • Click the "Privacy Policy" link.
  • Close the new tab.
  • Click the "Maybe Later" link.
    • Verify that inline tipping form is now displayed.
  • Close the tip dialog.
  • Open the rewards panel.
  • Navigate to brave://rewards
    • Verify that ads and auto-contribute are disabled.

Inline tipping (opting-in case):

  • Start the browser with a clean profile.
  • Click the rewards badge to ensure that rewards extension is running.
  • Navigate to a Twitter user page (e.g. https://twitter.com/bravelaurenwags)
  • Click on an inline "Tip" button.
    • Verify that tip dialog is opened with an onboarding screen.
  • Click the "Start using Brave Rewards" button.
    • Verify that the inline tipping form is now displayed.
  • Close the tip dialog.
  • Open the rewards panel.
    • Verify that the onboarding modal is not displayed.
  • Navigate to brave://rewards
    • Verify that ads and auto-contribute are enabled.

Rewards page (dismissing case):

Rewards page (opting-in case):

  • Start the browser with a clean profile.
  • Navigate to brave://rewards.
  • Click the "Start using Brave Rewards" button.
    • Verify that ads and auto-contribute are enabled.
  • Open the rewards panel.
    • Verify that onboarding modal is not displayed.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@zenparsing zenparsing force-pushed the ksmith-rewards-onboarding branch 5 times, most recently from d30ed00 to 3f7af77 Compare November 9, 2020 15:42
@zenparsing zenparsing marked this pull request as ready for review November 9, 2020 17:37
@zenparsing zenparsing requested a review from a team as a code owner November 9, 2020 17:37
@zenparsing zenparsing force-pushed the ksmith-rewards-onboarding branch 2 times, most recently from ef02004 to f41277b Compare November 9, 2020 19:05
@zenparsing zenparsing requested a review from tmancey as a code owner November 9, 2020 19:05
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM

@zenparsing zenparsing force-pushed the ksmith-rewards-onboarding branch from 911f9e9 to 785384c Compare November 10, 2020 14:27
@zenparsing
Copy link
Collaborator Author

Updates:

  • SaveOnboardingResult uses ads_service->SetEnabled(true) instead of the pref service directly.
  • Made ShouldShowOnboarding a const method.
  • Fixed styling of terms of service on tip dialog to match onboarding TOS styling.

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM++

@NejcZdovc NejcZdovc added this to the 1.18.x - Nightly milestone Nov 10, 2020
@zenparsing
Copy link
Collaborator Author

MacOS CI failed on unrelated test-install step.

@zenparsing zenparsing merged commit 40b5c4c into master Nov 10, 2020
@zenparsing zenparsing deleted the ksmith-rewards-onboarding branch November 10, 2020 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement earn and give onboarding flow
4 participants