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

feat: add keyless backup into onboarding flow #5591

Merged
merged 37 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
381291e
feat: add cab in onboarding
MuckT Jun 28, 2024
209136b
Merge branch 'main' into tomm/act-1219
MuckT Jun 28, 2024
6d56803
fix: handle possible undefined origin
MuckT Jun 28, 2024
1720ed2
fix: resolve build errors
MuckT Jun 28, 2024
3717f10
chore: use onboarding background in account key education during onbo…
MuckT Jun 28, 2024
135b3ba
test: update snapshots and expected navigation
MuckT Jun 28, 2024
cde90a9
fix: remove unused styles
MuckT Jun 29, 2024
e037914
chore: remove onboarding background
MuckT Jun 29, 2024
aaef4c5
chore: remove onboarding background color
MuckT Jun 29, 2024
46325cb
fix: remove hardcoded feature gate
MuckT Jun 29, 2024
cc23b26
chore: update branding sha
MuckT Jun 29, 2024
1b20705
chore: update snapshot
MuckT Jun 29, 2024
b9d0691
fix: use correct steps during cab in onboarding
MuckT Jul 1, 2024
222e9a2
Merge branch 'main' into tomm/act-1219
MuckT Jul 1, 2024
224c95b
Merge branch 'main' into tomm/act-1219
MuckT Jul 1, 2024
7486173
test: update sign in with email bottom sheet bypass
MuckT Jul 1, 2024
1aee3c9
fix: use protect wallet steps on onboarding recovery phrase non cab flow
MuckT Jul 2, 2024
0a40ff3
style: remove use of nextScreen nav prop
MuckT Jul 2, 2024
f6119c9
fix: onboarding nav from biometrics to cab
MuckT Jul 3, 2024
998393f
fix: headers on android sign in with email
MuckT Jul 3, 2024
5c7f752
Merge branch 'main' into tomm/act-1219
MuckT Jul 3, 2024
bf4648e
Merge branch 'main' into tomm/act-1219
MuckT Jul 3, 2024
0320f30
style: update test id for bottom sheet
MuckT Jul 4, 2024
0224ecb
style: is setup in onboarding
MuckT Jul 8, 2024
a053685
style: use destructured origin and flow
MuckT Jul 8, 2024
c998a0d
style: use is setup const
MuckT Jul 8, 2024
acb95ae
fix: remove unneeded keyless backup origin
MuckT Jul 8, 2024
32b452a
style: simplify title component of custom header
MuckT Jul 8, 2024
685f385
style: move functions into bottom sheet
MuckT Jul 8, 2024
353378a
Merge branch 'main' into tomm/act-1219
MuckT Jul 8, 2024
587392f
fix: only show header title during onboarding setup
MuckT Jul 8, 2024
85474bc
style: pass header with subtitle to title prop of custom header
MuckT Jul 9, 2024
b93f45c
chore: remove unused subTitle prop
MuckT Jul 9, 2024
a2a2d07
fix: remove unnecessary steps
MuckT Jul 9, 2024
ddd7cb1
Merge branch 'main' into tomm/act-1219
MuckT Jul 9, 2024
0385484
fix: remove onboarding prop and navigate directly
MuckT Jul 9, 2024
ca8a587
style: remove extra empty line
MuckT Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added branding/celo/src/images/email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dataSaver": "Data Saver",
"enableDataSaver": "Enable Data Saver",
"dataSaverDetail": "Data Saver mode allows you to communicate with the the network through a trusted node. You can always change this mode in app settings.",
"keylessBackupSetupTitle": "Create Login",
"keylessBackupSettingsTitle": "Email & Phone Backup",
"keylessBackupSettingsDeleteError": "Your backup was not able to be deleted, please wait & try again later.",
"setup": "Set Up",
Expand Down Expand Up @@ -102,9 +103,16 @@
},
"signInWithEmail": {
"title": "Sign in with email",
"subtitle": "Sign in with your email to set it up as a backup.\n\nYou will be prompted to sign in again if you ever lose your wallet.",
"subtitle": "Sign in with your email to set it up as a backup. You will be prompted to sign in again if you ever lose your wallet.",
"subtitleRestore": "Sign in with the email you used to set up your wallet backup.",
"google": "Sign in with Google"
"google": "Sign in with Google",
"signInAnotherWay": "Sign in another way",
"bottomSheet": {
"title": "Save your recovery phrase to create a wallet",
"description": "We’re going to be supporting other email providers soon, but in the meanwhile you’ll have to save your recovery phrase to finish creating a wallet.",
"continue": "Continue",
"skip": "Skip (not recommended)"
}
},
"keylessBackupPhoneInput": {
"setup": {
Expand Down
4 changes: 3 additions & 1 deletion src/account/AccountKeyEducation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
export default function AccountKeyEducation(props: Props) {
function onComplete() {
ValoraAnalytics.track(OnboardingEvents.backup_education_complete)
if (props.route.params?.nextScreen) {
if (props.route.params?.origin === 'cabOnboarding') {
navigate(Screens.OnboardingRecoveryPhrase, { origin: 'cabOnboarding' })

Check warning on line 21 in src/account/AccountKeyEducation.tsx

View check run for this annotation

Codecov / codecov/patch

src/account/AccountKeyEducation.tsx#L21

Added line #L21 was not covered by tests
} else if (props.route.params?.nextScreen) {
navigate(props.route.params?.nextScreen)
} else {
navigate(Screens.BackupPhrase)
Expand Down
2 changes: 2 additions & 0 deletions src/analytics/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ export enum SettingsEvents {
export enum KeylessBackupEvents {
wallet_security_primer_get_started = 'wallet_security_primer_get_started',
cab_setup_recovery_phrase = 'cab_setup_recovery_phrase',
cab_sign_in_another_way = 'cab_sign_in_another_way',
cab_sign_in_with_google = 'cab_sign_in_with_google',
cab_sign_in_with_google_success = 'cab_sign_in_with_google_success',
cab_sign_in_with_email_screen_cancel = 'cab_sign_in_with_email_screen_cancel',
cab_sign_in_with_email_screen_skip = 'cab_sign_in_with_email_screen_skip',
cab_get_torus_keyshare_failed = 'cab_get_torus_keyshare_failed',
cab_enter_phone_number_continue = 'cab_enter_phone_number_continue',
cab_enter_phone_number_cancel = 'cab_enter_phone_number_cancel',
Expand Down
2 changes: 2 additions & 0 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ interface CommonKeylessBackupProps {
interface KeylessBackupEventsProperties {
[KeylessBackupEvents.wallet_security_primer_get_started]: undefined
[KeylessBackupEvents.cab_setup_recovery_phrase]: undefined
[KeylessBackupEvents.cab_sign_in_another_way]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_sign_in_with_google]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_sign_in_with_google_success]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_sign_in_with_email_screen_cancel]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_sign_in_with_email_screen_skip]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_enter_phone_number_continue]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_enter_phone_number_cancel]: CommonKeylessBackupProps
[KeylessBackupEvents.cab_intro_continue]: CommonKeylessBackupProps
Expand Down
2 changes: 2 additions & 0 deletions src/analytics/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
[SettingsEvents.settings_delete_keyless_backup]: ``,
[KeylessBackupEvents.wallet_security_primer_get_started]: ``,
[KeylessBackupEvents.cab_setup_recovery_phrase]: `When the recovery phrase link is pressed in the setup wallet backup screen`,
[KeylessBackupEvents.cab_sign_in_another_way]: `When the sign in another way button is pressed in the setup wallet backup screen`,
[KeylessBackupEvents.cab_sign_in_with_google]: ``,
[KeylessBackupEvents.cab_sign_in_with_google_success]: ``,
[KeylessBackupEvents.cab_sign_in_with_email_screen_cancel]: ``,
[KeylessBackupEvents.cab_sign_in_with_email_screen_skip]: `When the skip button is pressed on the sign in with email bottom sheet`,
[KeylessBackupEvents.cab_get_torus_keyshare_failed]: ``,
[KeylessBackupEvents.cab_enter_phone_number_continue]: ``,
[KeylessBackupEvents.cab_enter_phone_number_cancel]: `When the cancel button is pressed on the phone input screen`,
Expand Down
1 change: 1 addition & 0 deletions src/components/header/CustomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface Props {
function CustomHeader({ left, right, title, style }: Props) {
const titleComponent =
typeof title === 'string' ? <Text style={headerStyles.headerTitle}>{title}</Text> : title

MuckT marked this conversation as resolved.
Show resolved Hide resolved
return (
<View style={style ? [styles.container, style] : styles.container}>
{!!title && <View style={styles.titleContainer}>{titleComponent}</View>}
Expand Down
1 change: 1 addition & 0 deletions src/images/Images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const dappListLogo = require('src/images/dapp-list-logo.png')
export const earn1 = require('src/images/earn1.png')
export const earn2 = require('src/images/earn2.png')
export const earn3 = require('src/images/earn3.png')
export const email = require('src/images/email.png')
export const fiatExchange = require('src/images/fiat-exchange.png')
export const getVerified = require('src/images/get-verified.png')
export const inviteFriends = require('src/images/invite-friends.png')
Expand Down
50 changes: 49 additions & 1 deletion src/keylessBackup/SignInWithEmail.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { fireEvent, render, waitFor } from '@testing-library/react-native'
import React from 'react'
import { Provider } from 'react-redux'
import { KeylessBackupEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import SignInWithEmail from 'src/keylessBackup/SignInWithEmail'
import { googleSignInCompleted } from 'src/keylessBackup/slice'
import { KeylessBackupFlow, KeylessBackupOrigin } from 'src/keylessBackup/types'
import { noHeader } from 'src/navigator/Headers'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import Logger from 'src/utils/Logger'
Expand Down Expand Up @@ -36,7 +38,7 @@ const renderComponent = (
keylessBackupFlow,
origin,
}}
options={SignInWithEmail.navigationOptions}
options={noHeader}
/>
</Provider>
)
Expand Down Expand Up @@ -175,4 +177,50 @@ describe('SignInWithEmail', () => {
expect(logWarnSpy).not.toHaveBeenCalled()
expect(queryByTestId('Button/Loading')).toBeNull()
})

it("pressing 'Sign in another way' then 'continue' navigates to recovery phrase education", () => {
const { getByTestId, getByText } = renderComponent(
KeylessBackupFlow.Setup,
KeylessBackupOrigin.Onboarding
)
expect(getByText('signInWithEmail.title')).toBeTruthy()
expect(getByText('signInWithEmail.subtitle')).toBeTruthy()
expect(getByTestId('SignInWithEmail/Google')).toBeTruthy()
expect(getByTestId('SignInWithEmail/SignInAnotherWay')).toBeTruthy()

fireEvent.press(getByTestId('SignInWithEmail/SignInAnotherWay'))
expect(getByTestId('KeylessBackupSignInWithEmail/BottomSheet')).toBeTruthy()

fireEvent.press(getByText('signInWithEmail.bottomSheet.continue'))
expect(navigate).toHaveBeenCalledWith(Screens.AccountKeyEducation, {
origin: 'cabOnboarding',
})
expect(ValoraAnalytics.track).toHaveBeenCalledWith(
KeylessBackupEvents.cab_setup_recovery_phrase
)
})

it("pressing 'Sign in another way' then 'Skip (not recommended)' navigates to next onboarding screen", () => {
const { getByTestId, getByText } = renderComponent(
KeylessBackupFlow.Setup,
KeylessBackupOrigin.Onboarding
)
expect(getByText('signInWithEmail.title')).toBeTruthy()
expect(getByText('signInWithEmail.subtitle')).toBeTruthy()
expect(getByTestId('SignInWithEmail/Google')).toBeTruthy()
expect(getByTestId('SignInWithEmail/SignInAnotherWay')).toBeTruthy()

fireEvent.press(getByTestId('SignInWithEmail/SignInAnotherWay'))
expect(getByTestId('KeylessBackupSignInWithEmail/BottomSheet')).toBeTruthy()

fireEvent.press(getByText('signInWithEmail.bottomSheet.skip'))
expect(navigate).toHaveBeenCalledWith(Screens.VerificationStartScreen)
expect(ValoraAnalytics.track).toHaveBeenCalledWith(
KeylessBackupEvents.cab_sign_in_with_email_screen_skip,
{
keylessBackupFlow: KeylessBackupFlow.Setup,
origin: KeylessBackupOrigin.Onboarding,
}
)
})
})
Loading