Skip to content

Commit

Permalink
chore(recovery): Cleanup recovery experiment and remove forced backup (
Browse files Browse the repository at this point in the history
…#3958)

### Description

For ACT-852. Removes all code related to the recovery phrase experiment
in onboarding, and removes forced backup from the app!

### Test plan

Unit and manual tested.

### Related issues

- Fixes ACT-852.

### Backwards compatibility

Yes.
  • Loading branch information
jophish authored Jul 17, 2023
1 parent 5ffffdf commit 8c30c53
Show file tree
Hide file tree
Showing 45 changed files with 147 additions and 2,495 deletions.
4 changes: 4 additions & 0 deletions e2e/src/usecases/NewAccountOnboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
sleep,
waitForElementId,
quickOnboarding,
completeProtectWalletScreen,
} from '../utils/utils'
import { getAddressChunks } from '@celo/utils/lib/address'

Expand Down Expand Up @@ -40,6 +41,9 @@ export default NewAccountOnboarding = () => {
await enterPinUi()
await enterPinUi()

// Protect Wallet screen
await completeProtectWalletScreen()

// Skip Phone Number verification
await element(by.id('PhoneVerificationSkipHeader')).tap()

Expand Down
4 changes: 4 additions & 0 deletions e2e/src/usecases/NewAccountPhoneVerification.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
scrollIntoView,
sleep,
waitForElementId,
completeProtectWalletScreen,
} from '../utils/utils'

const jestExpect = require('expect')
Expand Down Expand Up @@ -40,6 +41,9 @@ export default NewAccountPhoneVerification = () => {
await enterPinUi()
await enterPinUi()

// Protect Wallet screen
await completeProtectWalletScreen()

// Set phone number
await expect(element(by.id('PhoneNumberField'))).toBeVisible()
await element(by.id('PhoneNumberField')).replaceText(examplePhoneNumber)
Expand Down
8 changes: 8 additions & 0 deletions e2e/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,11 @@ export async function getElementTextList(elementId) {
} catch {}
return []
}

