diff --git a/e2e/backup.e2e.js b/e2e/backup.e2e.js index b6929fb60..730535703 100644 --- a/e2e/backup.e2e.js +++ b/e2e/backup.e2e.js @@ -111,6 +111,9 @@ d('Backup', () => { await element(by.id('TapToReveal')).tap(); // get the seed from SeedContaider + await waitFor(element(by.id('SeedContaider'))) + .toBeVisible() + .withTimeout(30000); const { label: seed } = await element( by.id('SeedContaider'), ).getAttributes(); diff --git a/e2e/lightning.e2e.js b/e2e/lightning.e2e.js index b613036e3..58e0ecbfb 100644 --- a/e2e/lightning.e2e.js +++ b/e2e/lightning.e2e.js @@ -319,6 +319,9 @@ d('Lightning', () => { await element(by.id('TapToReveal')).tap(); // get the seed from SeedContaider + await waitFor(element(by.id('SeedContaider'))) + .toBeVisible() + .withTimeout(30000); const { label: seed } = await element( by.id('SeedContaider'), ).getAttributes(); diff --git a/e2e/onboarding.e2e.js b/e2e/onboarding.e2e.js index f4abf294d..3e8f0f00d 100644 --- a/e2e/onboarding.e2e.js +++ b/e2e/onboarding.e2e.js @@ -60,6 +60,9 @@ d('Onboarding', () => { await element(by.id('BackupWallet')).tap(); await element(by.id('TapToReveal')).tap(); // get the seed from SeedContaider + await waitFor(element(by.id('SeedContaider'))) + .toBeVisible() + .withTimeout(30000); const { label: seed } = await element( by.id('SeedContaider'), ).getAttributes(); diff --git a/e2e/settings.e2e.js b/e2e/settings.e2e.js index 0a0536e56..e7275b227 100644 --- a/e2e/settings.e2e.js +++ b/e2e/settings.e2e.js @@ -284,6 +284,9 @@ d('Settings', () => { await element(by.id('TapToReveal')).tap(); // get the seed from SeedContaider + await waitFor(element(by.id('SeedContaider'))) + .toBeVisible() + .withTimeout(30000); const { label: seed } = await element( by.id('SeedContaider'), ).getAttributes(); diff --git a/e2e/slashtags.e2e.js b/e2e/slashtags.e2e.js index 140c43510..f76705aa4 100644 --- a/e2e/slashtags.e2e.js +++ b/e2e/slashtags.e2e.js @@ -237,6 +237,9 @@ d('Profile and Contacts', () => { await element(by.id('BackupSettings')).tap(); await element(by.id('BackupWallet')).tap(); await element(by.id('TapToReveal')).tap(); + await waitFor(element(by.id('SeedContaider'))) + .toBeVisible() + .withTimeout(30000); const { label: seed } = await element( by.id('SeedContaider'), ).getAttributes(); diff --git a/src/screens/Recovery/Mnemonic.tsx b/src/screens/Recovery/Mnemonic.tsx index b19e4376f..e47ea1231 100644 --- a/src/screens/Recovery/Mnemonic.tsx +++ b/src/screens/Recovery/Mnemonic.tsx @@ -25,7 +25,7 @@ const Mnemonic = ({ const bip39Passphrase = await getBip39Passphrase(); if (mnemoncicResult.isErr()) { - console.log(mnemoncicResult.error.message); + console.log('getMnemonicPhrase error:', mnemoncicResult.error.message); showToast({ type: 'warning', title: t('mnemonic_error'), @@ -54,6 +54,7 @@ const Mnemonic = ({ + {seed.length === 0 && {t('mnemonic_loading')}} {seed.slice(0, seed.length / 2).map((w, i) => ( ))} diff --git a/src/screens/Settings/Backup/ShowMnemonic.tsx b/src/screens/Settings/Backup/ShowMnemonic.tsx index bdfaf88ff..f5fd85ae5 100644 --- a/src/screens/Settings/Backup/ShowMnemonic.tsx +++ b/src/screens/Settings/Backup/ShowMnemonic.tsx @@ -1,4 +1,4 @@ -import React, { memo, ReactElement, useMemo, useState, useEffect } from 'react'; +import React, { memo, ReactElement, useState, useEffect } from 'react'; import { StyleSheet, View, Platform, TouchableOpacity } from 'react-native'; import { Trans, useTranslation } from 'react-i18next'; import Clipboard from '@react-native-clipboard/clipboard'; @@ -46,7 +46,7 @@ const ShowMnemonic = ({ useEffect(() => { getMnemonicPhrase().then((res) => { if (res.isErr()) { - console.log(res.error.message); + console.log('getMnemonicPhrase error:', res.error.message); showToast({ type: 'warning', title: t('mnemonic_error'), @@ -59,10 +59,21 @@ const ShowMnemonic = ({ getBip39Passphrase().then(setPassphrase); }, [t]); - const seedToShow = useMemo( - () => (Platform.OS === 'android' && !show ? dummySeed : seed), - [seed, show], - ); + const revealMnemonic = (): void => { + setShow(true); + }; + + const copyMnemonic = (): void => { + Clipboard.setString(seed.join(' ')); + vibrate(); + }; + + const ready = show && seed.length !== 0; + + const seedToShow = + seed.length === 0 || (Platform.OS === 'android' && !show) + ? dummySeed + : seed; return ( @@ -72,23 +83,20 @@ const ShowMnemonic = ({ /> - {show + {ready ? t('mnemonic_write', { length: seedToShow.length }) : t('mnemonic_use')} { - Clipboard.setString(seed.join(' ')); - vibrate(); - }}> + onLongPress={copyMnemonic}> {seedToShow.slice(0, seedToShow.length / 2).map((w, i) => ( @@ -102,14 +110,15 @@ const ShowMnemonic = ({ - {!show && ( + {!ready && (