Skip to content

Commit

Permalink
CR: update
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Apr 25, 2024
1 parent 52cffed commit 08ebd58
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import {
TextInputProps,
} from '../../../components'
import {useWalletNavigation} from '../../../navigation'
import {WalletManager} from '../../../wallet-manager/walletManager'
import {useWalletManager} from '../../../wallet-manager/WalletManagerContext'
import {useRemoveWallet, useWalletName} from '../../../yoroi-wallets/hooks'
import {hasWalletsKey, useRemoveWallet, useWalletName} from '../../../yoroi-wallets/hooks'
import {useSelectedWallet} from '../../WalletManager/Context/SelectedWalletContext'

export const RemoveWalletScreen = () => {
Expand All @@ -27,11 +26,12 @@ export const RemoveWalletScreen = () => {
const wallet = useSelectedWallet()
const walletName = useWalletName(wallet)
const {resetToWalletSetup, resetToWalletSelection} = useWalletNavigation()
const walletManager = useWalletManager()
const queryClient = useQueryClient()

const {removeWallet, isLoading: isRemoveWalletLoading} = useRemoveWallet(wallet.id, {
onSuccess: async () => {
queryClient.invalidateQueries({queryKey: ['hasWallets']})
queryClient.invalidateQueries({queryKey: [hasWalletsKey]})

const walletMetas = await walletManager.listWallets()
const hasWallets = walletMetas.length > 0
Expand Down
3 changes: 2 additions & 1 deletion apps/wallet-mobile/src/yoroi-wallets/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,13 @@ export const useWalletMetas = (walletManager: WalletManager, options?: UseQueryO
}
}

export const hasWalletsKey = 'hasWallets'
export const useHasWallets = (
walletManager: WalletManager,
options?: UseQueryOptions<Array<WalletMeta>, Error, boolean>,
) => {
const query = useQuery({
queryKey: ['hasWallets'],
queryKey: [hasWalletsKey],
queryFn: async () => walletManager.listWallets(),
select: (walletMetas) => walletMetas.length > 0,
suspense: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,104 +4,104 @@
"defaultMessage": "!!!If you wish to permanently delete the wallet make sure you have written down the mnemonic.",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 127,
"line": 126,
"column": 25,
"index": 4077
"index": 4034
},
"end": {
"line": 130,
"line": 129,
"column": 3,
"index": 4271
"index": 4228
}
},
{
"id": "components.settings.removewalletscreen.descriptionParagraph2",
"defaultMessage": "!!!To confirm this operation type the wallet name below.",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 131,
"line": 130,
"column": 25,
"index": 4298
"index": 4255
},
"end": {
"line": 134,
"line": 133,
"column": 3,
"index": 4455
"index": 4412
}
},
{
"id": "components.settings.removewalletscreen.walletName",
"defaultMessage": "!!!Wallet name",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 135,
"line": 134,
"column": 14,
"index": 4471
"index": 4428
},
"end": {
"line": 138,
"line": 137,
"column": 3,
"index": 4575
"index": 4532
}
},
{
"id": "components.settings.removewalletscreen.walletNameInput",
"defaultMessage": "!!!Wallet name",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 139,
"line": 138,
"column": 19,
"index": 4596
"index": 4553
},
"end": {
"line": 142,
"line": 141,
"column": 3,
"index": 4705
"index": 4662
}
},
{
"id": "components.settings.removewalletscreen.walletNameMismatchError",
"defaultMessage": "!!!Wallet name does not match",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 143,
"line": 142,
"column": 27,
"index": 4734
"index": 4691
},
"end": {
"line": 146,
"line": 145,
"column": 3,
"index": 4866
"index": 4823
}
},
{
"id": "components.settings.removewalletscreen.remove",
"defaultMessage": "!!!Remove wallet",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 147,
"line": 146,
"column": 10,
"index": 4878
"index": 4835
},
"end": {
"line": 150,
"line": 149,
"column": 3,
"index": 4980
"index": 4937
}
},
{
"id": "components.settings.removewalletscreen.hasWrittenDownMnemonic",
"defaultMessage": "!!!I have written down mnemonic of this wallet and understand that I cannot recover the wallet without it.",
"file": "src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx",
"start": {
"line": 151,
"line": 150,
"column": 26,
"index": 5008
"index": 4965
},
"end": {
"line": 155,
"line": 154,
"column": 3,
"index": 5222
"index": 5179
}
}
]

0 comments on commit 08ebd58

Please sign in to comment.