diff --git a/apps/wallet-mobile/package.json b/apps/wallet-mobile/package.json index 2cfd62051c..b7a343ef9b 100644 --- a/apps/wallet-mobile/package.json +++ b/apps/wallet-mobile/package.json @@ -99,7 +99,7 @@ "@emurgo/csl-mobile-bridge": "6.0.0-alpha.9", "@emurgo/react-native-blockies-svg": "^0.0.2", "@emurgo/react-native-hid": "^5.15.6", - "@emurgo/yoroi-lib": "0.15.5-alpha.8", + "@emurgo/yoroi-lib": "0.15.5", "@formatjs/intl-datetimeformat": "^6.7.0", "@formatjs/intl-getcanonicallocales": "^2.1.0", "@formatjs/intl-locale": "^3.2.1", diff --git a/apps/wallet-mobile/src/Staking/PoolTransition/PoolTransitionProvider.tsx b/apps/wallet-mobile/src/Staking/PoolTransition/PoolTransitionProvider.tsx new file mode 100644 index 0000000000..c948e598d3 --- /dev/null +++ b/apps/wallet-mobile/src/Staking/PoolTransition/PoolTransitionProvider.tsx @@ -0,0 +1,17 @@ +import React from 'react' + +const PoolTransitionContext = React.createContext< + [string[], React.Dispatch>] | undefined +>(undefined) + +export const PoolTransitionProvider = ({children}: {children: React.ReactNode}) => { + const value = React.useState>([]) + + return {children} +} + +export const usePoolTransitionContext = () => React.useContext(PoolTransitionContext) || missingProvider() + +const missingProvider = () => { + throw new Error('PoolTransitionProvider is missing') +} diff --git a/apps/wallet-mobile/src/Staking/PoolTransition/usePoolTransitionModal.tsx b/apps/wallet-mobile/src/Staking/PoolTransition/usePoolTransitionModal.tsx index eaa793b2c1..4e3be6b30d 100644 --- a/apps/wallet-mobile/src/Staking/PoolTransition/usePoolTransitionModal.tsx +++ b/apps/wallet-mobile/src/Staking/PoolTransition/usePoolTransitionModal.tsx @@ -1,24 +1,39 @@ import * as React from 'react' import {useModal} from '../../components' +import {useSelectedWallet} from '../../features/WalletManager/Context/SelectedWalletContext' import {PoolTransitionModal} from './PoolTransitionModal' +import {usePoolTransitionContext} from './PoolTransitionProvider' import {usePoolTransition, useStrings} from './usePoolTransition' export const usePoolTransitionModal = () => { const {poolTransition, isPoolRetiring, isLoading, navigateToUpdate} = usePoolTransition() + const wallet = useSelectedWallet() + const [shownWallets, setShownWallets] = usePoolTransitionContext() const {openModal} = useModal() const strings = useStrings() const modalHeight = 700 React.useEffect(() => { - if (isPoolRetiring && poolTransition !== null) { + if (!shownWallets.includes(wallet.id) && isPoolRetiring && poolTransition !== null) { openModal( strings.title, , modalHeight, ) + setShownWallets(() => [wallet.id, ...shownWallets]) } - }, [isPoolRetiring, modalHeight, navigateToUpdate, openModal, poolTransition, strings.title]) + }, [ + shownWallets, + isPoolRetiring, + modalHeight, + navigateToUpdate, + openModal, + poolTransition, + strings.title, + wallet.id, + setShownWallets, + ]) return {isLoading} } diff --git a/apps/wallet-mobile/src/YoroiApp.tsx b/apps/wallet-mobile/src/YoroiApp.tsx index 5bc84e44b8..6bd2cb77d5 100644 --- a/apps/wallet-mobile/src/YoroiApp.tsx +++ b/apps/wallet-mobile/src/YoroiApp.tsx @@ -22,6 +22,7 @@ import {CONFIG} from './legacy/config' import {setLogLevel} from './legacy/logging' import {makeMetricsManager, MetricsProvider} from './metrics/metricsManager' import {useMigrations} from './migrations/useMigrations' +import {PoolTransitionProvider} from './Staking/PoolTransition/PoolTransitionProvider' import {walletManager} from './wallet-manager/walletManager' import {WalletManagerProvider} from './wallet-manager/WalletManagerContext' import {rootStorage} from './yoroi-wallets/storage/rootStorage' @@ -66,7 +67,9 @@ export const YoroiApp = () => { - + + + diff --git a/apps/wallet-mobile/translations/messages/src/Staking/PoolTransition/usePoolTransition.json b/apps/wallet-mobile/translations/messages/src/Staking/PoolTransition/usePoolTransition.json index e68ae434bf..c5cd53b40f 100644 --- a/apps/wallet-mobile/translations/messages/src/Staking/PoolTransition/usePoolTransition.json +++ b/apps/wallet-mobile/translations/messages/src/Staking/PoolTransition/usePoolTransition.json @@ -6,12 +6,12 @@ "start": { "line": 114, "column": 9, - "index": 4044 + "index": 4001 }, "end": { "line": 117, "column": 3, - "index": 4142 + "index": 4099 } }, { @@ -21,12 +21,12 @@ "start": { "line": 118, "column": 11, - "index": 4155 + "index": 4112 }, "end": { "line": 122, "column": 3, - "index": 4351 + "index": 4308 } }, { @@ -36,12 +36,12 @@ "start": { "line": 123, "column": 16, - "index": 4369 + "index": 4326 }, "end": { "line": 127, "column": 3, - "index": 4575 + "index": 4532 } }, { @@ -51,12 +51,12 @@ "start": { "line": 128, "column": 15, - "index": 4592 + "index": 4549 }, "end": { "line": 131, "column": 3, - "index": 4685 + "index": 4642 } }, { @@ -66,12 +66,12 @@ "start": { "line": 132, "column": 11, - "index": 4698 + "index": 4655 }, "end": { "line": 135, "column": 3, - "index": 4783 + "index": 4740 } }, { @@ -81,12 +81,12 @@ "start": { "line": 136, "column": 16, - "index": 4801 + "index": 4758 }, "end": { "line": 139, "column": 3, - "index": 4896 + "index": 4853 } }, { @@ -96,12 +96,12 @@ "start": { "line": 140, "column": 7, - "index": 4905 + "index": 4862 }, "end": { "line": 143, "column": 3, - "index": 4981 + "index": 4938 } }, { @@ -111,12 +111,12 @@ "start": { "line": 144, "column": 24, - "index": 5007 + "index": 4964 }, "end": { "line": 147, "column": 3, - "index": 5144 + "index": 5101 } }, { @@ -126,12 +126,12 @@ "start": { "line": 148, "column": 17, - "index": 5163 + "index": 5120 }, "end": { "line": 151, "column": 3, - "index": 5297 + "index": 5254 } }, { @@ -141,12 +141,12 @@ "start": { "line": 152, "column": 23, - "index": 5322 + "index": 5279 }, "end": { "line": 155, "column": 3, - "index": 5452 + "index": 5409 } }, { @@ -156,12 +156,12 @@ "start": { "line": 156, "column": 17, - "index": 5471 + "index": 5428 }, "end": { "line": 159, "column": 3, - "index": 5585 + "index": 5542 } }, { @@ -171,12 +171,12 @@ "start": { "line": 160, "column": 21, - "index": 5608 + "index": 5565 }, "end": { "line": 163, "column": 3, - "index": 5722 + "index": 5679 } }, { @@ -186,12 +186,12 @@ "start": { "line": 164, "column": 10, - "index": 5734 + "index": 5691 }, "end": { "line": 167, "column": 3, - "index": 5821 + "index": 5778 } } ] \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index d9785c077a..6b9c0c2800 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2780,10 +2780,10 @@ bignumber.js "^9.0.1" easy-crc "1.1.0" -"@emurgo/yoroi-lib@0.15.5-alpha.8": - version "0.15.5-alpha.8" - resolved "https://registry.yarnpkg.com/@emurgo/yoroi-lib/-/yoroi-lib-0.15.5-alpha.8.tgz#71791392419f718d19256c4aaedd1ac8d3a37bbe" - integrity sha512-avc0cwttCgEgBMflxKK2Kaxw4IbErLa+ezlWWgJ4iGN0fgHYcpY335xXd2g+cQmsRKpPyhNWWqPXafo6e8lT8Q== +"@emurgo/yoroi-lib@0.15.5": + version "0.15.5" + resolved "https://registry.yarnpkg.com/@emurgo/yoroi-lib/-/yoroi-lib-0.15.5.tgz#534cf4b81376f2b185b73e05a2103d9712be4a8d" + integrity sha512-Fq6MN/l5Na14d3LOsnT7xzKDky1ugbKxQ6+zzxchZkcF+w0OXGtK4sFGXccR47E7JhRLhjLqOzKSKhKGkTVt+A== dependencies: "@cardano-foundation/ledgerjs-hw-app-cardano" "^6.0.0" "@emurgo/cross-csl-core" "4.4.0"