Skip to content

Commit

Permalink
fix(setup-wallet): add wallet back button
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed May 3, 2024
1 parent 0ef6573 commit a051fbc
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export const SetupWalletNavigator = () => {
<Stack.Screen
name="setup-wallet-choose-setup-type"
component={ChooseSetupTypeScreen}
options={{title: strings.addNewWalletTitle}}
/>

<Stack.Screen
name="setup-wallet-choose-setup-type-init"
component={ChooseSetupTypeScreen}
options={{title: strings.addNewWalletTitle, headerLeft: () => null}}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export const ChooseBiometricLoginScreen = () => {
const strings = useStrings()
const storage = useAsyncStorage()
const {walletImplementationIdChanged} = useSetupWallet()
const {resetToWalletSetup} = useWalletNavigation()
const {resetToWalletSetupInit} = useWalletNavigation()

const navigate = () => {
walletImplementationIdChanged(HASKELL_SHELLEY.WALLET_IMPLEMENTATION_ID)
resetToWalletSetup()
resetToWalletSetupInit()
}

const {enableAuthWithOs, isLoading} = useEnableAuthWithOs({
Expand Down
23 changes: 23 additions & 0 deletions apps/wallet-mobile/src/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export type WalletStackRouteNavigation = StackNavigationProp<WalletStackRoutes>

export type WalletInitRoutes = {
'setup-wallet-choose-setup-type': undefined
'setup-wallet-choose-setup-type-init': undefined
'setup-wallet-create-choose-network': undefined
'setup-wallet-restore-choose-network': undefined
'setup-wallet-restore-choose-mnemonic-type': undefined
Expand Down Expand Up @@ -414,6 +415,27 @@ export const useWalletNavigation = () => {
})
},

resetToWalletSetupInit: () => {
navigation.reset({
index: 0,
routes: [
{
name: 'manage-wallets',
state: {
routes: [
{
name: 'setup-wallet',
state: {
routes: [{name: 'setup-wallet-choose-setup-type-init'}],
},
},
],
},
},
],
})
},

resetToWalletSetup: () => {
navigation.reset({
index: 0,
Expand All @@ -422,6 +444,7 @@ export const useWalletNavigation = () => {
name: 'manage-wallets',
state: {
routes: [
{name: 'wallet-selection'},
{
name: 'setup-wallet',
state: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,179 +4,179 @@
"defaultMessage": "!!!Add new wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 138,
"line": 144,
"column": 21,
"index": 4851
"index": 5027
},
"end": {
"line": 141,
"line": 147,
"column": 3,
"index": 4953
"index": 5129
}
},
{
"id": "components.walletinit.createwallet.createwalletscreen.title",
"defaultMessage": "!!!Create wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 142,
"line": 148,
"column": 21,
"index": 4976
"index": 5152
},
"end": {
"line": 145,
"line": 151,
"column": 3,
"index": 5092
"index": 5268
}
},
{
"id": "components.walletinit.restorewallet.restorewalletscreen.title",
"defaultMessage": "!!!Restore wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 146,
"line": 152,
"column": 22,
"index": 5116
"index": 5292
},
"end": {
"line": 149,
"line": 155,
"column": 3,
"index": 5235
"index": 5411
}
},
{
"id": "components.walletinit.importreadonlywalletscreen.title",
"defaultMessage": "!!!Read-only Wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 150,
"line": 156,
"column": 23,
"index": 5260
"index": 5436
},
"end": {
"line": 153,
"line": 159,
"column": 3,
"index": 5374
"index": 5550
}
},
{
"id": "components.walletinit.savereadonlywalletscreen.title",
"defaultMessage": "!!!Verify read-only wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 154,
"line": 160,
"column": 27,
"index": 5403
"index": 5579
},
"end": {
"line": 157,
"line": 163,
"column": 3,
"index": 5522
"index": 5698
}
},
{
"id": "components.walletinit.createwallet.mnemonicshowscreen.title",
"defaultMessage": "!!!Recovery phrase",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 158,
"line": 164,
"column": 21,
"index": 5545
"index": 5721
},
"end": {
"line": 161,
"line": 167,
"column": 3,
"index": 5663
"index": 5839
}
},
{
"id": "components.walletinit.createwallet.mnemoniccheckscreen.title",
"defaultMessage": "!!!Recovery phrase",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 162,
"line": 168,
"column": 22,
"index": 5687
"index": 5863
},
"end": {
"line": 165,
"line": 171,
"column": 3,
"index": 5806
"index": 5982
}
},
{
"id": "components.walletinit.verifyrestoredwallet.title",
"defaultMessage": "!!!Verify restored wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 166,
"line": 172,
"column": 29,
"index": 5837
"index": 6013
},
"end": {
"line": 169,
"line": 175,
"column": 3,
"index": 5951
"index": 6127
}
},
{
"id": "components.walletinit.restorewallet.walletcredentialsscreen.title",
"defaultMessage": "!!!Wallet credentials",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 170,
"line": 176,
"column": 26,
"index": 5979
"index": 6155
},
"end": {
"line": 173,
"line": 179,
"column": 3,
"index": 6106
"index": 6282
}
},
{
"id": "components.walletinit.connectnanox.connectnanoxscreen.title",
"defaultMessage": "!!!Connect to Ledger Device",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 174,
"line": 180,
"column": 21,
"index": 6129
"index": 6305
},
"end": {
"line": 177,
"line": 183,
"column": 3,
"index": 6256
"index": 6432
}
},
{
"id": "components.walletinit.connectnanox.checknanoxscreen.title",
"defaultMessage": "!!!Connect to Ledger Device",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 178,
"line": 184,
"column": 19,
"index": 6277
"index": 6453
},
"end": {
"line": 181,
"line": 187,
"column": 3,
"index": 6402
"index": 6578
}
},
{
"id": "components.walletinit.connectnanox.savenanoxscreen.title",
"defaultMessage": "!!!Save wallet",
"file": "src/features/SetupWallet/SetupWalletNavigator.tsx",
"start": {
"line": 182,
"line": 188,
"column": 18,
"index": 6422
"index": 6598
},
"end": {
"line": 185,
"line": 191,
"column": 3,
"index": 6533
"index": 6709
}
}
]

0 comments on commit a051fbc

Please sign in to comment.