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

Adding periodic reminder modal for backing up recovery phrase #11021

Merged
merged 2 commits into from Jun 5, 2021

Conversation

ryanml
Copy link
Contributor

@ryanml ryanml commented May 10, 2021

The goal is to display this reminder two days after wallet creation/import (or in the case of an update, two days from that point). After the user dismisses the reminder, it will subsequently appear every 90 days.

Manual Test Plan

  1. In app/scripts/controllers/app-state.js, set REMINDER_CHECK_INTERVAL to equal time.SECOND * 30 (30 seconds), INITIAL_REMINDER_FREQUENCY to equal time.MINUTE * 2 (2 minutes), and FOLLOWUP_REMINDER_FREQUENCY to equal time.MINUTE * 4 (4 minutes)
  2. Run a dev build from this branch
  3. Create/Import a wallet
  4. View Notifications and dismiss "what's new popup" (this notification should not appear when the "what's new popup" is open)
  5. Confirm after 2 minutes that the reminder appears.
  6. Dismiss the reminder
  7. Confirm that after 4 minutes, the reminder appears agin.
  8. Dismiss the reminder, re-confirm step 7

Appearance

(User has not backed up their seed phrase)

Screen Shot 2021-05-09 at 8 02 20 PM (1)

(User has backed up their seed phrase)

Screen Shot 2021-05-09 at 8 04 13 PM (1)

@ryanml ryanml self-assigned this May 10, 2021
@ryanml ryanml dismissed a stale review via 1ee7b23 May 10, 2021 03:37
@metamaskbot
Copy link
Collaborator

Builds ready [1ee7b23]
Page Load Metrics (582 ± 40 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint417655105
domContentLoaded3586855818340
load3596865828340
domInteractive3576845808340

@ryanml ryanml marked this pull request as ready for review May 12, 2021 12:36
@ryanml ryanml requested a review from a team as a code owner May 12, 2021 12:36
@ryanml ryanml requested a review from danjm May 12, 2021 12:36
@@ -17,6 +17,7 @@ const Popover = ({
showArrow,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per the designs, there is no 'X' button (closure happens upon clicking "Got it!" at the bottom of the popup), and the title is centered.

@ryanml ryanml force-pushed the backup-reminder-modal branch 2 times, most recently from d2f98f1 to 64ae808 Compare May 12, 2021 12:55
@metamaskbot
Copy link
Collaborator

Builds ready [64ae808]
Page Load Metrics (555 ± 43 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint42785994
domContentLoaded3926895539043
load3936905559043
domInteractive3926885539043

@@ -0,0 +1,5 @@
export const MILLISECOND = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After merge I'll put up a change to use these across the codebase where applicable

}

// Capture the current timestamp
const currentTime = new Date().getTime();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: we could move this var declaration above if (recoveryPhraseReminderLastShown === 0) { and then use it on line 181.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, i can update this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@metamaskbot
Copy link
Collaborator

Builds ready [2962484]
Page Load Metrics (578 ± 37 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint43715484
domContentLoaded3856335777737
load3866355787737
domInteractive3846335767737

@danjm
Copy link
Contributor

danjm commented May 19, 2021

There might be a way that this can be simplified so that fewer background code additions are needed and no migration is required.

What I'm thinking is:

  • recoveryPhraseReminderLastShown can be exposed via state to the front end
  • Instead of shouldShowRecoveryPhraseReminder as a property, it could be a redux selector. This selector could compare the current time to the recoveryPhraseReminderLastShown time. If recoveryPhraseReminderLastShown is not yet defined, assume that the user has never been shown the reminder, and return true if (currentTime - 0) > 2 days. If recoveryPhraseReminderLastShown is defined, assume the user has seen the reminder before, and return true if (currentTime - 0) > 90 days
  • then, instead of calling setRecoveryPhraseReminderHasBeenShown from the front end when the reminder is closed, just call setRecoveryPhraseReminderLastShown with the current date/time

With this, I think we can greatly reduce the amount of background code added with this PR, and remove the need for a migration.

Let me know what you think.

@ryanml
Copy link
Contributor Author

ryanml commented May 24, 2021

@danjm - I have refactored this PR per our discussion. cc: @darkwing

@ryanml ryanml force-pushed the backup-reminder-modal branch 2 times, most recently from c4d1ca9 to 2f73ba8 Compare May 24, 2021 03:07
@metamaskbot
Copy link
Collaborator

Builds ready [2f73ba8]
Page Load Metrics (578 ± 30 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint43655684
domContentLoaded4006415776330
load4016425786330
domInteractive3996415766330

@metamaskbot
Copy link
Collaborator

Builds ready [664acf8]
Page Load Metrics (723 ± 60 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint55876684
domContentLoaded43594572212560
load43694672312560
domInteractive43494572112560

Copy link
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

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

My major suggestion involved the refactor to simplify controller logic. Those changes look good and this PR looks good overall to me. Nice work!

@ryanml ryanml merged commit 9932c40 into develop Jun 5, 2021
@ryanml ryanml deleted the backup-reminder-modal branch June 5, 2021 06:33
ryanml added a commit that referenced this pull request Jun 22, 2021
* Adding recurring recovery phrase reminder modal

* Refactoring per PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants