From 235171678c405783218b7aa2239c448a28f1a6da Mon Sep 17 00:00:00 2001 From: hz002 Date: Mon, 2 Dec 2024 21:12:13 +0800 Subject: [PATCH] refactor: navigate params --- apps/mobile/src/assets/locales/en/messages.json | 4 ++-- .../ConnectKeystone/useImportKeystone.ts | 9 ++++++--- .../components/ConnectLedger/ConnectLedger.tsx | 7 +++++-- .../components/ConnectOneKey/ConnectOneKey.tsx | 7 +++++-- apps/mobile/src/hooks/useSeedPhrase.ts | 14 ++++++++------ .../screens/Address/ImportSeedPhraseScreen.tsx | 16 +++++++++------- .../Address/ImportSeedPhraseScreen2024.tsx | 16 +++++++++------- .../src/screens/Address/ImportSuccessScreen.tsx | 15 +++++++++------ .../screens/Address/components/SeedPhraseBar.tsx | 16 +++++++++------- 9 files changed, 62 insertions(+), 42 deletions(-) diff --git a/apps/mobile/src/assets/locales/en/messages.json b/apps/mobile/src/assets/locales/en/messages.json index 3047a86f8..532c93fb0 100644 --- a/apps/mobile/src/assets/locales/en/messages.json +++ b/apps/mobile/src/assets/locales/en/messages.json @@ -597,7 +597,7 @@ }, "receive": { "title": "Receive {{token}} on {{chain}}", - "watchModeAlert": "This is a Watch Mode address. Are you sure to use it to receive assets?" + "watchModeAlert": "This is a watch-only address. Are you sure you want to use it to receive assets?" }, "sendToken": { "addressNotInContract": "Not on address list. <1><2>Add to contacts", @@ -1948,7 +1948,7 @@ "source": "Source", "hd-path": "HD Path", "manage-seed-phrase": "Manage Seed Phrase", - "manage-addresses-under-this-seed-phrase": "Create Address under this Seed Phrase", + "manage-addresses-under-this-seed-phrase": "Add address from this seed phrase", "safeModuleAddress": "Safe Module Address", "coboSafeErrorModule": "Address has expired, please delete and import the address again.", "importedDelegatedAddress": "Imported Delegated address" diff --git a/apps/mobile/src/components/ConnectKeystone/useImportKeystone.ts b/apps/mobile/src/components/ConnectKeystone/useImportKeystone.ts index 3a5cffcc9..5327de732 100644 --- a/apps/mobile/src/components/ConnectKeystone/useImportKeystone.ts +++ b/apps/mobile/src/components/ConnectKeystone/useImportKeystone.ts @@ -17,9 +17,12 @@ export const useImportKeystone = () => { startNumber: 1, hdPath: LedgerHDPathType.BIP44, }); - navigate(RootNames.ImportMoreAddress, { - type: HARDWARE_KEYRING_TYPES.Keystone.type as KEYRING_TYPE, - brand: HARDWARE_KEYRING_TYPES.Keystone.brandName, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: HARDWARE_KEYRING_TYPES.Keystone.type as KEYRING_TYPE, + brand: HARDWARE_KEYRING_TYPES.Keystone.brandName, + }, }); }, [setSetting]); diff --git a/apps/mobile/src/components/ConnectLedger/ConnectLedger.tsx b/apps/mobile/src/components/ConnectLedger/ConnectLedger.tsx index f778065f5..1a2e098e6 100644 --- a/apps/mobile/src/components/ConnectLedger/ConnectLedger.tsx +++ b/apps/mobile/src/components/ConnectLedger/ConnectLedger.tsx @@ -118,8 +118,11 @@ export const ConnectLedger: React.FC<{ }); onDone?.(); } else { - navigate(RootNames.ImportMoreAddress, { - type: KEYRING_TYPE.LedgerKeyring, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: KEYRING_TYPE.LedgerKeyring, + }, }); onDone?.(); } diff --git a/apps/mobile/src/components/ConnectOneKey/ConnectOneKey.tsx b/apps/mobile/src/components/ConnectOneKey/ConnectOneKey.tsx index b3e5427ba..431689978 100644 --- a/apps/mobile/src/components/ConnectOneKey/ConnectOneKey.tsx +++ b/apps/mobile/src/components/ConnectOneKey/ConnectOneKey.tsx @@ -61,8 +61,11 @@ export const ConnectOneKey: React.FC<{ startNumber: 1, hdPath: LedgerHDPathType.BIP44, }); - navigate(RootNames.ImportMoreAddress, { - type: KEYRING_TYPE.OneKeyKeyring, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: KEYRING_TYPE.OneKeyKeyring, + }, }); onDone?.(); } diff --git a/apps/mobile/src/hooks/useSeedPhrase.ts b/apps/mobile/src/hooks/useSeedPhrase.ts index b2e36ebe0..e1185d083 100644 --- a/apps/mobile/src/hooks/useSeedPhrase.ts +++ b/apps/mobile/src/hooks/useSeedPhrase.ts @@ -33,12 +33,14 @@ export const useSeedPhrase = () => { 'publickey', publicKey, ); - - navigate(RootNames.ImportMoreAddress, { - type: KEYRING_TYPE.HdKeyring, - mnemonics: data.mnemonic!, - passphrase: data.passphrase!, - keyringId, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: KEYRING_TYPE.HdKeyring, + mnemonics: data.mnemonic!, + passphrase: data.passphrase!, + keyringId, + }, }); } }, diff --git a/apps/mobile/src/screens/Address/ImportSeedPhraseScreen.tsx b/apps/mobile/src/screens/Address/ImportSeedPhraseScreen.tsx index 68b312b95..b076bcf49 100644 --- a/apps/mobile/src/screens/Address/ImportSeedPhraseScreen.tsx +++ b/apps/mobile/src/screens/Address/ImportSeedPhraseScreen.tsx @@ -91,13 +91,15 @@ export const ImportSeedPhraseScreen = () => { } catch (error) { console.log('error', error); } - - navigate(RootNames.ImportMoreAddress, { - type: KEYRING_TYPE.HdKeyring, - mnemonics, - passphrase, - keyringId: keyringId || undefined, - isExistedKR, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: KEYRING_TYPE.HdKeyring, + mnemonics, + passphrase, + keyringId: keyringId || undefined, + isExistedKR, + }, }); }) .catch(err => { diff --git a/apps/mobile/src/screens/Address/ImportSeedPhraseScreen2024.tsx b/apps/mobile/src/screens/Address/ImportSeedPhraseScreen2024.tsx index 78de7f2b7..c30c4b124 100644 --- a/apps/mobile/src/screens/Address/ImportSeedPhraseScreen2024.tsx +++ b/apps/mobile/src/screens/Address/ImportSeedPhraseScreen2024.tsx @@ -171,13 +171,15 @@ export const ImportSeedPhraseScreen2024 = () => { } catch (error) { console.log('error', error); } - - navigate(RootNames.ImportMoreAddress, { - type: KEYRING_TYPE.HdKeyring, - mnemonics, - passphrase: '', - keyringId: keyringId || undefined, - isExistedKR, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: KEYRING_TYPE.HdKeyring, + mnemonics, + passphrase: '', + keyringId: keyringId || undefined, + isExistedKR, + }, }); }) .catch(err => { diff --git a/apps/mobile/src/screens/Address/ImportSuccessScreen.tsx b/apps/mobile/src/screens/Address/ImportSuccessScreen.tsx index 1a0051d07..7d079d5c2 100644 --- a/apps/mobile/src/screens/Address/ImportSuccessScreen.tsx +++ b/apps/mobile/src/screens/Address/ImportSuccessScreen.tsx @@ -193,12 +193,15 @@ export const ImportSuccessScreen = () => { if (!state.isFirstImport) { return; } - navigate(RootNames.ImportMoreAddress, { - type: state.type, - brand: state.brandName, - mnemonics: state.mnemonics, - passphrase: state.passphrase, - keyringId: state.keyringId, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: state.type, + brand: state.brandName, + mnemonics: state.mnemonics, + passphrase: state.passphrase, + keyringId: state.keyringId, + }, }); }, [state]); diff --git a/apps/mobile/src/screens/Address/components/SeedPhraseBar.tsx b/apps/mobile/src/screens/Address/components/SeedPhraseBar.tsx index ba7bca15e..816a82563 100644 --- a/apps/mobile/src/screens/Address/components/SeedPhraseBar.tsx +++ b/apps/mobile/src/screens/Address/components/SeedPhraseBar.tsx @@ -35,13 +35,15 @@ export const SeedPhraseBar: React.FC = ({ address }) => { passphrase, ); const keyringId = result.keyringId; - - navigate(RootNames.ImportMoreAddress, { - type: KEYRING_TYPE.HdKeyring, - mnemonics, - passphrase, - keyringId: keyringId || undefined, - isExistedKR: result.isExistedKR, + navigate(RootNames.StackAddress, { + screen: RootNames.ImportMoreAddress, + params: { + type: KEYRING_TYPE.HdKeyring, + mnemonics, + passphrase, + keyringId: keyringId || undefined, + isExistedKR: result.isExistedKR, + }, }); }, });