Skip to content

Commit

Permalink
refactor: navigate params
Browse files Browse the repository at this point in the history
  • Loading branch information
hz002 committed Dec 2, 2024
1 parent e5a5a14 commit 2351716
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 42 deletions.
4 changes: 2 additions & 2 deletions apps/mobile/src/assets/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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></1><2>Add to contacts</2>",
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
7 changes: 5 additions & 2 deletions apps/mobile/src/components/ConnectLedger/ConnectLedger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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?.();
}
Expand Down
7 changes: 5 additions & 2 deletions apps/mobile/src/components/ConnectOneKey/ConnectOneKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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?.();
}
Expand Down
14 changes: 8 additions & 6 deletions apps/mobile/src/hooks/useSeedPhrase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
}
},
Expand Down
16 changes: 9 additions & 7 deletions apps/mobile/src/screens/Address/ImportSeedPhraseScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
16 changes: 9 additions & 7 deletions apps/mobile/src/screens/Address/ImportSeedPhraseScreen2024.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
15 changes: 9 additions & 6 deletions apps/mobile/src/screens/Address/ImportSuccessScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
16 changes: 9 additions & 7 deletions apps/mobile/src/screens/Address/components/SeedPhraseBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export const SeedPhraseBar: React.FC<Props> = ({ 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,
},
});
},
});
Expand Down

0 comments on commit 2351716

Please sign in to comment.