export async function completeProtectWalletScreen() {
await expect(element(by.id('recoveryPhraseCard'))).toBeVisible()
await element(by.id('recoveryPhraseCard')).tap()
await enterPinUi()
await expect(element(by.id('protectWalletBottomSheetContinue'))).toBeVisible()
await element(by.id('protectWalletBottomSheetContinue')).tap()
}
17 changes: 0 additions & 17 deletions locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@
"recoveryPhrase": {
"title": "Use Recovery Phrase",
"subtitle": "Write down your recovery phrase"
},
"cloudBackup": {
"title": "Backup to Cloud",
"subtitle": "Restore your wallet without a phrase",
"bottomSheet": {
"title": "Cloud Backup is coming soon!",
"restoreComingSoon": "Cloud backup is a way to restore your wallet without a recovery phrase. We are working on this as fast as we can and will notify you once it's available to use.",
"writeDownPhrase": "In the meantime, please write down your recovery phrase to manually backup your wallet.",
"continue": "Continue to Recovery Phrase"
}
}
},
"recoveryPhrase": {
Expand Down Expand Up @@ -153,12 +143,6 @@
"headerTitle": "Recovery Phrase",
"introBackUpPhrase": "Back Up Recovery Phrase",
"introCompleteQuiz": "Complete our backup quiz to verify that your wallet can be recovered.\n\nIf you wrote it down incorrectly, you won’t be able to access your wallet if anything happens to your device.",
"introTitle": "Your Recovery Phrase",
"introBody": "Your Recovery Phrase is the most important part of your account.\n\nPlease find a private place to set up your Phrase. It takes about five minutes.",
"introPrimaryAction": "Set Up",
"backupSetupTitle": "Set Up Your Recovery Phrase",
"backupSetupBody": "To protect your funds, you're required to set up your Recovery Phrase before you can continue using {{appName}}.",
"delayBackup": "Wait One Hour",
"postSetupTitle": "Your Recovery Phrase",
"postSetupBody": "If you lose your Recovery Phrase, you will lose access to all of your Celo Dollars and CELO. Nobody, not even {{appName}}, will be able to help you recover your account without your Recovery Phrase. Store it in a safe place and do not share it.",
"postSetupCTA": "Learn about your Recovery Phrase",
Expand All @@ -168,7 +152,6 @@
"writeDownKeyExperimental": "Please write down your phrase.",
"completeEducation": "I Understand",
"yourAccountKey": "Your Recovery Phrase",
"backupKeyNotification": "Keep your funds safe. Set up your Recovery Phrase now.",
"backupKeyNotification2": "Keep your funds safe. Back up your Recovery Phrase now.",
"backupKeyCTA": "Finish Backup Now",
"backupKeySummary": "Find a private place and write down your Recovery Phrase. Please store it somewhere safe. Do not save it in your phone.",
Expand Down
12 changes: 0 additions & 12 deletions src/account/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export enum Actions {
INITIALIZE_ACCOUNT_SUCCESS = 'ACCOUNT/INITIALIZE_ACCOUNT_SUCCESS',
INITIALIZE_ACCOUNT_FAILURE = 'ACCOUNT/INITIALIZE_ACCOUNT_FAILURE',
SET_BACKUP_COMPLETED = 'ACCOUNT/SET_BACKUP_COMPLETED',
SET_BACKUP_DELAYED = 'ACCOUNT/SET_BACKUP_DELAYED',
TOGGLE_BACKUP_STATE = 'ACCOUNT/TOGGLE_BACKUP_STATE',
DISMISS_GET_VERIFIED = 'ACCOUNT/DISMISS_GET_VERIFIED',
DISMISS_GOLD_EDUCATION = 'ACCOUNT/DISMISS_GOLD_EDUCATION',
Expand Down Expand Up @@ -112,11 +111,6 @@ export interface SetBackupCompletedAction {
type: Actions.SET_BACKUP_COMPLETED
}

export interface SetBackupDelayedAction {
type: Actions.SET_BACKUP_DELAYED
now: number
}

export interface ToggleBackupState {
type: Actions.TOGGLE_BACKUP_STATE
}
Expand Down Expand Up @@ -187,7 +181,6 @@ export type ActionTypes =
| InitializeAccountSuccessAction
| SetAccountCreationAction
| SetBackupCompletedAction
| SetBackupDelayedAction
| ToggleBackupState
| DismissGetVerifiedAction
| DismissGoldEducationAction
Expand Down Expand Up @@ -301,11 +294,6 @@ export const setBackupCompleted = (): SetBackupCompletedAction => ({
type: Actions.SET_BACKUP_COMPLETED,
})

export const setBackupDelayed = (now: number): SetBackupDelayedAction => ({
type: Actions.SET_BACKUP_DELAYED,
now,
})

export const toggleBackupState = (): ToggleBackupState => ({
type: Actions.TOGGLE_BACKUP_STATE,
})
Expand Down
16 changes: 3 additions & 13 deletions src/account/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { isE164NumberStrict } from '@celo/phone-utils'
import { Actions, ActionTypes } from 'src/account/actions'
import { Actions as AppActions, ActionTypes as AppActionTypes } from 'src/app/actions'
import { DAYS_TO_DELAY } from 'src/backup/consts'
import { DEV_SETTINGS_ACTIVE_INITIALLY } from 'src/config'
import { getRehydratePayload, REHYDRATE, RehydrateAction } from 'src/redux/persist-helper'
import Logger from 'src/utils/Logger'
import { ONE_DAY_IN_MILLIS } from 'src/utils/time'
import { Actions as Web3Actions, ActionTypes as Web3ActionTypes } from 'src/web3/actions'

export interface State {
Expand All @@ -20,7 +18,6 @@ export interface State {
pincodeType: PincodeType
backupCompleted: boolean
accountCreationTime: number
backupRequiredTime: number | null
startOnboardingTime: number | undefined
dismissedGetVerified: boolean
dismissedGoldEducation: boolean
Expand Down Expand Up @@ -69,9 +66,9 @@ export enum FinclusiveKycStatus {
}

export enum RecoveryPhraseInOnboardingStatus {
NotStarted = 'NotStarted', // ineligible and control users, and variant users who have not reached the "ProtectWallet" screen
InProgress = 'InProgress', // variant users who have reached the "ProtectWallet" screen, but not clicked "I've saved it"
Completed = 'Completed', // variant users who have clicked "I've saved it"
NotStarted = 'NotStarted', // users who have not reached the "ProtectWallet" screen
InProgress = 'InProgress', // users who have reached the "ProtectWallet" screen, but not clicked "I've saved it"
Completed = 'Completed', // users who have clicked "I've saved it"
}

export const initialState: State = {
Expand All @@ -88,7 +85,6 @@ export const initialState: State = {
photosNUXClicked: false,
pincodeType: PincodeType.Unset,
accountCreationTime: 99999999999999,
backupRequiredTime: null,
startOnboardingTime: undefined,
backupCompleted: false,
dismissedGetVerified: false,
Expand Down Expand Up @@ -215,16 +211,10 @@ export const reducer = (
...state,
backupCompleted: true,
}
case Actions.SET_BACKUP_DELAYED:
return {
...state,
backupRequiredTime: action.now + DAYS_TO_DELAY * ONE_DAY_IN_MILLIS,
}
case Actions.TOGGLE_BACKUP_STATE:
return {
...state,
backupCompleted: !state.backupCompleted,
backupRequiredTime: null,
}
case Actions.DISMISS_GET_VERIFIED:
return {
Expand Down
3 changes: 0 additions & 3 deletions src/analytics/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export enum OnboardingEvents {
backup_continue = 'backup_continue', // (count # of taps on “Continue” button in Backup_Phrase)
backup_complete = 'backup_complete', // (count # of taps on "Cancel" button in Backup_Phrase/BackupQuiz)
backup_more_info = 'backup_more_info',
backup_delay = 'backup_delay', // when a user delays backup seed phrase completion
backup_delay_confirm = 'backup_delay_confirm', // when a user confirms they want to delay backup
backup_delay_cancel = 'backup_delay_cancel', // when a user decides to return to backup flow
backup_cancel = 'backup_cancel', // (count # of taps on "Cancel" button in Backup_Phrase/BackupQuiz)
Expand Down Expand Up @@ -166,8 +165,6 @@ export enum OnboardingEvents {
account_dek_register_complete = 'account_dek_register_complete',

protect_wallet_use_recovery = 'protect_wallet_use_recovery',
protect_wallet_use_cloud = 'protect_wallet_use_cloud',
protect_wallet_use_cloud_bottom_sheet = 'protect_wallet_use_cloud_bottom_sheet',
protect_wallet_help = 'protect_wallet_help',
protect_wallet_help_dismiss = 'protect_wallet_help_dismiss',
protect_wallet_copy_phrase = 'protect_wallet_copy_phrase',
Expand Down
5 changes: 0 additions & 5 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ interface OnboardingEventsProperties {
[OnboardingEvents.backup_continue]: undefined
[OnboardingEvents.backup_complete]: undefined
[OnboardingEvents.backup_more_info]: undefined
[OnboardingEvents.backup_delay]: undefined
[OnboardingEvents.backup_delay_confirm]: undefined
[OnboardingEvents.backup_delay_cancel]: undefined
[OnboardingEvents.backup_cancel]: undefined
Expand Down Expand Up @@ -361,10 +360,6 @@ interface OnboardingEventsProperties {
position?: number
}
| undefined
[OnboardingEvents.protect_wallet_use_cloud]: {
position?: number
}
[OnboardingEvents.protect_wallet_use_cloud_bottom_sheet]: undefined
[OnboardingEvents.protect_wallet_help]: undefined
[OnboardingEvents.protect_wallet_help_dismiss]: undefined
[OnboardingEvents.protect_wallet_copy_phrase]: undefined
Expand Down
19 changes: 0 additions & 19 deletions src/backup/BackupForceScreen.test.tsx

This file was deleted.

100 changes: 0 additions & 100 deletions src/backup/BackupForceScreen.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions src/backup/BackupIntroduction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@ import 'react-native'
import { Provider } from 'react-redux'
import BackupIntroduction from 'src/backup/BackupIntroduction'
import { Screens } from 'src/navigator/Screens'
import { getExperimentParams } from 'src/statsig'
import { createMockStore, getMockStackScreenProps } from 'test/utils'

jest.mock('src/statsig', () => ({
getExperimentParams: jest.fn().mockReturnValue({
useNewBackupFlowCopy: false,
}),
}))

describe('BackupIntroduction', () => {
it('renders correctly when backup not complete', () => {
const { getByText, getByTestId } = render(
Expand All @@ -21,22 +14,6 @@ describe('BackupIntroduction', () => {
</Provider>
)

expect(getByText('introTitle')).toBeTruthy()
expect(getByText('introBody')).toBeTruthy()
expect(getByTestId('SetUpAccountKey')).toBeTruthy()
})

it('renders correctly when backup not complete and using new backup flow', () => {
;(getExperimentParams as jest.Mock).mockReturnValueOnce({
useNewBackupFlowCopy: true,
})

const { getByText, getByTestId } = render(
<Provider store={createMockStore({})}>
<BackupIntroduction {...getMockStackScreenProps(Screens.BackupIntroduction)} />
</Provider>
)

expect(getByText('introBackUpPhrase')).toBeTruthy()
expect(getByText('introCompleteQuiz')).toBeTruthy()
expect(getByTestId('SetUpAccountKey')).toBeTruthy()
Expand Down
Loading

0 comments on commit 8c30c53

Please sign in to comment.