diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f21d002a6..4c902b837 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1740,8 +1740,27 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNKeychain (8.2.2): + - RNKeychain (9.1.1): + - DoubleConversion + - glog + - hermes-engine + - RCT-Folly (= 2024.01.01.00) + - RCTRequired + - RCTTypeSafety - React-Core + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-NativeModulesApple + - React-RCTFabric + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - Yoga - RNLocalize (3.0.2): - React-Core - RNNotifee (7.8.2): @@ -2274,7 +2293,7 @@ SPEC CHECKSUMS: RNDeviceInfo: b899ce37a403a4dea52b7cb85e16e49c04a5b88e RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: e80cae4246813ee7f667a2552012a6b7da5550a1 - RNKeychain: 35f92386e7f8548e3e60e7441121afbe8c62d8e4 + RNKeychain: 3ac3a44294d0b18492667ff87e4c50829cb35505 RNLocalize: dbea38dcb344bf80ff18a1757b1becf11f70cae4 RNNotifee: 8e2d3df3f0e9ce8f5d1fe4c967431138190b6175 RNPermissions: 2c0eec471f4de66d04d226c339898d10a6e123c4 diff --git a/package.json b/package.json index 40ea10aae..045ac27ab 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@synonymdev/blocktank-lsp-http-client": "1.5.0", "@synonymdev/feeds": "3.0.0", "@synonymdev/ledger": "0.0.5", - "@synonymdev/react-native-keychain": "8.2.2", + "@synonymdev/react-native-keychain": "9.1.1", "@synonymdev/react-native-ldk": "0.0.153", "@synonymdev/react-native-lnurl": "0.0.10", "@synonymdev/react-native-pubky": "^0.3.0", diff --git a/src/screens/Recovery/Mnemonic.tsx b/src/screens/Recovery/Mnemonic.tsx index b19e4376f..db52a668a 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'), diff --git a/src/screens/Settings/Backup/ShowMnemonic.tsx b/src/screens/Settings/Backup/ShowMnemonic.tsx index bdfaf88ff..99ae11c1d 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'; @@ -44,9 +44,12 @@ const ShowMnemonic = ({ useBottomSheetBackPress('backupNavigation'); useEffect(() => { - getMnemonicPhrase().then((res) => { - if (res.isErr()) { - console.log(res.error.message); + const getSeed = async (): Promise => { + const mnemoncicResult = await getMnemonicPhrase(); + const bip39PassphraseResult = await getBip39Passphrase(); + + if (mnemoncicResult.isErr()) { + console.log('getMnemonicPhrase error:', mnemoncicResult.error.message); showToast({ type: 'warning', title: t('mnemonic_error'), @@ -54,15 +57,24 @@ const ShowMnemonic = ({ }); return; } - setSeed(res.value.split(' ')); - }); - getBip39Passphrase().then(setPassphrase); + + setSeed(mnemoncicResult.value.split(' ')); + setPassphrase(bip39PassphraseResult); + }; + + getSeed(); }, [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 seedToShow = Platform.OS === 'android' && !show ? dummySeed : seed; return ( @@ -85,10 +97,7 @@ const ShowMnemonic = ({ { - Clipboard.setString(seed.join(' ')); - vibrate(); - }}> + onLongPress={copyMnemonic}> {seedToShow.slice(0, seedToShow.length / 2).map((w, i) => ( @@ -108,7 +117,7 @@ const ShowMnemonic = ({ size="large" text={t('mnemonic_reveal')} color="black50" - onPress={(): void => setShow(true)} + onPress={revealMnemonic} testID="TapToReveal" /> diff --git a/yarn.lock b/yarn.lock index 967c099ad..1e19befa4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4931,10 +4931,10 @@ __metadata: languageName: node linkType: hard -"@synonymdev/react-native-keychain@npm:8.2.2": - version: 8.2.2 - resolution: "@synonymdev/react-native-keychain@npm:8.2.2" - checksum: 90c16a7caec3ae648c2c9af3d87da4e7bd425719e528d2793345b73f4757ec6aeacbdb4126b77e6f3b4237d8e734d35d7769e7a2fda54caaaea8b97dc699f558 +"@synonymdev/react-native-keychain@npm:9.1.1": + version: 9.1.1 + resolution: "@synonymdev/react-native-keychain@npm:9.1.1" + checksum: ec92ee34d1e61035bbbea8f7df93a0310cad6f55e4f2f23441b64e1092d00df5ff50d706318b8d45b16a6d300d2789ba7d651634313099bc356847f015529cfb languageName: node linkType: hard @@ -6605,7 +6605,7 @@ __metadata: "@synonymdev/blocktank-lsp-http-client": 1.5.0 "@synonymdev/feeds": 3.0.0 "@synonymdev/ledger": 0.0.5 - "@synonymdev/react-native-keychain": 8.2.2 + "@synonymdev/react-native-keychain": 9.1.1 "@synonymdev/react-native-ldk": 0.0.153 "@synonymdev/react-native-lnurl": 0.0.10 "@synonymdev/react-native-pubky": ^0.3.0