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

Implement new logic for backup prompt #6388

Merged
merged 4 commits into from
Jan 13, 2025
Merged

Implement new logic for backup prompt #6388

merged 4 commits into from
Jan 13, 2025

Conversation

walmat
Copy link
Contributor

@walmat walmat commented Jan 8, 2025

Fixes APP-2237

What changed (plus any additional context for devs)

1. Backup Sheet Component Updates

New Components

  • Added CloudBackupPrompt component for cloud backup flows
  • Added ManualBackupPrompt component for manual backup flows
  • Improved separation of concerns between backup types

Backup Step Types Refactor

  • Renamed and consolidated backup step types
  • Removed redundant step types
  • Added new step types for different prompt scenarios:
    • backup_prompt_manual
    • backup_prompt_cloud
    • create_cloud_backup

2. Backup Store Enhancements

New State Management

  • Added tracking for backup prompt frequency
  • Implemented timesPromptedForBackup counter
  • Added lastBackupPromptAt timestamp tracking
  • Added persistence for backup prompt state

Prompt Logic

  • Added weekly prompt schedule
  • Implemented progressive delay between prompts
  • Added proper cleanup on component unmount

3. Wallet Import Flow Improvements

Cloud Backup Integration

  • Added automatic cloud backup prompt after wallet import
  • Added conditions to skip prompt for certain wallet types
  • Improved navigation flow after backup completion

Error Handling

  • Added proper error handling for Google Sign-In
  • Improved timeout handling for backup operations
  • Added retry logic for failed backup attempts

This PR significantly improves the backup system by introducing separate prompts for different backup types, implementing a smarter prompting system, and adding proper state management for backup-related user interactions.

Screen recordings / screenshots

// wip

What to test

TF 1.9.53 (7)

Copy link

linear bot commented Jan 8, 2025

@walmat walmat marked this pull request as ready for review January 8, 2025 19:05
@brunobar79
Copy link
Member

Launch in simulator or device for 0d10498

Copy link
Contributor

@maxbbb maxbbb left a comment

Choose a reason for hiding this comment

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

lgtm, just a few non blocking nits

const { backupProvider, timesPromptedForBackup, lastBackupPromptAt } = backupsStore.getState();

// prompt for backup every week if first time prompting, otherwise prompt every 2 weeks
if (lastBackupPromptAt && Date.now() - lastBackupPromptAt < oneWeekInMs * (timesPromptedForBackup + 1)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Initially I thought this behavior would delay the next prompt by an additional week after every prompt (2 weeks, 3 weeks, etc). But it seems that timesPromptedForBackup is only ever set to 0 or 1, which is kind of confusing because I would assume timesPromptedForBackup gets incremented every time they are prompted.

Copy link
Contributor Author

@walmat walmat Jan 10, 2025

Choose a reason for hiding this comment

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

According to spec we want 1 week after first prompt then every 2 weeks until backed up

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I get that was just saying the variable being named timesPromptedForBackup was confusing because it does not actually represent the number of times a user has been prompted for backup, it's only ever 0 or 1. Just a variable naming complaint, doesn't actually matter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, I could name it something like weeklyMultiplier or something more representative

src/components/backup/ManualBackupPrompt.tsx Outdated Show resolved Hide resolved
src/handlers/walletReadyEvents.ts Outdated Show resolved Hide resolved
src/components/backup/BackupSheet.tsx Show resolved Hide resolved
@brunobar79
Copy link
Member

Launch in simulator or device for 2b9540d

Copy link
Member

@derHowie derHowie left a comment

Choose a reason for hiding this comment

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

💯

@walmat walmat merged commit d3e8172 into develop Jan 13, 2025
11 checks passed
@walmat walmat deleted the @matthew/APP-2237 branch January 13, 2025 19:01
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.

4 participants