From ef5a10b1a58f7fdff69cdc2cec6ea393dc3fe824 Mon Sep 17 00:00:00 2001 From: banklesss <105349292+banklesss@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:56:21 +0200 Subject: [PATCH] feature(wallet-mobile): new tx review for yoroi swap (#3688) Signed-off-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Co-authored-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> --- .../.storybook/storybook.requires.js | 39 +- apps/wallet-mobile/src/InitApp.tsx | 2 +- apps/wallet-mobile/src/WalletNavigator.tsx | 4 +- apps/wallet-mobile/src/YoroiApp.tsx | 5 +- .../common => components/Divider}/Divider.tsx | 2 +- .../HideableText/HideableText.stories.tsx | 2 +- .../components/HideableText/HideableText.tsx | 2 +- .../PairedBalance/PairedBalance.tsx | 4 +- .../features/Discover/DiscoverNavigator.tsx | 2 +- .../SelectDappFromListScreen.tsx | 2 +- apps/wallet-mobile/src/features/Menu/Menu.tsx | 2 +- .../src/features/Portfolio/NftsNavigator.tsx | 2 +- .../features/Portfolio/PortfolioNavigator.tsx | 2 +- .../TokenAmountItem/TokenAmountItem.tsx | 2 +- .../common/hooks/useGetPortfolioTokenChart.ts | 2 +- .../BalanceCard/BalanceCard.tsx | 2 +- .../BalanceCard/BalanceCardContent.tsx | 4 +- .../PortfolioDashboard/BalanceCard/Rate.tsx | 2 +- .../DashboardTokenItem.tsx | 4 +- .../PortfolioTokenChart/TokenPerformance.tsx | 2 +- .../PortfolioTokenListScreen.tsx | 2 +- .../ListMediaGalleryScreen.tsx | 2 +- .../TokenBalanceItem.tsx | 4 +- .../TotalTokensValue/TokenValueBalance.tsx | 4 +- .../TokenValuePairedBalance.tsx | 2 +- .../TotalTokensValueContent.tsx | 4 +- .../RegisterCatalyst/CatalystNavigator.tsx | 2 +- .../features/ReviewTx/common/Accordion.tsx | 4 +- .../features/ReviewTx/common/CopiableText.tsx | 31 +- .../ReviewTx/common/ReviewTxProvider.tsx | 29 + .../ReviewTx/common/hooks/useAddressType.tsx | 12 - .../common/hooks/useFormattedMetadata.tsx | 13 + .../ReviewTx/common/hooks/useFormattedTx.tsx | 46 +- .../ReviewTx/common/hooks/useStrings.tsx | 15 + .../ReviewTx/common/hooks/useTxBody.tsx | 3 +- .../src/features/ReviewTx/common/types.ts | 8 + .../ReviewTxScreen/Metadata/MetadataTab.tsx | 90 ++ .../ReviewTxScreen/Overview/OverviewTab.tsx | 80 +- .../ReviewTxScreen/ReviewTxScreen.tsx | 61 +- .../ReviewTxScreen/UTxOs/UTxOsTab.tsx | 2 +- .../Settings/ApplicationSettings/index.ts | 1 - .../src/features/Settings/SettingsItems.tsx | 2 +- .../Settings/SettingsScreenNavigator.tsx | 46 +- .../features/Settings/WalletSettings/index.ts | 1 - .../src/features/Settings/index.ts | 1 - .../About/About.stories.tsx | 4 +- .../changeAppSettings}/About/About.tsx | 8 +- .../changeAppSettings}/About/index.ts | 0 .../ApplicationSettingsScreen.stories.tsx | 0 .../ApplicationSettingsScreen.tsx | 32 +- .../ChangeLanguageScreen.stories.tsx | 2 +- .../ChangeLanguage/ChangeLanguageScreen.tsx | 2 +- .../ChangeLanguage/index.ts | 0 .../ChangeNetworkScreen.stories.tsx | 2 +- .../ChangeNetwork/ChangeNetworkScreen.tsx | 12 +- .../ChangeNetwork/NetworkPickerItem.tsx | 4 +- .../ChangeNetwork/NetworkPickerList.tsx | 14 +- .../ChangeNetwork/NetworkTag.tsx | 18 +- .../ChangeNetwork/PreparingNetworkScreen.tsx | 2 +- .../ChangeNetwork/strings.ts | 2 +- .../useLaunchRouteAfterSyncing.tsx | 4 +- .../ChangeTheme/ChangeThemeScreen.stories.tsx | 2 +- .../ChangeTheme/ChangeThemeScreen.tsx | 2 +- .../ChangeTheme/ThemePickerItem.tsx | 8 +- .../ChangeTheme/ThemePickerList.tsx | 2 +- .../Currency/ChangeCurrencyScreen.stories.tsx | 0 .../Currency/ChangeCurrencyScreen.tsx | 2 +- .../Currency/CurrencyContext.tsx | 6 +- .../Currency/CurrencyPickerItem.tsx | 8 +- .../Currency/CurrencyPickerList.tsx | 2 +- .../EnableLoginWithOsScreen.stories.tsx | 0 .../EnableLoginWithOsScreen.tsx | 8 +- .../EnableLoginWithOs/index.ts | 0 .../PrivacyMode/PrivacyMode.tsx | 0 .../PrivacyPolicyScreen.stories.tsx | 0 .../PrivacyPolicy/PrivacyPolicyScreen.tsx | 4 +- .../changeAppSettings}/PrivacyPolicy/index.ts | 0 .../ScreenShare/ScreenShare.ts | 0 .../changeAppSettings}/ScreenShare/index.ts | 0 .../SystemLogScreen.stories.tsx | 4 +- .../SystemLogScreen/SystemLogScreen.tsx | 6 +- .../TermsOfServiceScreen.stories.tsx | 0 .../TermsOfService/TermsOfServiceScreen.tsx | 4 +- .../TermsOfService/index.ts | 0 .../ChangePasswordScreen.stories.tsx | 6 +- .../ChangePassword/ChangePasswordScreen.tsx | 16 +- .../ChangePassword/index.ts | 0 .../DisableEasyConfirmationScreen.tsx | 8 +- .../EasyConfirmationScreen.stories.tsx | 12 +- .../EnableEasyConfirmationScreen.tsx | 20 +- .../EasyConfirmation/index.ts | 0 .../ManageCollateral/CollateralInfoModal.tsx | 0 .../ConfirmTx/FailedTx/FailedTxImage.tsx | 0 .../FailedTx/FailedTxScreen.stories.tsx | 0 .../ConfirmTx/FailedTx/FailedTxScreen.tsx | 10 +- .../SubmittedTx/SubmittedTxImage.tsx | 0 .../SubmittedTx/SubmittedTxScreen.stories.tsx | 0 .../SubmittedTx/SubmittedTxScreen.tsx | 12 +- .../InitialCollateralInfoModal.tsx | 4 +- .../ManageCollateralScreen.stories.tsx | 6 +- .../ManageCollateralScreen.tsx | 47 +- .../ManageCollateral/helpers.ts | 6 +- .../illustrations/InfoModalIllustration.tsx | 0 .../ManageCollateral/index.ts | 0 .../ManageCollateral/navigation.ts | 2 +- .../ManageCollateral/strings.ts | 0 .../RemoveWalletScreen.stories.tsx | 4 +- .../RemoveWallet/RemoveWalletScreen.tsx | 18 +- .../RemoveWallet/index.ts | 0 .../RenameWalletScreen.stories.tsx | 4 +- .../RenameWalletScreen/RenameWalletScreen.tsx | 18 +- .../WalletSettingsScreen.stories.tsx | 4 +- .../WalletSettingsScreen.tsx | 26 +- .../SetupWallet/SetupWalletNavigator.tsx | 2 +- .../Governance/GovernanceNavigator.tsx | 2 +- .../src/features/Swap/common/navigation.ts | 2 +- .../src/features/Swap/common/strings.ts | 15 +- .../useCases/ConfirmTxScreen/ConfirmTx.tsx | 41 - .../ConfirmTxScreen.stories.tsx | 107 -- .../ConfirmTxScreen/ConfirmTxWithHW.tsx | 104 -- .../ConfirmTxScreen/ConfirmTxWithPassword.tsx | 74 -- .../ReviewSwap.tsx} | 126 +- .../TransactionSummary.stories.tsx | 5 +- .../TransactionSummary.tsx | 256 ++-- .../CreateOrder/StartSwapOrderScreen.tsx | 2 +- .../ListOrders/OpenOrders.tsx | 2 +- .../src/features/Swap/useCases/index.ts | 1 - .../Transactions/TxHistoryNavigator.tsx | 15 +- .../useCases/TxDetails/AssetList.tsx | 2 +- .../useCases/TxDetails/TxDetails.tsx | 2 +- .../useCases/TxHistory/BalanceBanner.tsx | 2 +- .../useCases/TxHistory/LockedDeposit.tsx | 2 +- .../useCases/TxList/TxListItem.tsx | 4 +- .../AggregatedBalance.tsx | 2 +- .../src/hooks/useAllowScreenShot.tsx | 2 +- .../src/kernel/i18n/locales/en-US.json | 5 + apps/wallet-mobile/src/kernel/navigation.tsx | 2 +- .../legacy/Dashboard/DashboardNavigator.tsx | 2 +- .../src/legacy/Dashboard/UserSummary.tsx | 2 +- .../yoroi-wallets/cardano/cip30/cip30.test.ts | 1 + .../src/yoroi-wallets/cardano/utils.ts | 53 +- .../messages/src/WalletNavigator.json | 48 +- .../PairedBalance/PairedBalance.json | 4 +- .../ReviewTx/common/hooks/useStrings.json | 245 ++-- .../ApplicationSettingsScreen.json | 76 +- .../Settings/SettingsScreenNavigator.json | 160 +-- .../WalletSettings/WalletSettingsScreen.json | 84 +- .../changeAppSettings/About/About.json | 107 ++ .../ApplicationSettingsScreen.json | 287 +++++ .../ChangeNetwork/strings.json | 122 ++ .../EnableLoginWithOsScreen.json | 77 ++ .../ChangePassword/ChangePasswordScreen.json | 92 ++ .../DisableEasyConfirmationScreen.json | 32 + .../EnableEasyConfirmationScreen.json | 62 + .../ManageCollateral/strings.json | 197 +++ .../RemoveWallet/RemoveWalletScreen.json | 107 ++ .../RenameWalletScreen.json | 32 + .../SettingsScreenNavigator.json | 302 +++++ .../WalletSettingsScreen.json | 317 +++++ .../SetupWallet/SetupWalletNavigator.json | 48 +- .../src/features/Swap/common/strings.json | 1063 +++++++++-------- .../Transactions/TxHistoryNavigator.json | 171 +-- .../legacy/Dashboard/DashboardNavigator.json | 4 +- .../src/legacy/Dashboard/UserSummary.json | 16 +- 164 files changed, 3515 insertions(+), 1913 deletions(-) rename apps/wallet-mobile/src/{features/ReviewTx/common => components/Divider}/Divider.tsx (92%) delete mode 100644 apps/wallet-mobile/src/features/ReviewTx/common/hooks/useAddressType.tsx create mode 100644 apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedMetadata.tsx create mode 100644 apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Metadata/MetadataTab.tsx delete mode 100644 apps/wallet-mobile/src/features/Settings/ApplicationSettings/index.ts delete mode 100644 apps/wallet-mobile/src/features/Settings/WalletSettings/index.ts delete mode 100644 apps/wallet-mobile/src/features/Settings/index.ts rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/About/About.stories.tsx (60%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/About/About.tsx (93%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/About/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ApplicationSettings => useCases/changeAppSettings}/ApplicationSettingsScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ApplicationSettings => useCases/changeAppSettings}/ApplicationSettingsScreen.tsx (92%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeLanguage/ChangeLanguageScreen.stories.tsx (81%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeLanguage/ChangeLanguageScreen.tsx (87%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeLanguage/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/ChangeNetworkScreen.stories.tsx (81%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/ChangeNetworkScreen.tsx (90%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/NetworkPickerItem.tsx (95%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/NetworkPickerList.tsx (75%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/NetworkTag.tsx (87%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/PreparingNetworkScreen.tsx (95%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/strings.ts (97%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeNetwork/useLaunchRouteAfterSyncing.tsx (82%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeTheme/ChangeThemeScreen.stories.tsx (80%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeTheme/ChangeThemeScreen.tsx (90%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeTheme/ThemePickerItem.tsx (90%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ChangeTheme/ThemePickerList.tsx (91%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/Currency/ChangeCurrencyScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/Currency/ChangeCurrencyScreen.tsx (90%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/Currency/CurrencyContext.tsx (91%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/Currency/CurrencyPickerItem.tsx (91%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/Currency/CurrencyPickerList.tsx (92%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/EnableLoginWithOs/EnableLoginWithOsScreen.tsx (87%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/EnableLoginWithOs/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/PrivacyMode/PrivacyMode.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/PrivacyPolicy/PrivacyPolicyScreen.tsx (85%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/PrivacyPolicy/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ScreenShare/ScreenShare.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/ScreenShare/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/SystemLogScreen/SystemLogScreen.stories.tsx (64%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/SystemLogScreen/SystemLogScreen.tsx (92%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/TermsOfService/TermsOfServiceScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/TermsOfService/TermsOfServiceScreen.tsx (85%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeAppSettings}/TermsOfService/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ChangePassword/ChangePasswordScreen.stories.tsx (60%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ChangePassword/ChangePasswordScreen.tsx (91%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ChangePassword/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/EasyConfirmation/DisableEasyConfirmationScreen.tsx (87%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/EasyConfirmation/EasyConfirmationScreen.stories.tsx (80%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/EasyConfirmation/EnableEasyConfirmationScreen.tsx (84%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/EasyConfirmation/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/CollateralInfoModal.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ConfirmTx/FailedTx/FailedTxImage.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx (79%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxImage.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx (79%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/InitialCollateralInfoModal.tsx (90%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ManageCollateralScreen.stories.tsx (90%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/ManageCollateralScreen.tsx (82%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/helpers.ts (65%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/illustrations/InfoModalIllustration.tsx (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/navigation.ts (85%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/ManageCollateral/strings.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/RemoveWallet/RemoveWalletScreen.stories.tsx (64%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/RemoveWallet/RemoveWalletScreen.tsx (89%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/RemoveWallet/index.ts (100%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/RenameWalletScreen/RenameWalletScreen.stories.tsx (64%) rename apps/wallet-mobile/src/features/Settings/{ => useCases/changeWalletSettings}/RenameWalletScreen/RenameWalletScreen.tsx (82%) rename apps/wallet-mobile/src/features/Settings/{WalletSettings => useCases/changeWalletSettings}/WalletSettingsScreen.stories.tsx (66%) rename apps/wallet-mobile/src/features/Settings/{WalletSettings => useCases/changeWalletSettings}/WalletSettingsScreen.tsx (92%) delete mode 100644 apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTx.tsx delete mode 100644 apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.stories.tsx delete mode 100644 apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithHW.tsx delete mode 100644 apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithPassword.tsx rename apps/wallet-mobile/src/features/Swap/useCases/{ConfirmTxScreen/ConfirmTxScreen.tsx => ReviewSwap/ReviewSwap.tsx} (58%) rename apps/wallet-mobile/src/features/Swap/useCases/{ConfirmTxScreen => ReviewSwap}/TransactionSummary.stories.tsx (95%) rename apps/wallet-mobile/src/features/Swap/useCases/{ConfirmTxScreen => ReviewSwap}/TransactionSummary.tsx (63%) create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeAppSettings/About/About.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/strings.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/DisableEasyConfirmationScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EnableEasyConfirmationScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/strings.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/SettingsScreenNavigator.json create mode 100644 apps/wallet-mobile/translations/messages/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.json diff --git a/apps/wallet-mobile/.storybook/storybook.requires.js b/apps/wallet-mobile/.storybook/storybook.requires.js index 21011eaba6..41fde2e017 100644 --- a/apps/wallet-mobile/.storybook/storybook.requires.js +++ b/apps/wallet-mobile/.storybook/storybook.requires.js @@ -185,24 +185,24 @@ const getStories = () => { "./src/features/Send/useCases/StartMultiTokenTx/NotifySupportedNameServers/NotifySupportedNameServers.stories.tsx": require("../src/features/Send/useCases/StartMultiTokenTx/NotifySupportedNameServers/NotifySupportedNameServers.stories.tsx"), "./src/features/Send/useCases/StartMultiTokenTx/SelectNameServer/SelectNameServer.stories.tsx": require("../src/features/Send/useCases/StartMultiTokenTx/SelectNameServer/SelectNameServer.stories.tsx"), "./src/features/Send/useCases/StartMultiTokenTx/StartMultiTokenTxScreen.stories.tsx": require("../src/features/Send/useCases/StartMultiTokenTx/StartMultiTokenTxScreen.stories.tsx"), - "./src/features/Settings/About/About.stories.tsx": require("../src/features/Settings/About/About.stories.tsx"), - "./src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.stories.tsx": require("../src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.stories.tsx"), - "./src/features/Settings/ChangeLanguage/ChangeLanguageScreen.stories.tsx": require("../src/features/Settings/ChangeLanguage/ChangeLanguageScreen.stories.tsx"), - "./src/features/Settings/ChangeNetwork/ChangeNetworkScreen.stories.tsx": require("../src/features/Settings/ChangeNetwork/ChangeNetworkScreen.stories.tsx"), - "./src/features/Settings/ChangePassword/ChangePasswordScreen.stories.tsx": require("../src/features/Settings/ChangePassword/ChangePasswordScreen.stories.tsx"), - "./src/features/Settings/ChangeTheme/ChangeThemeScreen.stories.tsx": require("../src/features/Settings/ChangeTheme/ChangeThemeScreen.stories.tsx"), - "./src/features/Settings/Currency/ChangeCurrencyScreen.stories.tsx": require("../src/features/Settings/Currency/ChangeCurrencyScreen.stories.tsx"), - "./src/features/Settings/EasyConfirmation/EasyConfirmationScreen.stories.tsx": require("../src/features/Settings/EasyConfirmation/EasyConfirmationScreen.stories.tsx"), - "./src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx": require("../src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx"), - "./src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx": require("../src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx"), - "./src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx": require("../src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx"), - "./src/features/Settings/ManageCollateral/ManageCollateralScreen.stories.tsx": require("../src/features/Settings/ManageCollateral/ManageCollateralScreen.stories.tsx"), - "./src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx": require("../src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx"), - "./src/features/Settings/RemoveWallet/RemoveWalletScreen.stories.tsx": require("../src/features/Settings/RemoveWallet/RemoveWalletScreen.stories.tsx"), - "./src/features/Settings/RenameWalletScreen/RenameWalletScreen.stories.tsx": require("../src/features/Settings/RenameWalletScreen/RenameWalletScreen.stories.tsx"), - "./src/features/Settings/SystemLogScreen/SystemLogScreen.stories.tsx": require("../src/features/Settings/SystemLogScreen/SystemLogScreen.stories.tsx"), - "./src/features/Settings/TermsOfService/TermsOfServiceScreen.stories.tsx": require("../src/features/Settings/TermsOfService/TermsOfServiceScreen.stories.tsx"), - "./src/features/Settings/WalletSettings/WalletSettingsScreen.stories.tsx": require("../src/features/Settings/WalletSettings/WalletSettingsScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/About/About.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/About/About.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.stories.tsx"), + "./src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.stories.tsx": require("../src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EasyConfirmationScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EasyConfirmationScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.stories.tsx"), + "./src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.stories.tsx": require("../src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.stories.tsx"), "./src/features/SetupWallet/common/ButtonCard/ButtonCard.stories.tsx": require("../src/features/SetupWallet/common/ButtonCard/ButtonCard.stories.tsx"), "./src/features/SetupWallet/common/CardAboutPhrase/CardAboutPhrase.stories.tsx": require("../src/features/SetupWallet/common/CardAboutPhrase/CardAboutPhrase.stories.tsx"), "./src/features/SetupWallet/common/LearnMoreButton/LearnMoreButton.stories.tsx": require("../src/features/SetupWallet/common/LearnMoreButton/LearnMoreButton.stories.tsx"), @@ -241,10 +241,9 @@ const getStories = () => { "./src/features/Swap/common/LiquidityPool/LiquidityPool.stories.tsx": require("../src/features/Swap/common/LiquidityPool/LiquidityPool.stories.tsx"), "./src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.stories.tsx": require("../src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.stories.tsx"), "./src/features/Swap/common/ServiceUnavailable/ServiceUnavailable.stories.tsx": require("../src/features/Swap/common/ServiceUnavailable/ServiceUnavailable.stories.tsx"), - "./src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.stories.tsx": require("../src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.stories.tsx"), "./src/features/Swap/useCases/ConfirmTxScreen/ShowFailedTxScreen/ShowFailedTxScreen.stories.tsx": require("../src/features/Swap/useCases/ConfirmTxScreen/ShowFailedTxScreen/ShowFailedTxScreen.stories.tsx"), "./src/features/Swap/useCases/ConfirmTxScreen/ShowSubmittedTxScreen/ShowSubmittedTxScreen.stories.tsx": require("../src/features/Swap/useCases/ConfirmTxScreen/ShowSubmittedTxScreen/ShowSubmittedTxScreen.stories.tsx"), - "./src/features/Swap/useCases/ConfirmTxScreen/TransactionSummary.stories.tsx": require("../src/features/Swap/useCases/ConfirmTxScreen/TransactionSummary.stories.tsx"), + "./src/features/Swap/useCases/ReviewSwap/TransactionSummary.stories.tsx": require("../src/features/Swap/useCases/ReviewSwap/TransactionSummary.stories.tsx"), "./src/features/Swap/useCases/ShowPreprodNoticeScreen/ShowPreprodNoticeScreen.stories.tsx": require("../src/features/Swap/useCases/ShowPreprodNoticeScreen/ShowPreprodNoticeScreen.stories.tsx"), "./src/features/Swap/useCases/ShowSanchoNoticeScreen/ShowSanchoNoticeScreen.stories.tsx": require("../src/features/Swap/useCases/ShowSanchoNoticeScreen/ShowSanchoNoticeScreen.stories.tsx"), "./src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.stories.tsx": require("../src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.stories.tsx"), diff --git a/apps/wallet-mobile/src/InitApp.tsx b/apps/wallet-mobile/src/InitApp.tsx index cbda481e8a..e0c8b7e3e7 100644 --- a/apps/wallet-mobile/src/InitApp.tsx +++ b/apps/wallet-mobile/src/InitApp.tsx @@ -5,7 +5,7 @@ import {Platform, UIManager} from 'react-native' import uuid from 'uuid' import {AppNavigator} from './AppNavigator' -import {useInitScreenShare} from './features/Settings/ScreenShare' +import {useInitScreenShare} from './features/Settings/useCases/changeAppSettings/ScreenShare' import {useWalletManager} from './features/WalletManager/context/WalletManagerProvider' import {storageVersionMaker} from './kernel/storage/migrations/storageVersion' diff --git a/apps/wallet-mobile/src/WalletNavigator.tsx b/apps/wallet-mobile/src/WalletNavigator.tsx index c1d3857a7f..2fcf6cc04d 100644 --- a/apps/wallet-mobile/src/WalletNavigator.tsx +++ b/apps/wallet-mobile/src/WalletNavigator.tsx @@ -26,8 +26,8 @@ import {PortfolioNavigator} from './features/Portfolio/PortfolioNavigator' import {CatalystNavigator} from './features/RegisterCatalyst/CatalystNavigator' import {ReviewTxNavigator} from './features/ReviewTx/ReviewTxNavigator' import {SearchProvider} from './features/Search/SearchContext' -import {SettingsScreenNavigator} from './features/Settings' -import {NetworkTag} from './features/Settings/ChangeNetwork/NetworkTag' +import {SettingsScreenNavigator} from './features/Settings/SettingsScreenNavigator' +import {NetworkTag} from './features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {SetupWalletNavigator} from './features/SetupWallet/SetupWalletNavigator' import {GovernanceNavigator} from './features/Staking/Governance/GovernanceNavigator' import {SwapFormProvider} from './features/Swap/common/SwapFormProvider' diff --git a/apps/wallet-mobile/src/YoroiApp.tsx b/apps/wallet-mobile/src/YoroiApp.tsx index 655676b9c4..cfd5918dc8 100644 --- a/apps/wallet-mobile/src/YoroiApp.tsx +++ b/apps/wallet-mobile/src/YoroiApp.tsx @@ -7,7 +7,7 @@ import React from 'react' import {LogBox, StyleSheet} from 'react-native' import * as RNP from 'react-native-paper' import {initialWindowMetrics, SafeAreaProvider} from 'react-native-safe-area-context' -import {enableFreeze, enableScreens} from 'react-native-screens' +import {enableScreens} from 'react-native-screens' import {QueryClientProvider} from 'react-query' import {LoadingBoundary} from './components/Boundary/Boundary' @@ -16,7 +16,7 @@ import {AuthProvider} from './features/Auth/AuthProvider' import {BrowserProvider} from './features/Discover/common/BrowserProvider' import {PortfolioTokenActivityProvider} from './features/Portfolio/common/PortfolioTokenActivityProvider' import {ReviewTxProvider} from './features/ReviewTx/common/ReviewTxProvider' -import {CurrencyProvider} from './features/Settings/Currency/CurrencyContext' +import {CurrencyProvider} from './features/Settings/useCases/changeAppSettings/Currency/CurrencyContext' import {AutomaticWalletOpenerProvider} from './features/WalletManager/context/AutomaticWalletOpeningProvider' import {WalletManagerProvider} from './features/WalletManager/context/WalletManagerProvider' import {walletManager} from './features/WalletManager/wallet-manager' @@ -32,7 +32,6 @@ import {PoolTransitionProvider} from './legacy/Staking/PoolTransition/PoolTransi import {useThemeStorageMaker} from './yoroi-wallets/hooks' enableScreens(true) -enableFreeze(true) if (disableLogbox) { LogBox.ignoreAllLogs() diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/Divider.tsx b/apps/wallet-mobile/src/components/Divider/Divider.tsx similarity index 92% rename from apps/wallet-mobile/src/features/ReviewTx/common/Divider.tsx rename to apps/wallet-mobile/src/components/Divider/Divider.tsx index 1733930fda..d87afd1b14 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/Divider.tsx +++ b/apps/wallet-mobile/src/components/Divider/Divider.tsx @@ -2,7 +2,7 @@ import {SpacingSize, useTheme} from '@yoroi/theme' import * as React from 'react' import {StyleSheet, View} from 'react-native' -import {Space} from '../../../components/Space/Space' +import {Space} from '../Space/Space' export const Divider = ({verticalSpace = 'none'}: {verticalSpace?: SpacingSize}) => { const {styles} = useStyles() diff --git a/apps/wallet-mobile/src/components/HideableText/HideableText.stories.tsx b/apps/wallet-mobile/src/components/HideableText/HideableText.stories.tsx index 1146d2ac55..429f85b291 100644 --- a/apps/wallet-mobile/src/components/HideableText/HideableText.stories.tsx +++ b/apps/wallet-mobile/src/components/HideableText/HideableText.stories.tsx @@ -3,7 +3,7 @@ import React from 'react' import {StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {usePrivacyMode} from '../../features/Settings/PrivacyMode/PrivacyMode' +import {usePrivacyMode} from '../../features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {Button} from '../Button/Button' import {Spacer} from '../Spacer/Spacer' import {Text} from '../Text' diff --git a/apps/wallet-mobile/src/components/HideableText/HideableText.tsx b/apps/wallet-mobile/src/components/HideableText/HideableText.tsx index 17ddc8a7be..d87d04021b 100644 --- a/apps/wallet-mobile/src/components/HideableText/HideableText.tsx +++ b/apps/wallet-mobile/src/components/HideableText/HideableText.tsx @@ -1,7 +1,7 @@ import React from 'react' import {TextProps} from 'react-native' -import {usePrivacyMode} from '../../features/Settings/PrivacyMode/PrivacyMode' +import {usePrivacyMode} from '../../features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {Text} from '../Text' type Props = TextProps & { diff --git a/apps/wallet-mobile/src/components/PairedBalance/PairedBalance.tsx b/apps/wallet-mobile/src/components/PairedBalance/PairedBalance.tsx index e5a450f392..6a15669aeb 100644 --- a/apps/wallet-mobile/src/components/PairedBalance/PairedBalance.tsx +++ b/apps/wallet-mobile/src/components/PairedBalance/PairedBalance.tsx @@ -7,8 +7,8 @@ import {StyleSheet, Text, TextStyle} from 'react-native' import {usePortfolio} from '../../features/Portfolio/common/PortfolioProvider' import {usePortfolioTokenActivity} from '../../features/Portfolio/common/PortfolioTokenActivityProvider' -import {useCurrencyPairing} from '../../features/Settings/Currency/CurrencyContext' -import {usePrivacyMode} from '../../features/Settings/PrivacyMode/PrivacyMode' +import {useCurrencyPairing} from '../../features/Settings/useCases/changeAppSettings/Currency/CurrencyContext' +import {usePrivacyMode} from '../../features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {useWalletManager} from '../../features/WalletManager/context/WalletManagerProvider' import {CurrencySymbol} from '../../yoroi-wallets/types/other' import {Boundary, ResetError, ResetErrorRef} from '../Boundary/Boundary' diff --git a/apps/wallet-mobile/src/features/Discover/DiscoverNavigator.tsx b/apps/wallet-mobile/src/features/Discover/DiscoverNavigator.tsx index aca6bcf848..1b16ebd52f 100644 --- a/apps/wallet-mobile/src/features/Discover/DiscoverNavigator.tsx +++ b/apps/wallet-mobile/src/features/Discover/DiscoverNavigator.tsx @@ -7,7 +7,7 @@ import {ErrorBoundary} from 'react-error-boundary' import {LoadingBoundary} from '../../components/Boundary/Boundary' import {SomethingWentWrong} from '../../components/SomethingWentWrong/SomethingWentWrong' import {defaultStackNavigationOptions, DiscoverRoutes} from '../../kernel/navigation' -import {NetworkTag} from '../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {BrowserNavigator} from './BrowserNavigator' import {useStrings} from './common/useStrings' import {ReviewTransaction} from './useCases/ReviewTransaction/ReviewTransaction' diff --git a/apps/wallet-mobile/src/features/Discover/useCases/SelectDappFromList/SelectDappFromListScreen.tsx b/apps/wallet-mobile/src/features/Discover/useCases/SelectDappFromList/SelectDappFromListScreen.tsx index 39a2ee4b6c..28aec24bdb 100644 --- a/apps/wallet-mobile/src/features/Discover/useCases/SelectDappFromList/SelectDappFromListScreen.tsx +++ b/apps/wallet-mobile/src/features/Discover/useCases/SelectDappFromList/SelectDappFromListScreen.tsx @@ -7,7 +7,7 @@ import {SimpleTab} from '../../../../components/SimpleTab/SimpleTab' import {Spacer} from '../../../../components/Spacer/Spacer' import {useMetrics} from '../../../../kernel/metrics/metricsManager' import {useSearch, useSearchOnNavBar} from '../../../Search/SearchContext' -import {NetworkTag} from '../../../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../../../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {ChainDAppsWarning} from '../../common/ChainDAppsWarning' import {getGoogleSearchItem} from '../../common/helpers' import {useDAppsConnected} from '../../common/useDAppsConnected' diff --git a/apps/wallet-mobile/src/features/Menu/Menu.tsx b/apps/wallet-mobile/src/features/Menu/Menu.tsx index 590e375bfd..fdf416276d 100644 --- a/apps/wallet-mobile/src/features/Menu/Menu.tsx +++ b/apps/wallet-mobile/src/features/Menu/Menu.tsx @@ -19,7 +19,7 @@ import {usePrefetchStakingInfo} from '../../legacy/Dashboard/StakePoolInfos' import {usePoolTransition} from '../../legacy/Staking/PoolTransition/usePoolTransition' import {useCanVote} from '../RegisterCatalyst/common/hooks' import {InsufficientFundsModal} from '../RegisterCatalyst/common/InsufficientFundsModal' -import {NetworkTag} from '../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {useIsGovernanceFeatureEnabled} from '../Staking/Governance/common/helpers' import {useSelectedWallet} from '../WalletManager/common/hooks/useSelectedWallet' diff --git a/apps/wallet-mobile/src/features/Portfolio/NftsNavigator.tsx b/apps/wallet-mobile/src/features/Portfolio/NftsNavigator.tsx index 3c8323b85b..b7e3757c96 100644 --- a/apps/wallet-mobile/src/features/Portfolio/NftsNavigator.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/NftsNavigator.tsx @@ -4,7 +4,7 @@ import React from 'react' import {useMetrics} from '../../kernel/metrics/metricsManager' import {defaultStackNavigationOptions, NftRoutes} from '../../kernel/navigation' -import {NetworkTag} from '../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {useStrings} from './common/hooks/useStrings' import {MediaDetailsScreen} from './common/MediaDetailsScreen/MediaDetailsScreen' import {ListMediaGalleryScreen} from './useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ListMediaGalleryScreen' diff --git a/apps/wallet-mobile/src/features/Portfolio/PortfolioNavigator.tsx b/apps/wallet-mobile/src/features/Portfolio/PortfolioNavigator.tsx index 9d934d67c0..78ab679ccc 100644 --- a/apps/wallet-mobile/src/features/Portfolio/PortfolioNavigator.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/PortfolioNavigator.tsx @@ -5,7 +5,7 @@ import * as React from 'react' import {Boundary} from '../../components/Boundary/Boundary' import {defaultStackNavigationOptions, PortfolioRoutes} from '../../kernel/navigation' import {SearchProvider} from '../Search/SearchContext' -import {NetworkTag} from '../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {TxDetails} from '../Transactions/useCases/TxDetails/TxDetails' import {useStrings} from './common/hooks/useStrings' import {PortfolioProvider} from './common/PortfolioProvider' diff --git a/apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx b/apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx index 53713bf733..987be00e51 100644 --- a/apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx @@ -8,7 +8,7 @@ import {Icon} from '../../../../components/Icon' import {PairedBalance} from '../../../../components/PairedBalance/PairedBalance' import {Spacer} from '../../../../components/Spacer/Spacer' import {Text} from '../../../../components/Text' -import {usePrivacyMode} from '../../../Settings/PrivacyMode/PrivacyMode' +import {usePrivacyMode} from '../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {usePriceImpactRiskTheme} from '../../../Swap/common/helpers' import {SwapPriceImpactRisk} from '../../../Swap/common/types' import {TokenInfoIcon} from './TokenInfoIcon' diff --git a/apps/wallet-mobile/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts b/apps/wallet-mobile/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts index af3b08f03e..23bf03f74c 100644 --- a/apps/wallet-mobile/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts +++ b/apps/wallet-mobile/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts @@ -8,7 +8,7 @@ import {features} from '../../../../kernel/features' import {useLanguage} from '../../../../kernel/i18n' import {logger} from '../../../../kernel/logger/logger' import {fetchPtPriceActivity} from '../../../../yoroi-wallets/cardano/usePrimaryTokenActivity' -import {useCurrencyPairing} from '../../../Settings/Currency/CurrencyContext' +import {useCurrencyPairing} from '../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' import {useSelectedNetwork} from '../../../WalletManager/common/hooks/useSelectedNetwork' import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet' import {networkConfigs} from '../../../WalletManager/network-manager/network-manager' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCard.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCard.tsx index 3ae304e27e..b274a546c7 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCard.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCard.tsx @@ -4,7 +4,7 @@ import * as React from 'react' import {StyleSheet, View} from 'react-native' import LinearGradient from 'react-native-linear-gradient' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' import {aggregatePrimaryAmount} from '../../../common/helpers/aggregatePrimaryAmount' import {usePortfolioTokenActivity} from '../../../common/PortfolioTokenActivityProvider' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCardContent.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCardContent.tsx index 7a65980aaf..0933854186 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCardContent.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/BalanceCardContent.tsx @@ -6,8 +6,8 @@ import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {PairedBalance} from '../../../../../components/PairedBalance/PairedBalance' import {Spacer} from '../../../../../components/Spacer/Spacer' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' -import {usePrivacyMode} from '../../../../Settings/PrivacyMode/PrivacyMode' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' +import {usePrivacyMode} from '../../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {formatPriceChange, priceChange} from '../../../common/helpers/priceChange' import {useNavigateTo} from '../../../common/hooks/useNavigateTo' import {PnlTag} from '../../../common/PnlTag/PnlTag' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/Rate.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/Rate.tsx index 60db55acf8..c89411c969 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/Rate.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/BalanceCard/Rate.tsx @@ -2,7 +2,7 @@ import {useTheme} from '@yoroi/theme' import * as React from 'react' import {StyleSheet, Text} from 'react-native' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' type Props = {rate: number; name: string} export const Rate = ({rate, name}: Props) => { diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx index db49a33b5f..6d3401bf3c 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx @@ -7,8 +7,8 @@ import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {PairedBalance} from '../../../../../components/PairedBalance/PairedBalance' import {Spacer} from '../../../../../components/Spacer/Spacer' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' -import {usePrivacyMode} from '../../../../Settings/PrivacyMode/PrivacyMode' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' +import {usePrivacyMode} from '../../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {formatPriceChange, priceChange} from '../../../common/helpers/priceChange' import {useNavigateTo} from '../../../common/hooks/useNavigateTo' import {PnlTag} from '../../../common/PnlTag/PnlTag' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/PortfolioTokenChart/TokenPerformance.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/PortfolioTokenChart/TokenPerformance.tsx index b14eaef25b..04d66d481a 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/PortfolioTokenChart/TokenPerformance.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/PortfolioTokenChart/TokenPerformance.tsx @@ -5,7 +5,7 @@ import {StyleSheet, View} from 'react-native' import {Text} from '../../../../../components/Text' import {Tooltip} from '../../../../../components/Tooltip/Tooltip' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' import {formatPriceChange} from '../../../common/helpers/priceChange' import {TOKEN_CHART_INTERVAL, TokenChartInterval} from '../../../common/hooks/useGetPortfolioTokenChart' import {useStrings} from '../../../common/hooks/useStrings' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioTokenListScreen.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioTokenListScreen.tsx index 684c305a1f..b12faf3bb2 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioTokenListScreen.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioTokenListScreen.tsx @@ -6,7 +6,7 @@ import {SafeAreaView} from 'react-native-safe-area-context' import {Tab, TabPanel, Tabs} from '../../../../components/Tabs/Tabs' import {useMetrics} from '../../../../kernel/metrics/metricsManager' import {useSearchOnNavBar} from '../../../Search/SearchContext' -import {NetworkTag} from '../../../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../../../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {useGetDAppsPortfolioBalance} from '../../common/hooks/useGetDAppsPortfolioBalance' import {useStrings} from '../../common/hooks/useStrings' import {PortfolioListTab, usePortfolio} from '../../common/PortfolioProvider' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ListMediaGalleryScreen.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ListMediaGalleryScreen.tsx index f953cfeccb..7dafd5b684 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ListMediaGalleryScreen.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/ListMediaGalleryScreen/ListMediaGalleryScreen.tsx @@ -9,7 +9,7 @@ import {SafeAreaView} from 'react-native-safe-area-context' import {Space} from '../../../../../../components/Space/Space' import {useMetrics} from '../../../../../../kernel/metrics/metricsManager' import {useSearch, useSearchOnNavBar} from '../../../../../Search/SearchContext' -import {NetworkTag} from '../../../../../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../../../../../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {useSelectedWallet} from '../../../../../WalletManager/common/hooks/useSelectedWallet' import {usePortfolioBalances} from '../../../../common/hooks/usePortfolioBalances' import {useStrings} from '../../../../common/hooks/useStrings' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx index 43ae21f7d8..1c9cca4d84 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx @@ -6,8 +6,8 @@ import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {PairedBalance} from '../../../../../components/PairedBalance/PairedBalance' import {Spacer} from '../../../../../components/Spacer/Spacer' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' -import {usePrivacyMode} from '../../../../Settings/PrivacyMode/PrivacyMode' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' +import {usePrivacyMode} from '../../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {formatPriceChange, priceChange} from '../../../common/helpers/priceChange' import {useNavigateTo} from '../../../common/hooks/useNavigateTo' import {PnlTag} from '../../../common/PnlTag/PnlTag' diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValueBalance.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValueBalance.tsx index 0be7da56c9..909559e7ad 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValueBalance.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValueBalance.tsx @@ -4,8 +4,8 @@ import {Portfolio} from '@yoroi/types' import * as React from 'react' import {StyleSheet, Text, View} from 'react-native' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' -import {usePrivacyMode} from '../../../../Settings/PrivacyMode/PrivacyMode' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' +import {usePrivacyMode} from '../../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {SkeletonPrimaryToken} from './SkeletonPrimaryToken' type Props = { diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValuePairedBalance.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValuePairedBalance.tsx index a32669d6c6..28fad6bca3 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValuePairedBalance.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TokenValuePairedBalance.tsx @@ -5,7 +5,7 @@ import * as React from 'react' import {StyleSheet, Text} from 'react-native' import {PairedBalance} from '../../../../../components/PairedBalance/PairedBalance' -import {usePrivacyMode} from '../../../../Settings/PrivacyMode/PrivacyMode' +import {usePrivacyMode} from '../../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {SkeletonPairedToken} from './SkeletonPairedToken' type Props = { diff --git a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TotalTokensValueContent.tsx b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TotalTokensValueContent.tsx index 18efd6bf30..619f8d5e10 100644 --- a/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TotalTokensValueContent.tsx +++ b/apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/TotalTokensValue/TotalTokensValueContent.tsx @@ -6,8 +6,8 @@ import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {Icon} from '../../../../../components/Icon' import {Spacer} from '../../../../../components/Spacer/Spacer' import {Tooltip} from '../../../../../components/Tooltip/Tooltip' -import {useCurrencyPairing} from '../../../../Settings/Currency/CurrencyContext' -import {usePrivacyMode} from '../../../../Settings/PrivacyMode/PrivacyMode' +import {useCurrencyPairing} from '../../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext' +import {usePrivacyMode} from '../../../../Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode' import {formatPriceChange, priceChange} from '../../../common/helpers/priceChange' import {useStrings} from '../../../common/hooks/useStrings' import {PnlTag} from '../../../common/PnlTag/PnlTag' diff --git a/apps/wallet-mobile/src/features/RegisterCatalyst/CatalystNavigator.tsx b/apps/wallet-mobile/src/features/RegisterCatalyst/CatalystNavigator.tsx index ae20582593..de0fd14e4d 100644 --- a/apps/wallet-mobile/src/features/RegisterCatalyst/CatalystNavigator.tsx +++ b/apps/wallet-mobile/src/features/RegisterCatalyst/CatalystNavigator.tsx @@ -8,7 +8,6 @@ import {useIntl} from 'react-intl' import {StyleSheet} from 'react-native' import {Boundary} from '../../components/Boundary/Boundary' -import {NetworkTag} from '../../features/Settings/ChangeNetwork/NetworkTag' import globalMessages from '../../kernel/i18n/global-messages' import {useMetrics} from '../../kernel/metrics/metricsManager' import { @@ -17,6 +16,7 @@ import { VotingRegistrationRouteNavigation, VotingRegistrationRoutes, } from '../../kernel/navigation' +import {NetworkTag} from '../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {ConfirmPin} from './useCases/ConfirmPin/ConfirmPin' import {ConfirmVotingTx} from './useCases/ConfirmVotingTx/ConfirmVotingTx' import {DisplayPin} from './useCases/DisplayPin/DisplayPin' diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/Accordion.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/Accordion.tsx index 92e7bfb3ac..7256cff2d0 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/Accordion.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/common/Accordion.tsx @@ -1,6 +1,6 @@ import {useTheme} from '@yoroi/theme' import * as React from 'react' -import {Animated, LayoutAnimation, StyleSheet, Text, TouchableOpacity, View} from 'react-native' +import {Animated, Easing, StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {Icon} from '../../../components/Icon' @@ -10,12 +10,12 @@ export const Accordion = ({label, children}: {label: string; children: React.Rea const animatedHeight = React.useRef(new Animated.Value(0)).current const toggleSection = () => { - LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut) setIsOpen(!isOpen) Animated.timing(animatedHeight, { toValue: isOpen ? 0 : 1, duration: 300, useNativeDriver: false, + easing: Easing.ease, }).start() } diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/CopiableText.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/CopiableText.tsx index 9d2865f4c1..45dea2a1e6 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/CopiableText.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/common/CopiableText.tsx @@ -1,25 +1,40 @@ import {useTheme} from '@yoroi/theme' import * as React from 'react' -import {StyleSheet, TouchableOpacity, View} from 'react-native' +import {StyleSheet, TouchableOpacity, View, ViewStyle} from 'react-native' import {useCopy} from '../../../components/Clipboard/ClipboardProvider' import {Icon} from '../../../components/Icon' -export const CopiableText = ({children, textToCopy}: {children: React.ReactNode; textToCopy: string}) => { - const {styles, colors} = useStyles() - const {copy} = useCopy() +export const CopiableText = ({ + children, + style, + textToCopy, +}: { + children: React.ReactNode + style?: ViewStyle + textToCopy: string +}) => { + const {styles} = useStyles() return ( - + {children} - copy({text: textToCopy})} activeOpacity={0.5}> - - + ) } +export const CopyButton = ({textToCopy}: {textToCopy: string}) => { + const {colors} = useStyles() + const {copy} = useCopy() + return ( + copy({text: textToCopy})} activeOpacity={0.5}> + + + ) +} + const useStyles = () => { const {atoms, color} = useTheme() const styles = StyleSheet.create({ diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/ReviewTxProvider.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/ReviewTxProvider.tsx index 05dd6ec924..93f5632b61 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/ReviewTxProvider.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/common/ReviewTxProvider.tsx @@ -24,6 +24,9 @@ export const ReviewTxProvider = ({ cborChanged: (cbor: ReviewTxState['cbor']) => dispatch({type: ReviewTxActionType.CborChanged, cbor}), operationsChanged: (operations: ReviewTxState['operations']) => dispatch({type: ReviewTxActionType.OperationsChanged, operations}), + customReceiverTitleChanged: (customReceiverTitle: ReviewTxState['customReceiverTitle']) => + dispatch({type: ReviewTxActionType.CustomReceiverTitleChanged, customReceiverTitle}), + detailsChanged: (details: ReviewTxState['details']) => dispatch({type: ReviewTxActionType.DetailsChanged, details}), onSuccessChanged: (onSuccess: ReviewTxState['onSuccess']) => dispatch({type: ReviewTxActionType.OnSuccessChanged, onSuccess}), onErrorChanged: (onError: ReviewTxState['onError']) => dispatch({type: ReviewTxActionType.OnErrorChanged, onError}), @@ -55,6 +58,14 @@ const reviewTxReducer = (state: ReviewTxState, action: ReviewTxAction) => { draft.operations = action.operations break + case ReviewTxActionType.CustomReceiverTitleChanged: + draft.customReceiverTitle = action.customReceiverTitle + break + + case ReviewTxActionType.DetailsChanged: + draft.details = action.details + break + case ReviewTxActionType.OnSuccessChanged: draft.onSuccess = action.onSuccess break @@ -82,6 +93,14 @@ type ReviewTxAction = type: ReviewTxActionType.OperationsChanged operations: ReviewTxState['operations'] } + | { + type: ReviewTxActionType.CustomReceiverTitleChanged + customReceiverTitle: ReviewTxState['customReceiverTitle'] + } + | { + type: ReviewTxActionType.DetailsChanged + details: ReviewTxState['details'] + } | { type: ReviewTxActionType.OnSuccessChanged onSuccess: ReviewTxState['onSuccess'] @@ -95,6 +114,8 @@ export type ReviewTxState = { unsignedTx: YoroiUnsignedTx | null cbor: string | null operations: Array | null + customReceiverTitle: React.ReactNode | null + details: {title: string; component: React.ReactNode} | null onSuccess: ((signedTx: YoroiSignedTx) => void) | null onError: (() => void) | null } @@ -103,6 +124,8 @@ type ReviewTxActions = { unsignedTxChanged: (unsignedTx: ReviewTxState['unsignedTx']) => void cborChanged: (cbor: ReviewTxState['cbor']) => void operationsChanged: (operations: ReviewTxState['operations']) => void + customReceiverTitleChanged: (customReceiverTitle: ReviewTxState['customReceiverTitle']) => void + detailsChanged: (details: ReviewTxState['details']) => void onSuccessChanged: (onSuccess: ReviewTxState['onSuccess']) => void onErrorChanged: (onError: ReviewTxState['onError']) => void } @@ -111,6 +134,8 @@ const defaultState: ReviewTxState = Object.freeze({ unsignedTx: null, cbor: null, operations: null, + customReceiverTitle: null, + details: null, onSuccess: null, onError: null, }) @@ -124,6 +149,8 @@ const initialReviewTxContext: ReviewTxContext = { unsignedTxChanged: missingInit, cborChanged: missingInit, operationsChanged: missingInit, + customReceiverTitleChanged: missingInit, + detailsChanged: missingInit, onSuccessChanged: missingInit, onErrorChanged: missingInit, } @@ -132,6 +159,8 @@ enum ReviewTxActionType { UnsignedTxChanged = 'unsignedTxChanged', CborChanged = 'cborChanged', OperationsChanged = 'operationsChanged', + CustomReceiverTitleChanged = 'customReceiverTitleChanged', + DetailsChanged = 'detailsChanged', OnSuccessChanged = 'onSuccessChanged', OnErrorChanged = 'onErrorChanged', } diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useAddressType.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useAddressType.tsx deleted file mode 100644 index 6e054df944..0000000000 --- a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useAddressType.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import {useQuery} from 'react-query' - -import {getAddressType} from '../../../../yoroi-wallets/cardano/utils' - -export const useAddressType = (address: string) => { - const query = useQuery(['useAddressType', address], () => getAddressType(address), { - suspense: true, - }) - - if (query.data === undefined) throw new Error('invalid address type') - return query.data -} diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedMetadata.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedMetadata.tsx new file mode 100644 index 0000000000..7b67530d7c --- /dev/null +++ b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedMetadata.tsx @@ -0,0 +1,13 @@ +import {YoroiUnsignedTx} from '../../../../yoroi-wallets/types/yoroi' +import {TransactionBody} from '../types' + +export const formatMetadata = (unsignedTx: YoroiUnsignedTx, txBody: TransactionBody) => { + const hash = txBody.auxiliary_data_hash ?? null + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const metadata = unsignedTx.metadata?.['674']?.['msg' as any] ?? null + + return { + hash, + metadata: {msg: [JSON.parse(metadata)]}, + } +} diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedTx.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedTx.tsx index 7949d9541d..91ef9f2d30 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedTx.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedTx.tsx @@ -1,10 +1,13 @@ -import {invalid, isNonNullable} from '@yoroi/common' +// import {CredKind} from '@emurgo/csl-mobile-bridge' +import {CredKind} from '@emurgo/cross-csl-core' +import {isNonNullable} from '@yoroi/common' import {infoExtractName} from '@yoroi/portfolio' import {Portfolio} from '@yoroi/types' import _ from 'lodash' import {useQuery} from 'react-query' import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types' +import {deriveRewardAddressFromAddress} from '../../../../yoroi-wallets/cardano/utils' import {wrappedCsl} from '../../../../yoroi-wallets/cardano/wrappedCsl' import {formatTokenWithText} from '../../../../yoroi-wallets/utils/format' import {asQuantity} from '../../../../yoroi-wallets/utils/utils' @@ -14,12 +17,13 @@ import { FormattedFee, FormattedInputs, FormattedOutputs, + FormattedTx, TransactionBody, TransactionInputs, TransactionOutputs, } from '../types' -export const useFormattedTx = (data: TransactionBody) => { +export const useFormattedTx = (data: TransactionBody): FormattedTx => { const {wallet} = useSelectedWallet() const inputs = data?.inputs ?? [] @@ -93,10 +97,14 @@ const formatInputs = async ( inputs.map(async (input) => { const receiveUTxO = getUtxoByTxIdAndIndex(wallet, input.transaction_id, input.index) const address = receiveUTxO?.receiver - const rewardAddress = - address !== undefined ? await deriveRewardAddressFromAddress(address, wallet.networkManager.chainId) : null const coin = receiveUTxO?.amount != null ? asQuantity(receiveUTxO.amount) : null + const addressKind = address != null ? await getAddressKind(address) : null + const rewardAddress = + address != null && addressKind === CredKind.Key + ? await deriveAddress(address, wallet.networkManager.chainId) + : null + const primaryAssets = coin != null ? [ @@ -130,6 +138,7 @@ const formatInputs = async ( return { assets: [...primaryAssets, ...multiAssets].filter(isNonNullable), address, + addressKind: addressKind ?? null, rewardAddress, ownAddress: address != null && isOwnedAddress(wallet, address), txIndex: input.index, @@ -147,9 +156,12 @@ const formatOutputs = async ( return Promise.all( outputs.map(async (output) => { const address = output.address - const rewardAddress = await deriveRewardAddressFromAddress(address, wallet.networkManager.chainId) const coin = asQuantity(output.amount.coin) + const addressKind = await getAddressKind(address) + const rewardAddress = + addressKind === CredKind.Key ? await deriveAddress(address, wallet.networkManager.chainId) : null + const primaryAssets = [ { tokenInfo: wallet.portfolioPrimaryTokenInfo, @@ -183,6 +195,7 @@ const formatOutputs = async ( return { assets, address, + addressKind, rewardAddress, ownAddress: isOwnedAddress(wallet, address), } @@ -202,20 +215,21 @@ export const formatFee = (wallet: YoroiWallet, data: TransactionBody): Formatted } } -export const deriveRewardAddressFromAddress = async (address: string, chainId: number): Promise => { +const deriveAddress = async (address: string, chainId: number) => { + try { + return await deriveRewardAddressFromAddress(address, chainId) + } catch { + return null + } +} + +const getAddressKind = async (addressBech32: string): Promise => { const {csl, release} = wrappedCsl() try { - const result = await csl.Address.fromBech32(address) - .then((address) => csl.BaseAddress.fromAddress(address)) - .then((baseAddress) => baseAddress?.stakeCred() ?? invalid('invalid base address')) - .then((stakeCredential) => csl.RewardAddress.new(chainId, stakeCredential)) - .then((rewardAddress) => rewardAddress.toAddress()) - .then((rewardAddrAsAddress) => rewardAddrAsAddress.toBech32(undefined)) - .catch((error) => error) - - if (typeof result !== 'string') throw new Error('Its not possible to derive reward address') - return result + const address = await csl.Address.fromBech32(addressBech32) + const addressKind = await (await address.paymentCred())?.kind() + return addressKind ?? null } finally { release() } diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useStrings.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useStrings.tsx index 9914016ec2..b6e245d124 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useStrings.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useStrings.tsx @@ -11,6 +11,9 @@ export const useStrings = () => { title: intl.formatMessage(messages.title), utxosTab: intl.formatMessage(messages.utxosTab), overviewTab: intl.formatMessage(messages.overviewTab), + metadataTab: intl.formatMessage(messages.metadataTab), + metadataHash: intl.formatMessage(messages.metadataHash), + metadataJsonLabel: intl.formatMessage(messages.metadataJsonLabel), walletLabel: intl.formatMessage(messages.walletLabel), feeLabel: intl.formatMessage(messages.feeLabel), myWalletLabel: intl.formatMessage(messages.myWalletLabel), @@ -52,6 +55,18 @@ const messages = defineMessages({ id: 'txReview.tabLabel.overview', defaultMessage: '!!!Overview', }, + metadataTab: { + id: 'txReview.tabLabel.metadataTab', + defaultMessage: '!!!Metadata', + }, + metadataHash: { + id: 'txReview.metadata.metadataHash', + defaultMessage: '!!!Metadata hash', + }, + metadataJsonLabel: { + id: 'txReview.metadata.metadataJsonLabel', + defaultMessage: '!!!Metadata', + }, walletLabel: { id: 'txReview.overview.wallet', defaultMessage: '!!!Wallet', diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useTxBody.tsx b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useTxBody.tsx index 9de33bb075..75588bd47a 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useTxBody.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/common/hooks/useTxBody.tsx @@ -2,8 +2,9 @@ import {useQuery} from 'react-query' import {wrappedCsl} from '../../../../yoroi-wallets/cardano/wrappedCsl' import {YoroiUnsignedTx} from '../../../../yoroi-wallets/types/yoroi' +import {TransactionBody} from '../types' -export const useTxBody = ({cbor, unsignedTx}: {cbor?: string; unsignedTx?: YoroiUnsignedTx}) => { +export const useTxBody = ({cbor, unsignedTx}: {cbor?: string; unsignedTx?: YoroiUnsignedTx}): TransactionBody => { const query = useQuery( ['useTxBody', cbor, unsignedTx], async () => { diff --git a/apps/wallet-mobile/src/features/ReviewTx/common/types.ts b/apps/wallet-mobile/src/features/ReviewTx/common/types.ts index 45744a4cf6..74cb9b2451 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/common/types.ts +++ b/apps/wallet-mobile/src/features/ReviewTx/common/types.ts @@ -3,6 +3,7 @@ import { TransactionInputsJSON, TransactionOutputsJSON, } from '@emurgo/cardano-serialization-lib-nodejs' +import {CredKind} from '@emurgo/cross-csl-core' import {Balance, Portfolio} from '@yoroi/types' export type TransactionBody = TransactionBodyJSON @@ -18,6 +19,7 @@ export type FormattedInput = { isPrimary: boolean }> address: string | undefined + addressKind: CredKind | null rewardAddress: string | null ownAddress: boolean txIndex: number @@ -35,6 +37,7 @@ export type FormattedOutput = { isPrimary: boolean }> address: string + addressKind: CredKind | null rewardAddress: string | null ownAddress: boolean } @@ -54,3 +57,8 @@ export type FormattedTx = { outputs: FormattedOutputs fee: FormattedFee } + +export type Metadata = { + json: string | null + hash: string | null +} diff --git a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Metadata/MetadataTab.tsx b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Metadata/MetadataTab.tsx new file mode 100644 index 0000000000..c60e4d1c60 --- /dev/null +++ b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Metadata/MetadataTab.tsx @@ -0,0 +1,90 @@ +import {useTheme} from '@yoroi/theme' +import * as React from 'react' +import {StyleSheet, Text, View} from 'react-native' + +import {Space} from '../../../../../components/Space/Space' +import {CopiableText, CopyButton} from '../../../common/CopiableText' +import {useStrings} from '../../../common/hooks/useStrings' + +type Props = { + hash: string | null + metadata: {msg: Array} | null +} + +export const MetadataTab = ({metadata, hash}: Props) => { + const {styles} = useStyles() + const strings = useStrings() + + if (hash == null || metadata == null) return null + + const metadataFormatted = JSON.stringify(metadata, null, 2) + + return ( + + + + + {strings.metadataHash} + + + + + {hash} + + + + + + + + {strings.metadataJsonLabel} + + + + + + + {metadataFormatted} + + + ) +} + +const useStyles = () => { + const {atoms, color} = useTheme() + const styles = StyleSheet.create({ + root: { + ...atoms.flex_1, + ...atoms.px_lg, + backgroundColor: color.bg_color_max, + }, + title: { + ...atoms.flex_row, + ...atoms.justify_between, + }, + label: { + ...atoms.body_2_md_regular, + color: color.text_gray_low, + }, + text: { + ...atoms.text_right, + ...atoms.flex_1, + ...atoms.body_2_md_regular, + color: color.text_gray_medium, + }, + hashContainer: { + ...atoms.flex_1, + }, + metadata: { + backgroundColor: color.bg_color_min, + ...atoms.rounded_sm, + ...atoms.p_lg, + }, + metadataLabel: { + ...atoms.body_1_lg_medium, + color: color.text_gray_medium, + }, + }) + + return {styles} as const +} diff --git a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Overview/OverviewTab.tsx b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Overview/OverviewTab.tsx index 92278d03ba..cd04aeeb68 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Overview/OverviewTab.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/Overview/OverviewTab.tsx @@ -1,11 +1,14 @@ // 🚧 TODO: grouping by staking address 🚧 +import {CredKind} from '@emurgo/cross-csl-core' import {Blockies} from '@yoroi/identicon' import {useTheme} from '@yoroi/theme' import * as React from 'react' import {Linking, StyleSheet, Text, TouchableOpacity, View} from 'react-native' +import {Divider} from '../../../../../components/Divider/Divider' import {Icon} from '../../../../../components/Icon' +import {useModal} from '../../../../../components/Modal/ModalContext' import {Space} from '../../../../../components/Space/Space' import {formatTokenWithText} from '../../../../../yoroi-wallets/utils/format' import {Quantities} from '../../../../../yoroi-wallets/utils/utils' @@ -13,14 +16,20 @@ import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelec import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' import {Accordion} from '../../../common/Accordion' import {CopiableText} from '../../../common/CopiableText' -import {Divider} from '../../../common/Divider' -import {useAddressType} from '../../../common/hooks/useAddressType' import {useStrings} from '../../../common/hooks/useStrings' -import {ReviewTxState} from '../../../common/ReviewTxProvider' +import {ReviewTxState, useReviewTx} from '../../../common/ReviewTxProvider' import {TokenItem} from '../../../common/TokenItem' import {FormattedOutputs, FormattedTx} from '../../../common/types' -export const OverviewTab = ({tx, operations}: {tx: FormattedTx; operations: ReviewTxState['operations']}) => { +export const OverviewTab = ({ + tx, + operations, + details, +}: { + tx: FormattedTx + operations: ReviewTxState['operations'] + details: ReviewTxState['details'] +}) => { const {styles} = useStyles() const notOwnedOutputs = React.useMemo(() => tx.outputs.filter((output) => !output.ownAddress), [tx.outputs]) @@ -37,6 +46,8 @@ export const OverviewTab = ({tx, operations}: {tx: FormattedTx; operations: Revi + +
) } @@ -94,7 +105,7 @@ const SenderSection = ({ }) => { const strings = useStrings() const {styles} = useStyles() - const address = ownedOutputs[0]?.rewardAddress ?? ownedOutputs[0]?.address + const address = ownedOutputs[0]?.rewardAddress ?? ownedOutputs[0]?.address ?? '-' return ( @@ -172,24 +183,30 @@ const SenderSectionLabel = () => { } const ReceiverSection = ({notOwnedOutputs}: {notOwnedOutputs: FormattedOutputs}) => { - const address = notOwnedOutputs[0]?.rewardAddress ?? notOwnedOutputs[0]?.address + const address = notOwnedOutputs[0]?.rewardAddress ?? notOwnedOutputs[0]?.address ?? '-' const {styles} = useStyles() const strings = useStrings() - const addressType = useAddressType(address) - const isScriptAddress = addressType === 'script' + const {customReceiverTitle} = useReviewTx() return ( <> - {isScriptAddress ? strings.receiveToScriptLabel : strings.receiveToLabel}: + + {notOwnedOutputs[0]?.addressKind === CredKind.Script && customReceiverTitle == null + ? strings.receiveToScriptLabel + : strings.receiveToLabel} + : + - - - {address} - - + {customReceiverTitle ?? ( + + + {address} + + + )} ) @@ -221,6 +238,29 @@ const OperationsSection = ({operations}: {operations: ReviewTxState['operations' ) } +const Details = ({details}: {details: ReviewTxState['details']}) => { + const {openModal} = useModal() + const {styles} = useStyles() + + if (details == null) return null + + const handleOnPress = () => { + openModal(details.title ?? '', {details.component}, 550) + } + + return ( + + + + + + {details?.title} + + + + ) +} + const useStyles = () => { const {atoms, color} = useTheme() const styles = StyleSheet.create({ @@ -290,6 +330,18 @@ const useStyles = () => { ...atoms.body_2_md_regular, color: color.text_gray_medium, }, + detailsRow: { + ...atoms.flex_1, + ...atoms.flex_row, + ...atoms.justify_end, + }, + details: { + ...atoms.px_lg, + }, + detailsButton: { + ...atoms.body_2_md_medium, + color: color.text_primary_medium, + }, }) const colors = { diff --git a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx index 035dc332c2..9b0550327d 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx @@ -1,15 +1,28 @@ import {createMaterialTopTabNavigator, MaterialTopTabBarProps} from '@react-navigation/material-top-tabs' import {useTheme} from '@yoroi/theme' import * as React from 'react' -import {FlatList, ScrollView, StyleSheet, Text, TouchableOpacity, TouchableOpacityProps, View} from 'react-native' +import { + FlatList, + StyleProp, + StyleSheet, + Text, + TouchableOpacity, + TouchableOpacityProps, + View, + ViewStyle, +} from 'react-native' import {Button} from '../../../../components/Button/Button' import {SafeArea} from '../../../../components/SafeArea' +import {ScrollView} from '../../../../components/ScrollView/ScrollView' +import {isEmptyString} from '../../../../kernel/utils' +import {formatMetadata} from '../../common/hooks/useFormattedMetadata' import {useFormattedTx} from '../../common/hooks/useFormattedTx' import {useOnConfirm} from '../../common/hooks/useOnConfirm' import {useStrings} from '../../common/hooks/useStrings' import {useTxBody} from '../../common/hooks/useTxBody' import {useReviewTx} from '../../common/ReviewTxProvider' +import {MetadataTab} from './Metadata/MetadataTab' import {OverviewTab} from './Overview/OverviewTab' import {UTxOsTab} from './UTxOs/UTxOsTab' @@ -18,7 +31,7 @@ const MaterialTab = createMaterialTopTabNavigator() export const ReviewTxScreen = () => { const {styles} = useStyles() const strings = useStrings() - const {unsignedTx, operations, onSuccess, onError} = useReviewTx() + const {unsignedTx, operations, details, onSuccess, onError} = useReviewTx() if (unsignedTx === null) throw new Error('ReviewTxScreen: missing unsignedTx') @@ -28,21 +41,27 @@ export const ReviewTxScreen = () => { onError, }) - // TODO: add cbor arguments + // TODO: apply cbor const txBody = useTxBody({unsignedTx}) const formatedTx = useFormattedTx(txBody) + const formattedMetadata = formatMetadata(unsignedTx, txBody) - const OverViewTabMemo = React.memo(() => ) - const UTxOsTabMemo = React.memo(() => ) + const tabsData = [ + [strings.overviewTab, 'overview'], + [strings.utxosTab, 'utxos'], + ] + + if (!isEmptyString(formattedMetadata.hash) && formattedMetadata.metadata != null) + tabsData.push([strings.metadataTab, 'metadata']) return ( - + }> {() => ( /* TODO: make scrollview general to use button border */ - + )} @@ -51,7 +70,16 @@ export const ReviewTxScreen = () => { {() => ( /* TODO: make scrollview general to use button border */ - + + + )} + + + + {() => ( + /* TODO: make scrollview general to use button border */ + + )} @@ -64,16 +92,12 @@ export const ReviewTxScreen = () => { ) } -const TabBar = ({navigation, state}: MaterialTopTabBarProps) => { +const TabBar = ({navigation, state, tabsData}: MaterialTopTabBarProps & {tabsData: Array>}) => { const {styles} = useStyles() - const strings = useStrings() return ( ( navigation.navigate(key)} /> )} @@ -105,9 +129,9 @@ export const Tab = ({ ) } -const Actions = ({children}: {children: React.ReactNode}) => { +const Actions = ({children, style}: {children: React.ReactNode; style?: StyleProp}) => { const {styles} = useStyles() - return {children} + return {children} } const useStyles = () => { @@ -154,5 +178,8 @@ const useStyles = () => { }, }) - return {styles} as const + const colors = { + lightGray: color.gray_200, + } + return {styles, colors} as const } diff --git a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/UTxOs/UTxOsTab.tsx b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/UTxOs/UTxOsTab.tsx index 83861af94f..03c5811e9f 100644 --- a/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/UTxOs/UTxOsTab.tsx +++ b/apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/UTxOs/UTxOsTab.tsx @@ -2,10 +2,10 @@ import {useTheme} from '@yoroi/theme' import * as React from 'react' import {StyleSheet, Text, View} from 'react-native' +import {Divider} from '../../../../../components/Divider/Divider' import {Space} from '../../../../../components/Space/Space' import {Accordion} from '../../../common/Accordion' import {CopiableText} from '../../../common/CopiableText' -import {Divider} from '../../../common/Divider' import {useStrings} from '../../../common/hooks/useStrings' import {TokenItem} from '../../../common/TokenItem' import {FormattedInput, FormattedInputs, FormattedOutput, FormattedOutputs, FormattedTx} from '../../../common/types' diff --git a/apps/wallet-mobile/src/features/Settings/ApplicationSettings/index.ts b/apps/wallet-mobile/src/features/Settings/ApplicationSettings/index.ts deleted file mode 100644 index 591971f428..0000000000 --- a/apps/wallet-mobile/src/features/Settings/ApplicationSettings/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ApplicationSettingsScreen' diff --git a/apps/wallet-mobile/src/features/Settings/SettingsItems.tsx b/apps/wallet-mobile/src/features/Settings/SettingsItems.tsx index 3c062c34bc..eba1b38cba 100644 --- a/apps/wallet-mobile/src/features/Settings/SettingsItems.tsx +++ b/apps/wallet-mobile/src/features/Settings/SettingsItems.tsx @@ -10,7 +10,7 @@ import {Text} from '../../components/Text' import {isEmptyString} from '../../kernel/utils' import {useCollateralInfo} from '../../yoroi-wallets/cardano/utxoManager/useCollateralInfo' import {useSelectedWallet} from '../WalletManager/common/hooks/useSelectedWallet' -import {usePrivacyMode} from './PrivacyMode/PrivacyMode' +import {usePrivacyMode} from './useCases/changeAppSettings/PrivacyMode/PrivacyMode' const Touchable = (props: TouchableOpacityProps) => diff --git a/apps/wallet-mobile/src/features/Settings/SettingsScreenNavigator.tsx b/apps/wallet-mobile/src/features/Settings/SettingsScreenNavigator.tsx index 734bb47a56..8041fb2e52 100644 --- a/apps/wallet-mobile/src/features/Settings/SettingsScreenNavigator.tsx +++ b/apps/wallet-mobile/src/features/Settings/SettingsScreenNavigator.tsx @@ -18,26 +18,32 @@ import { } from '../../kernel/navigation' import {ChangePinScreen} from '../Auth/ChangePinScreen' import {EnableLoginWithPin} from '../Auth/EnableLoginWithPin' -import {About} from './About' -import {ApplicationSettingsScreen} from './ApplicationSettings' -import {ChangeLanguageScreen} from './ChangeLanguage' -import {ChangeNetworkScreen, useHandleOpenNetworkNoticeModal} from './ChangeNetwork/ChangeNetworkScreen' -import {NetworkTag} from './ChangeNetwork/NetworkTag' -import {PreparingNetworkScreen} from './ChangeNetwork/PreparingNetworkScreen' -import {ChangePasswordScreen} from './ChangePassword' -import {ChangeThemeScreen} from './ChangeTheme/ChangeThemeScreen' -import {ChangeCurrencyScreen} from './Currency/ChangeCurrencyScreen' -import {DisableEasyConfirmationScreen, EnableEasyConfirmationScreen} from './EasyConfirmation' -import {EnableLoginWithOsScreen} from './EnableLoginWithOs' -import {ManageCollateralScreen} from './ManageCollateral' -import {FailedTxScreen} from './ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen' -import {SubmittedTxScreen} from './ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen' -import {PrivacyPolicyScreen} from './PrivacyPolicy' -import {RemoveWalletScreen} from './RemoveWallet' -import {RenameWalletScreen} from './RenameWalletScreen/RenameWalletScreen' -import {SystemLogScreen} from './SystemLogScreen/SystemLogScreen' -import {TermsOfServiceScreen} from './TermsOfService' -import {WalletSettingsScreen} from './WalletSettings' +import {About} from './useCases/changeAppSettings/About' +import {ApplicationSettingsScreen} from './useCases/changeAppSettings/ApplicationSettingsScreen' +import {ChangeLanguageScreen} from './useCases/changeAppSettings/ChangeLanguage' +import { + ChangeNetworkScreen, + useHandleOpenNetworkNoticeModal, +} from './useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen' +import {NetworkTag} from './useCases/changeAppSettings/ChangeNetwork/NetworkTag' +import {PreparingNetworkScreen} from './useCases/changeAppSettings/ChangeNetwork/PreparingNetworkScreen' +import {ChangeThemeScreen} from './useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen' +import {ChangeCurrencyScreen} from './useCases/changeAppSettings/Currency/ChangeCurrencyScreen' +import {EnableLoginWithOsScreen} from './useCases/changeAppSettings/EnableLoginWithOs' +import {PrivacyPolicyScreen} from './useCases/changeAppSettings/PrivacyPolicy' +import {SystemLogScreen} from './useCases/changeAppSettings/SystemLogScreen/SystemLogScreen' +import {TermsOfServiceScreen} from './useCases/changeAppSettings/TermsOfService' +import {ChangePasswordScreen} from './useCases/changeWalletSettings/ChangePassword' +import { + DisableEasyConfirmationScreen, + EnableEasyConfirmationScreen, +} from './useCases/changeWalletSettings/EasyConfirmation' +import {ManageCollateralScreen} from './useCases/changeWalletSettings/ManageCollateral' +import {FailedTxScreen} from './useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen' +import {SubmittedTxScreen} from './useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen' +import {RemoveWalletScreen} from './useCases/changeWalletSettings/RemoveWallet' +import {RenameWalletScreen} from './useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen' +import {WalletSettingsScreen} from './useCases/changeWalletSettings/WalletSettingsScreen' const Stack = createStackNavigator() export const SettingsScreenNavigator = () => { diff --git a/apps/wallet-mobile/src/features/Settings/WalletSettings/index.ts b/apps/wallet-mobile/src/features/Settings/WalletSettings/index.ts deleted file mode 100644 index 48fb908a1b..0000000000 --- a/apps/wallet-mobile/src/features/Settings/WalletSettings/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './WalletSettingsScreen' diff --git a/apps/wallet-mobile/src/features/Settings/index.ts b/apps/wallet-mobile/src/features/Settings/index.ts deleted file mode 100644 index edf6dd1000..0000000000 --- a/apps/wallet-mobile/src/features/Settings/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './SettingsScreenNavigator' diff --git a/apps/wallet-mobile/src/features/Settings/About/About.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/About.stories.tsx similarity index 60% rename from apps/wallet-mobile/src/features/Settings/About/About.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/About.stories.tsx index 652e144ca9..bb7a67f2a9 100644 --- a/apps/wallet-mobile/src/features/Settings/About/About.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/About.stories.tsx @@ -1,8 +1,8 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {About} from './About' storiesOf('About', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/About/About.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/About.tsx similarity index 93% rename from apps/wallet-mobile/src/features/Settings/About/About.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/About.tsx index 20ba7e5a99..7327863168 100644 --- a/apps/wallet-mobile/src/features/Settings/About/About.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/About.tsx @@ -4,10 +4,10 @@ import React from 'react' import {defineMessages, useIntl} from 'react-intl' import {Pressable, StyleSheet, TextProps, View, ViewProps} from 'react-native' -import {Text} from '../../../components/Text' -import {appInfo} from '../../../kernel/appInfo' -import {commit} from '../../../kernel/env' -import {SettingsRouteNavigation} from '../../../kernel/navigation' +import {Text} from '../../../../../components/Text' +import {appInfo} from '../../../../../kernel/appInfo' +import {commit} from '../../../../../kernel/env' +import {SettingsRouteNavigation} from '../../../../../kernel/navigation' export const About = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/About/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/About/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/About/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.tsx similarity index 92% rename from apps/wallet-mobile/src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.tsx index 7bed584873..5c40a0ee25 100644 --- a/apps/wallet-mobile/src/features/Settings/ApplicationSettings/ApplicationSettingsScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ApplicationSettingsScreen.tsx @@ -5,22 +5,22 @@ import {defineMessages, useIntl} from 'react-intl' import {Platform, ScrollView, StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Icon} from '../../../components/Icon' -import {Spacer} from '../../../components/Spacer/Spacer' -import {isNightly, isProduction} from '../../../kernel/env' -import {useLanguage} from '../../../kernel/i18n' -import {themeNames} from '../../../kernel/i18n/global-messages' -import {defaultLanguage} from '../../../kernel/i18n/languages' -import {useCrashReports} from '../../../yoroi-wallets/hooks' -import {useAuthSetting, useAuthWithOs, useIsAuthOsSupported} from '../../Auth/common/hooks' -import {usePrivacyMode} from '../../Settings/PrivacyMode/PrivacyMode' -import {useSelectedNetwork} from '../../WalletManager/common/hooks/useSelectedNetwork' -import {networkConfigs} from '../../WalletManager/network-manager/network-manager' -import {useNavigateTo} from '../common/navigation' -import {SettingsSwitch} from '../common/SettingsSwitch' -import {useCurrencyPairing} from '../Currency/CurrencyContext' -import {useChangeScreenShareSetting, useScreenShareSettingEnabled} from '../ScreenShare' -import {NavigatedSettingsItem, SettingsItem, SettingsSection} from '../SettingsItems' +import {Icon} from '../../../../components/Icon' +import {Spacer} from '../../../../components/Spacer/Spacer' +import {isNightly, isProduction} from '../../../../kernel/env' +import {useLanguage} from '../../../../kernel/i18n' +import {themeNames} from '../../../../kernel/i18n/global-messages' +import {defaultLanguage} from '../../../../kernel/i18n/languages' +import {useCrashReports} from '../../../../yoroi-wallets/hooks' +import {useAuthSetting, useAuthWithOs, useIsAuthOsSupported} from '../../../Auth/common/hooks' +import {useSelectedNetwork} from '../../../WalletManager/common/hooks/useSelectedNetwork' +import {networkConfigs} from '../../../WalletManager/network-manager/network-manager' +import {useNavigateTo} from '../../common/navigation' +import {SettingsSwitch} from '../../common/SettingsSwitch' +import {NavigatedSettingsItem, SettingsItem, SettingsSection} from '../../SettingsItems' +import {useCurrencyPairing} from './Currency/CurrencyContext' +import {usePrivacyMode} from './PrivacyMode/PrivacyMode' +import {useChangeScreenShareSetting, useScreenShareSettingEnabled} from './ScreenShare' export const ApplicationSettingsScreen = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/ChangeLanguage/ChangeLanguageScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.stories.tsx similarity index 81% rename from apps/wallet-mobile/src/features/Settings/ChangeLanguage/ChangeLanguageScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.stories.tsx index cda007dc2c..3242c37249 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeLanguage/ChangeLanguageScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.stories.tsx @@ -1,7 +1,7 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {SafeAreaInsets} from '../../../../.storybook/decorators' +import {SafeAreaInsets} from '../../../../../../.storybook/decorators' import {ChangeLanguageScreen} from './ChangeLanguageScreen' storiesOf('ChangeLanguageScreen', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/ChangeLanguage/ChangeLanguageScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.tsx similarity index 87% rename from apps/wallet-mobile/src/features/Settings/ChangeLanguage/ChangeLanguageScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.tsx index cee65c07af..3410d05100 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeLanguage/ChangeLanguageScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/ChangeLanguageScreen.tsx @@ -3,7 +3,7 @@ import React from 'react' import {StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {LanguagePicker} from '../../../components/LanguagePicker/LanguagePicker' +import {LanguagePicker} from '../../../../../components/LanguagePicker/LanguagePicker' export const ChangeLanguageScreen = () => { const styles = useStyles() diff --git a/apps/wallet-mobile/src/features/Settings/ChangeLanguage/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ChangeLanguage/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeLanguage/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/ChangeNetworkScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.stories.tsx similarity index 81% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/ChangeNetworkScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.stories.tsx index 3e945b8309..3c1ff775e0 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/ChangeNetworkScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.stories.tsx @@ -1,7 +1,7 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {SafeAreaInsets} from '../../../../.storybook/decorators' +import {SafeAreaInsets} from '../../../../../../.storybook/decorators' import {ChangeNetworkScreen} from './ChangeNetworkScreen' storiesOf('ChangeNetworkScreen', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/ChangeNetworkScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx similarity index 90% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/ChangeNetworkScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx index b6e455d8f9..d9cbdd3a9d 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/ChangeNetworkScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/ChangeNetworkScreen.tsx @@ -5,12 +5,12 @@ import {Platform, StyleSheet, Text, View} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' import {UseMutationOptions, useQuery, UseQueryOptions} from 'react-query' -import {Boundary} from '../../../components/Boundary/Boundary' -import {Button} from '../../../components/Button/Button' -import {useModal} from '../../../components/Modal/ModalContext' -import {Space} from '../../../components/Space/Space' -import {Spacer} from '../../../components/Spacer/Spacer' -import {time} from '../../../kernel/constants' +import {Boundary} from '../../../../../components/Boundary/Boundary' +import {Button} from '../../../../../components/Button/Button' +import {useModal} from '../../../../../components/Modal/ModalContext' +import {Space} from '../../../../../components/Space/Space' +import {Spacer} from '../../../../../components/Spacer/Spacer' +import {time} from '../../../../../kernel/constants' import {NetworkPickerList} from './NetworkPickerList' import {useStrings} from './strings' diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkPickerItem.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkPickerItem.tsx similarity index 95% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkPickerItem.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkPickerItem.tsx index 29aa18aee6..a7aaea24ed 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkPickerItem.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkPickerItem.tsx @@ -3,8 +3,8 @@ import {Chain, Network} from '@yoroi/types' import React from 'react' import {StyleSheet, TouchableOpacity, View} from 'react-native' -import {Icon} from '../../../components/Icon' -import {Text} from '../../../components/Text' +import {Icon} from '../../../../../components/Icon' +import {Text} from '../../../../../components/Text' type Props = { name: Readonly diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkPickerList.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkPickerList.tsx similarity index 75% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkPickerList.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkPickerList.tsx index 420e76cfc8..bd2019a48e 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkPickerList.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkPickerList.tsx @@ -4,13 +4,13 @@ import {freeze} from 'immer' import React from 'react' import {FlatList, StyleSheet} from 'react-native' -import {useMetrics} from '../../../kernel/metrics/metricsManager' -import {availableNetworks} from '../../WalletManager/common/constants' -import {useSelectedNetwork} from '../../WalletManager/common/hooks/useSelectedNetwork' -import {useAutomaticWalletOpener} from '../../WalletManager/context/AutomaticWalletOpeningProvider' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' -import {networkConfigs} from '../../WalletManager/network-manager/network-manager' -import {useNavigateTo} from '../common/navigation' +import {useMetrics} from '../../../../../kernel/metrics/metricsManager' +import {availableNetworks} from '../../../../WalletManager/common/constants' +import {useSelectedNetwork} from '../../../../WalletManager/common/hooks/useSelectedNetwork' +import {useAutomaticWalletOpener} from '../../../../WalletManager/context/AutomaticWalletOpeningProvider' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' +import {networkConfigs} from '../../../../WalletManager/network-manager/network-manager' +import {useNavigateTo} from '../../../common/navigation' import {NetworkPickerItem} from './NetworkPickerItem' export const NetworkPickerList = () => { diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkTag.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag.tsx similarity index 87% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkTag.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag.tsx index ab25f38163..8bca4700af 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/NetworkTag.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag.tsx @@ -3,15 +3,15 @@ import {Chain} from '@yoroi/types' import * as React from 'react' import {StyleSheet, Text, TextStyle, TouchableOpacity, useWindowDimensions, View, ViewStyle} from 'react-native' -import {Button, ButtonType} from '../../../components/Button/Button' -import {useModal} from '../../../components/Modal/ModalContext' -import {Space} from '../../../components/Space/Space' -import {Spacer} from '../../../components/Spacer/Spacer' -import {useMetrics} from '../../../kernel/metrics/metricsManager' -import {useWalletNavigation} from '../../../kernel/navigation' -import {availableNetworks} from '../../WalletManager/common/constants' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' -import {networkConfigs} from '../../WalletManager/network-manager/network-manager' +import {Button, ButtonType} from '../../../../../components/Button/Button' +import {useModal} from '../../../../../components/Modal/ModalContext' +import {Space} from '../../../../../components/Space/Space' +import {Spacer} from '../../../../../components/Spacer/Spacer' +import {useMetrics} from '../../../../../kernel/metrics/metricsManager' +import {useWalletNavigation} from '../../../../../kernel/navigation' +import {availableNetworks} from '../../../../WalletManager/common/constants' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' +import {networkConfigs} from '../../../../WalletManager/network-manager/network-manager' import {useStrings} from './strings' export const NetworkTag = ({ diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/PreparingNetworkScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/PreparingNetworkScreen.tsx similarity index 95% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/PreparingNetworkScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/PreparingNetworkScreen.tsx index c8ce1576dd..b825b4ca32 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/PreparingNetworkScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/PreparingNetworkScreen.tsx @@ -6,7 +6,7 @@ import {StyleSheet, Text} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' import {z} from 'zod' -import {SettingsStackRoutes, useParams} from '../../../kernel/navigation' +import {SettingsStackRoutes, useParams} from '../../../../../kernel/navigation' import {useStrings} from './strings' import {useLaunchRouteAfterSyncing} from './useLaunchRouteAfterSyncing' diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/strings.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/strings.ts similarity index 97% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/strings.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/strings.ts index 4f7df6ca6f..29cbabff9f 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/strings.ts +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/strings.ts @@ -1,6 +1,6 @@ import {defineMessages, useIntl} from 'react-intl' -import globalMessages from '../../../kernel/i18n/global-messages' +import globalMessages from '../../../../../kernel/i18n/global-messages' export const useStrings = () => { const intl = useIntl() diff --git a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/useLaunchRouteAfterSyncing.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/useLaunchRouteAfterSyncing.tsx similarity index 82% rename from apps/wallet-mobile/src/features/Settings/ChangeNetwork/useLaunchRouteAfterSyncing.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/useLaunchRouteAfterSyncing.tsx index 9e1ace44f4..74b3fbb66a 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeNetwork/useLaunchRouteAfterSyncing.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeNetwork/useLaunchRouteAfterSyncing.tsx @@ -1,8 +1,8 @@ import {Chain} from '@yoroi/types' import * as React from 'react' -import {useWalletNavigation} from '../../../kernel/navigation' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' +import {useWalletNavigation} from '../../../../../kernel/navigation' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' export function useLaunchRouteAfterSyncing({selectedNetwork}: {selectedNetwork: Chain.SupportedNetworks}) { const walletNavigation = useWalletNavigation() diff --git a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ChangeThemeScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.stories.tsx similarity index 80% rename from apps/wallet-mobile/src/features/Settings/ChangeTheme/ChangeThemeScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.stories.tsx index 78752e79a1..d5d5979c25 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ChangeThemeScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.stories.tsx @@ -1,7 +1,7 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {SafeAreaInsets} from '../../../../.storybook/decorators' +import {SafeAreaInsets} from '../../../../../../.storybook/decorators' import {ChangeThemeScreen} from './ChangeThemeScreen' storiesOf('ChangeThemeScreen', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ChangeThemeScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.tsx similarity index 90% rename from apps/wallet-mobile/src/features/Settings/ChangeTheme/ChangeThemeScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.tsx index d482b8fcfa..af0d7a3a9f 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ChangeThemeScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ChangeThemeScreen.tsx @@ -3,7 +3,7 @@ import React from 'react' import {StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Boundary} from '../../../components/Boundary/Boundary' +import {Boundary} from '../../../../../components/Boundary/Boundary' import {ThemePickerList} from './ThemePickerList' export const ChangeThemeScreen = () => { diff --git a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ThemePickerItem.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ThemePickerItem.tsx similarity index 90% rename from apps/wallet-mobile/src/features/Settings/ChangeTheme/ThemePickerItem.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ThemePickerItem.tsx index ccd02c9e5e..337e58a73f 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ThemePickerItem.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ThemePickerItem.tsx @@ -3,10 +3,10 @@ import React from 'react' import {useIntl} from 'react-intl' import {StyleSheet, TouchableOpacity, View} from 'react-native' -import {Icon} from '../../../components/Icon' -import {Text} from '../../../components/Text' -import {themeNames} from '../../../kernel/i18n/global-messages' -import {useThemeStorageMaker} from '../../../yoroi-wallets/hooks' +import {Icon} from '../../../../../components/Icon' +import {Text} from '../../../../../components/Text' +import {themeNames} from '../../../../../kernel/i18n/global-messages' +import {useThemeStorageMaker} from '../../../../../yoroi-wallets/hooks' type Props = { title: SupportedThemes diff --git a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ThemePickerList.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ThemePickerList.tsx similarity index 91% rename from apps/wallet-mobile/src/features/Settings/ChangeTheme/ThemePickerList.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ThemePickerList.tsx index 99bf925c17..f510fd7679 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangeTheme/ThemePickerList.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ChangeTheme/ThemePickerList.tsx @@ -2,7 +2,7 @@ import {useTheme} from '@yoroi/theme' import React from 'react' import {FlatList, StyleSheet} from 'react-native' -import {useThemeStorageMaker} from '../../../yoroi-wallets/hooks' +import {useThemeStorageMaker} from '../../../../../yoroi-wallets/hooks' import {ThemePickerItem} from './ThemePickerItem' export const ThemePickerList = () => { diff --git a/apps/wallet-mobile/src/features/Settings/Currency/ChangeCurrencyScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/Currency/ChangeCurrencyScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/Currency/ChangeCurrencyScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.tsx similarity index 90% rename from apps/wallet-mobile/src/features/Settings/Currency/ChangeCurrencyScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.tsx index f975176689..1c2adc9137 100644 --- a/apps/wallet-mobile/src/features/Settings/Currency/ChangeCurrencyScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/ChangeCurrencyScreen.tsx @@ -3,7 +3,7 @@ import React from 'react' import {StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Boundary} from '../../../components/Boundary/Boundary' +import {Boundary} from '../../../../../components/Boundary/Boundary' import {CurrencyPickerList} from './CurrencyPickerList' export const ChangeCurrencyScreen = () => { diff --git a/apps/wallet-mobile/src/features/Settings/Currency/CurrencyContext.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx similarity index 91% rename from apps/wallet-mobile/src/features/Settings/Currency/CurrencyContext.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx index 2f86e763fc..c6f8a481ec 100644 --- a/apps/wallet-mobile/src/features/Settings/Currency/CurrencyContext.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyContext.tsx @@ -2,9 +2,9 @@ import {parseSafe, useAsyncStorage} from '@yoroi/common' import React from 'react' import {useMutation, UseMutationOptions, useQuery, useQueryClient} from 'react-query' -import {configCurrencies, supportedCurrencies} from '../../../kernel/constants' -import {usePrimaryTokenActivity} from '../../../yoroi-wallets/cardano/usePrimaryTokenActivity' -import {ConfigCurrencies, CurrencySymbol} from '../../../yoroi-wallets/types/other' +import {configCurrencies, supportedCurrencies} from '../../../../../kernel/constants' +import {usePrimaryTokenActivity} from '../../../../../yoroi-wallets/cardano/usePrimaryTokenActivity' +import {ConfigCurrencies, CurrencySymbol} from '../../../../../yoroi-wallets/types/other' const CurrencyContext = React.createContext(undefined) export const CurrencyProvider = ({children}: {children: React.ReactNode}) => { diff --git a/apps/wallet-mobile/src/features/Settings/Currency/CurrencyPickerItem.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyPickerItem.tsx similarity index 91% rename from apps/wallet-mobile/src/features/Settings/Currency/CurrencyPickerItem.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyPickerItem.tsx index ce1bcf6366..124187ccf3 100644 --- a/apps/wallet-mobile/src/features/Settings/Currency/CurrencyPickerItem.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyPickerItem.tsx @@ -3,10 +3,10 @@ import React from 'react' import {useIntl} from 'react-intl' import {StyleSheet, TouchableOpacity, View} from 'react-native' -import {Icon} from '../../../components/Icon' -import {Text} from '../../../components/Text' -import {currencyNames} from '../../../kernel/i18n/global-messages' -import {CurrencySymbol} from '../../../yoroi-wallets/types/other' +import {Icon} from '../../../../../components/Icon' +import {Text} from '../../../../../components/Text' +import {currencyNames} from '../../../../../kernel/i18n/global-messages' +import {CurrencySymbol} from '../../../../../yoroi-wallets/types/other' type Props = { nativeName: string diff --git a/apps/wallet-mobile/src/features/Settings/Currency/CurrencyPickerList.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyPickerList.tsx similarity index 92% rename from apps/wallet-mobile/src/features/Settings/Currency/CurrencyPickerList.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyPickerList.tsx index eaa76c9ed4..25be483e59 100644 --- a/apps/wallet-mobile/src/features/Settings/Currency/CurrencyPickerList.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/Currency/CurrencyPickerList.tsx @@ -1,7 +1,7 @@ import React from 'react' import {FlatList, StyleSheet} from 'react-native' -import {CurrencySymbol} from '../../../yoroi-wallets/types/other' +import {CurrencySymbol} from '../../../../../yoroi-wallets/types/other' import {useCurrencyPairing} from './CurrencyContext' import {CurrencyPickerItem} from './CurrencyPickerItem' diff --git a/apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.tsx similarity index 87% rename from apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.tsx index 7030a376ef..0f8e7b06c4 100644 --- a/apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/EnableLoginWithOsScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/EnableLoginWithOsScreen.tsx @@ -2,10 +2,10 @@ import {useNavigation} from '@react-navigation/native' import React from 'react' import {defineMessages, useIntl} from 'react-intl' -import {Button, ButtonType} from '../../../components/Button/Button' -import globalMessages from '../../../kernel/i18n/global-messages' -import {useEnableAuthWithOs} from '../../Auth/common/hooks' -import {OsAuthScreen} from '../../Auth/OsAuthScreen/OsAuthScreen' +import {Button, ButtonType} from '../../../../../components/Button/Button' +import globalMessages from '../../../../../kernel/i18n/global-messages' +import {useEnableAuthWithOs} from '../../../../Auth/common/hooks' +import {OsAuthScreen} from '../../../../Auth/OsAuthScreen/OsAuthScreen' export const EnableLoginWithOsScreen = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/EnableLoginWithOs/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/EnableLoginWithOs/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/PrivacyMode/PrivacyMode.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/PrivacyMode/PrivacyMode.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyMode/PrivacyMode.tsx diff --git a/apps/wallet-mobile/src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.tsx similarity index 85% rename from apps/wallet-mobile/src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.tsx index 2ba3cb65d2..62897c09be 100644 --- a/apps/wallet-mobile/src/features/Settings/PrivacyPolicy/PrivacyPolicyScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/PrivacyPolicyScreen.tsx @@ -3,8 +3,8 @@ import React from 'react' import {ScrollView, StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {useLanguage} from '../../../kernel/i18n' -import {PrivacyPolicy} from '../../Legal/PrivacyPolicy/PrivacyPolicy' +import {useLanguage} from '../../../../../kernel/i18n' +import {PrivacyPolicy} from '../../../../Legal/PrivacyPolicy/PrivacyPolicy' export const PrivacyPolicyScreen = () => { const styles = useStyles() diff --git a/apps/wallet-mobile/src/features/Settings/PrivacyPolicy/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/PrivacyPolicy/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/PrivacyPolicy/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/ScreenShare/ScreenShare.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ScreenShare/ScreenShare.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ScreenShare/ScreenShare.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ScreenShare/ScreenShare.ts diff --git a/apps/wallet-mobile/src/features/Settings/ScreenShare/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ScreenShare/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ScreenShare/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/ScreenShare/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/SystemLogScreen/SystemLogScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.stories.tsx similarity index 64% rename from apps/wallet-mobile/src/features/Settings/SystemLogScreen/SystemLogScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.stories.tsx index de7305e202..359bdb1056 100644 --- a/apps/wallet-mobile/src/features/Settings/SystemLogScreen/SystemLogScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.stories.tsx @@ -1,8 +1,8 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {SystemLogScreen} from './SystemLogScreen' storiesOf('Settings SystemLogScreen', module).add('initial', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/SystemLogScreen/SystemLogScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.tsx similarity index 92% rename from apps/wallet-mobile/src/features/Settings/SystemLogScreen/SystemLogScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.tsx index 35b4c7c63b..4df81dd4c7 100644 --- a/apps/wallet-mobile/src/features/Settings/SystemLogScreen/SystemLogScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/SystemLogScreen/SystemLogScreen.tsx @@ -3,9 +3,9 @@ import {App} from '@yoroi/types' import React from 'react' import {ScrollView, StyleSheet, TextProps, View} from 'react-native' -import {Space} from '../../../components/Space/Space' -import {Text} from '../../../components/Text' -import {logger} from '../../../kernel/logger/logger' +import {Space} from '../../../../../components/Space/Space' +import {Text} from '../../../../../components/Text' +import {logger} from '../../../../../kernel/logger/logger' export const SystemLogScreen = () => { const styles = useStyles() diff --git a/apps/wallet-mobile/src/features/Settings/TermsOfService/TermsOfServiceScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/TermsOfService/TermsOfServiceScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/TermsOfService/TermsOfServiceScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.tsx similarity index 85% rename from apps/wallet-mobile/src/features/Settings/TermsOfService/TermsOfServiceScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.tsx index 9045774937..d065dfaace 100644 --- a/apps/wallet-mobile/src/features/Settings/TermsOfService/TermsOfServiceScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/TermsOfServiceScreen.tsx @@ -3,8 +3,8 @@ import React from 'react' import {ScrollView, StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {useLanguage} from '../../../kernel/i18n' -import {TermsOfService} from '../../Legal/TermsOfService/TermsOfService' +import {useLanguage} from '../../../../../kernel/i18n' +import {TermsOfService} from '../../../../Legal/TermsOfService/TermsOfService' export const TermsOfServiceScreen = () => { const styles = useStyles() diff --git a/apps/wallet-mobile/src/features/Settings/TermsOfService/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/TermsOfService/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeAppSettings/TermsOfService/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/ChangePassword/ChangePasswordScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.stories.tsx similarity index 60% rename from apps/wallet-mobile/src/features/Settings/ChangePassword/ChangePasswordScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.stories.tsx index f49233db00..73a2c60535 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangePassword/ChangePasswordScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.stories.tsx @@ -1,9 +1,9 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {YoroiWallet} from '../../../yoroi-wallets/cardano/types' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {YoroiWallet} from '../../../../../yoroi-wallets/cardano/types' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {ChangePasswordScreen} from './ChangePasswordScreen' const wallet: YoroiWallet = { diff --git a/apps/wallet-mobile/src/features/Settings/ChangePassword/ChangePasswordScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx similarity index 91% rename from apps/wallet-mobile/src/features/Settings/ChangePassword/ChangePasswordScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx index 003c7dd713..0aa8f62bbd 100644 --- a/apps/wallet-mobile/src/features/Settings/ChangePassword/ChangePasswordScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/ChangePasswordScreen.tsx @@ -6,14 +6,14 @@ import {ScrollView, StyleSheet, TextInput as RNTextInput, View, ViewProps} from import {SafeAreaView} from 'react-native-safe-area-context' import {MutationOptions, useMutation} from 'react-query' -import {Button} from '../../../components/Button/Button' -import {KeyboardAvoidingView} from '../../../components/KeyboardAvoidingView/KeyboardAvoidingView' -import {Checkmark, TextInput} from '../../../components/TextInput/TextInput' -import {errorMessages} from '../../../kernel/i18n/global-messages' -import {YoroiWallet} from '../../../yoroi-wallets/cardano/types' -import {REQUIRED_PASSWORD_LENGTH, validatePassword} from '../../../yoroi-wallets/utils/validators' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' +import {Button} from '../../../../../components/Button/Button' +import {KeyboardAvoidingView} from '../../../../../components/KeyboardAvoidingView/KeyboardAvoidingView' +import {Checkmark, TextInput} from '../../../../../components/TextInput/TextInput' +import {errorMessages} from '../../../../../kernel/i18n/global-messages' +import {YoroiWallet} from '../../../../../yoroi-wallets/cardano/types' +import {REQUIRED_PASSWORD_LENGTH, validatePassword} from '../../../../../yoroi-wallets/utils/validators' +import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' export const ChangePasswordScreen = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/ChangePassword/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ChangePassword/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ChangePassword/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/DisableEasyConfirmationScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/DisableEasyConfirmationScreen.tsx similarity index 87% rename from apps/wallet-mobile/src/features/Settings/EasyConfirmation/DisableEasyConfirmationScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/DisableEasyConfirmationScreen.tsx index cc9b3c57cf..de5bf4cbef 100644 --- a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/DisableEasyConfirmationScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/DisableEasyConfirmationScreen.tsx @@ -5,10 +5,10 @@ import {defineMessages, useIntl} from 'react-intl' import {StyleSheet, View} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Button} from '../../../components/Button/Button' -import {Text} from '../../../components/Text' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' +import {Button} from '../../../../../components/Button/Button' +import {Text} from '../../../../../components/Text' +import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' export const DisableEasyConfirmationScreen = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/EasyConfirmationScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EasyConfirmationScreen.stories.tsx similarity index 80% rename from apps/wallet-mobile/src/features/Settings/EasyConfirmation/EasyConfirmationScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EasyConfirmationScreen.stories.tsx index a02891616c..087f164379 100644 --- a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/EasyConfirmationScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EasyConfirmationScreen.stories.tsx @@ -2,12 +2,12 @@ import {storiesOf} from '@storybook/react-native' import {Chain} from '@yoroi/types' import React from 'react' -import {rootStorage} from '../../../kernel/storage/rootStorage' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {buildPortfolioTokenManagers} from '../../Portfolio/common/helpers/build-token-managers' -import {WalletManagerProvider} from '../../WalletManager/context/WalletManagerProvider' -import {buildNetworkManagers} from '../../WalletManager/network-manager/network-manager' -import {WalletManager} from '../../WalletManager/wallet-manager' +import {rootStorage} from '../../../../../kernel/storage/rootStorage' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {buildPortfolioTokenManagers} from '../../../../Portfolio/common/helpers/build-token-managers' +import {WalletManagerProvider} from '../../../../WalletManager/context/WalletManagerProvider' +import {buildNetworkManagers} from '../../../../WalletManager/network-manager/network-manager' +import {WalletManager} from '../../../../WalletManager/wallet-manager' import {DisableEasyConfirmationScreen} from './DisableEasyConfirmationScreen' import {EnableEasyConfirmationScreen} from './EnableEasyConfirmationScreen' diff --git a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/EnableEasyConfirmationScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EnableEasyConfirmationScreen.tsx similarity index 84% rename from apps/wallet-mobile/src/features/Settings/EasyConfirmation/EnableEasyConfirmationScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EnableEasyConfirmationScreen.tsx index 99740f3ff2..0df9376a66 100644 --- a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/EnableEasyConfirmationScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/EnableEasyConfirmationScreen.tsx @@ -6,16 +6,16 @@ import {defineMessages, useIntl} from 'react-intl' import {ScrollView, StyleSheet, View, ViewProps} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Button} from '../../../components/Button/Button' -import {KeyboardAvoidingView} from '../../../components/KeyboardAvoidingView/KeyboardAvoidingView' -import {LoadingOverlay} from '../../../components/LoadingOverlay/LoadingOverlay' -import {Text} from '../../../components/Text' -import {TextInput} from '../../../components/TextInput/TextInput' -import {showErrorDialog} from '../../../kernel/dialogs' -import {errorMessages} from '../../../kernel/i18n/global-messages' -import {isEmptyString} from '../../../kernel/utils' -import {useEnableEasyConfirmation} from '../../Auth/common/useEnableEasyConfirmation' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' +import {Button} from '../../../../../components/Button/Button' +import {KeyboardAvoidingView} from '../../../../../components/KeyboardAvoidingView/KeyboardAvoidingView' +import {LoadingOverlay} from '../../../../../components/LoadingOverlay/LoadingOverlay' +import {Text} from '../../../../../components/Text' +import {TextInput} from '../../../../../components/TextInput/TextInput' +import {showErrorDialog} from '../../../../../kernel/dialogs' +import {errorMessages} from '../../../../../kernel/i18n/global-messages' +import {isEmptyString} from '../../../../../kernel/utils' +import {useEnableEasyConfirmation} from '../../../../Auth/common/useEnableEasyConfirmation' +import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' export const EnableEasyConfirmationScreen = () => { const intl = useIntl() diff --git a/apps/wallet-mobile/src/features/Settings/EasyConfirmation/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/EasyConfirmation/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/EasyConfirmation/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/CollateralInfoModal.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/CollateralInfoModal.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/CollateralInfoModal.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/CollateralInfoModal.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxImage.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxImage.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxImage.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxImage.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx similarity index 79% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx index 669a3d070e..a7b33ed5f0 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/FailedTx/FailedTxScreen.tsx @@ -3,11 +3,11 @@ import {useTheme} from '@yoroi/theme' import React from 'react' import {StyleSheet} from 'react-native' -import {Button} from '../../../../../components/Button/Button' -import {SafeArea} from '../../../../../components/SafeArea' -import {Spacer} from '../../../../../components/Spacer/Spacer' -import {Text} from '../../../../../components/Text' -import {useStrings} from '../../../../Send/common/strings' +import {Button} from '../../../../../../../components/Button/Button' +import {SafeArea} from '../../../../../../../components/SafeArea' +import {Spacer} from '../../../../../../../components/Spacer/Spacer' +import {Text} from '../../../../../../../components/Text' +import {useStrings} from '../../../../../../Send/common/strings' import {FailedTxImage} from './FailedTxImage' export const FailedTxScreen = () => { diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxImage.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxImage.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxImage.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxImage.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.stories.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx similarity index 79% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx index 49077bb6d7..79c6de3550 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ConfirmTx/SubmittedTx/SubmittedTxScreen.tsx @@ -2,12 +2,12 @@ import {useTheme} from '@yoroi/theme' import React from 'react' import {StyleSheet} from 'react-native' -import {Button} from '../../../../../components/Button/Button' -import {SafeArea} from '../../../../../components/SafeArea' -import {Spacer} from '../../../../../components/Spacer/Spacer' -import {Text} from '../../../../../components/Text' -import {useBlockGoBack, useWalletNavigation} from '../../../../../kernel/navigation' -import {useStrings} from '../../../../Send/common/strings' +import {Button} from '../../../../../../../components/Button/Button' +import {SafeArea} from '../../../../../../../components/SafeArea' +import {Spacer} from '../../../../../../../components/Spacer/Spacer' +import {Text} from '../../../../../../../components/Text' +import {useBlockGoBack, useWalletNavigation} from '../../../../../../../kernel/navigation' +import {useStrings} from '../../../../../../Send/common/strings' import {SubmittedTxImage} from './SubmittedTxImage' export const SubmittedTxScreen = () => { diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/InitialCollateralInfoModal.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/InitialCollateralInfoModal.tsx similarity index 90% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/InitialCollateralInfoModal.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/InitialCollateralInfoModal.tsx index 4c98f2a468..ee27819993 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/InitialCollateralInfoModal.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/InitialCollateralInfoModal.tsx @@ -2,8 +2,8 @@ import {useTheme} from '@yoroi/theme' import * as React from 'react' import {StyleSheet, Text, View} from 'react-native' -import {Button} from '../../../components/Button/Button' -import {Space} from '../../../components/Space/Space' +import {Button} from '../../../../../components/Button/Button' +import {Space} from '../../../../../components/Space/Space' import {InfoModalIllustration} from './illustrations/InfoModalIllustration' import {useStrings} from './strings' diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ManageCollateralScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.stories.tsx similarity index 90% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ManageCollateralScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.stories.tsx index cd7a86c129..abf31a11c2 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ManageCollateralScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.stories.tsx @@ -3,9 +3,9 @@ import {TransferProvider} from '@yoroi/transfer' import React from 'react' import {StyleSheet, View} from 'react-native' -import {YoroiWallet} from '../../../yoroi-wallets/cardano/types' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {YoroiWallet} from '../../../../../yoroi-wallets/cardano/types' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {ManageCollateralScreen} from './ManageCollateralScreen' const styles = StyleSheet.create({ diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ManageCollateralScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx similarity index 82% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/ManageCollateralScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx index 4b98258c15..43c60efae2 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/ManageCollateralScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/ManageCollateralScreen.tsx @@ -16,26 +16,26 @@ import { import {SafeAreaView} from 'react-native-safe-area-context' import {useMutation} from 'react-query' -import {Button} from '../../../components/Button/Button' -import {CopyButton} from '../../../components/CopyButton' -import {ErrorPanel} from '../../../components/ErrorPanel/ErrorPanel' -import {Icon} from '../../../components/Icon' -import {Info} from '../../../components/Icon/Info' -import {useModal} from '../../../components/Modal/ModalContext' -import {Space} from '../../../components/Space/Space' -import {Spacer} from '../../../components/Spacer/Spacer' -import {Text} from '../../../components/Text' -import {SettingsStackRoutes, useUnsafeParams, useWalletNavigation} from '../../../kernel/navigation' -import {useCollateralInfo} from '../../../yoroi-wallets/cardano/utxoManager/useCollateralInfo' -import {useSetCollateralId} from '../../../yoroi-wallets/cardano/utxoManager/useSetCollateralId' -import {collateralConfig, utxosMaker} from '../../../yoroi-wallets/cardano/utxoManager/utxos' -import {useBalances} from '../../../yoroi-wallets/hooks' -import {RawUtxo} from '../../../yoroi-wallets/types/other' -import {YoroiEntry, YoroiSignedTx} from '../../../yoroi-wallets/types/yoroi' -import {Amounts, asQuantity, Quantities} from '../../../yoroi-wallets/utils/utils' -import {TokenAmountItem} from '../../Portfolio/common/TokenAmountItem/TokenAmountItem' -import {useReviewTx} from '../../ReviewTx/common/ReviewTxProvider' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' +import {Button} from '../../../../../components/Button/Button' +import {CopyButton} from '../../../../../components/CopyButton' +import {ErrorPanel} from '../../../../../components/ErrorPanel/ErrorPanel' +import {Icon} from '../../../../../components/Icon' +import {Info} from '../../../../../components/Icon/Info' +import {useModal} from '../../../../../components/Modal/ModalContext' +import {Space} from '../../../../../components/Space/Space' +import {Spacer} from '../../../../../components/Spacer/Spacer' +import {Text} from '../../../../../components/Text' +import {SettingsStackRoutes, useUnsafeParams, useWalletNavigation} from '../../../../../kernel/navigation' +import {useCollateralInfo} from '../../../../../yoroi-wallets/cardano/utxoManager/useCollateralInfo' +import {useSetCollateralId} from '../../../../../yoroi-wallets/cardano/utxoManager/useSetCollateralId' +import {collateralConfig, utxosMaker} from '../../../../../yoroi-wallets/cardano/utxoManager/utxos' +import {useBalances} from '../../../../../yoroi-wallets/hooks' +import {RawUtxo} from '../../../../../yoroi-wallets/types/other' +import {YoroiEntry, YoroiSignedTx} from '../../../../../yoroi-wallets/types/yoroi' +import {Amounts, asQuantity, Quantities} from '../../../../../yoroi-wallets/utils/utils' +import {TokenAmountItem} from '../../../../Portfolio/common/TokenAmountItem/TokenAmountItem' +import {useReviewTx} from '../../../../ReviewTx/common/ReviewTxProvider' +import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' import {CollateralInfoModal} from './CollateralInfoModal' import {createCollateralEntry} from './helpers' import {InitialCollateralInfoModal} from './InitialCollateralInfoModal' @@ -263,13 +263,19 @@ const useStyles = () => { backgroundColor: color.bg_color_max, ...atoms.flex_1, ...atoms.px_lg, + ...atoms.flex_1, + ...atoms.px_lg, }, amountItem: { ...atoms.flex_row, ...atoms.justify_between, ...atoms.align_center, + ...atoms.flex_row, + ...atoms.justify_between, + ...atoms.align_center, }, heading: { + ...atoms.flex_1, ...atoms.flex_1, alignSelf: 'center', }, @@ -288,4 +294,5 @@ const useStyles = () => { } return {styles, colors} as const + return {styles, colors} as const } diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/helpers.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/helpers.ts similarity index 65% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/helpers.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/helpers.ts index 12f900b725..1fab6ccead 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/helpers.ts +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/helpers.ts @@ -1,6 +1,6 @@ -import {YoroiWallet} from '../../../yoroi-wallets/cardano/types' -import {collateralConfig} from '../../../yoroi-wallets/cardano/utxoManager/utxos' -import {YoroiEntry} from '../../../yoroi-wallets/types/yoroi' +import {YoroiWallet} from '../../../../../yoroi-wallets/cardano/types' +import {collateralConfig} from '../../../../../yoroi-wallets/cardano/utxoManager/utxos' +import {YoroiEntry} from '../../../../../yoroi-wallets/types/yoroi' const getCollateralAddress = (wallet: YoroiWallet) => { return wallet.externalAddresses[0] diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/illustrations/InfoModalIllustration.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/illustrations/InfoModalIllustration.tsx similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/illustrations/InfoModalIllustration.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/illustrations/InfoModalIllustration.tsx diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/navigation.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/navigation.ts similarity index 85% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/navigation.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/navigation.ts index 025d6151d2..c8fd73b7a7 100644 --- a/apps/wallet-mobile/src/features/Settings/ManageCollateral/navigation.ts +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/navigation.ts @@ -1,7 +1,7 @@ import {useNavigation} from '@react-navigation/native' import {useRef} from 'react' -import {SettingsRouteNavigation} from '../../../kernel/navigation' +import {SettingsRouteNavigation} from '../../../../../kernel/navigation' export const useNavigateTo = () => { const navigation = useNavigation() diff --git a/apps/wallet-mobile/src/features/Settings/ManageCollateral/strings.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/strings.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/ManageCollateral/strings.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/ManageCollateral/strings.ts diff --git a/apps/wallet-mobile/src/features/Settings/RemoveWallet/RemoveWalletScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.stories.tsx similarity index 64% rename from apps/wallet-mobile/src/features/Settings/RemoveWallet/RemoveWalletScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.stories.tsx index 7fafd3a287..b15b3e5cca 100644 --- a/apps/wallet-mobile/src/features/Settings/RemoveWallet/RemoveWalletScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.stories.tsx @@ -1,8 +1,8 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {RemoveWalletScreen} from './RemoveWalletScreen' storiesOf('RemoveWalletScreen', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.tsx similarity index 89% rename from apps/wallet-mobile/src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.tsx index 401298ff96..807c29861c 100644 --- a/apps/wallet-mobile/src/features/Settings/RemoveWallet/RemoveWalletScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/RemoveWalletScreen.tsx @@ -4,15 +4,15 @@ import {defineMessages, useIntl} from 'react-intl' import {InteractionManager, ScrollView, StyleSheet, View, ViewProps} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Button} from '../../../components/Button/Button' -import {Checkbox} from '../../../components/Checkbox/Checkbox' -import {KeyboardAvoidingView} from '../../../components/KeyboardAvoidingView/KeyboardAvoidingView' -import {Spacer} from '../../../components/Spacer/Spacer' -import {Text} from '../../../components/Text' -import {Checkmark, TextInput, TextInputProps} from '../../../components/TextInput/TextInput' -import {useWalletNavigation} from '../../../kernel/navigation' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' +import {Button} from '../../../../../components/Button/Button' +import {Checkbox} from '../../../../../components/Checkbox/Checkbox' +import {KeyboardAvoidingView} from '../../../../../components/KeyboardAvoidingView/KeyboardAvoidingView' +import {Spacer} from '../../../../../components/Spacer/Spacer' +import {Text} from '../../../../../components/Text' +import {Checkmark, TextInput, TextInputProps} from '../../../../../components/TextInput/TextInput' +import {useWalletNavigation} from '../../../../../kernel/navigation' +import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' export const RemoveWalletScreen = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/RemoveWallet/index.ts b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/index.ts similarity index 100% rename from apps/wallet-mobile/src/features/Settings/RemoveWallet/index.ts rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RemoveWallet/index.ts diff --git a/apps/wallet-mobile/src/features/Settings/RenameWalletScreen/RenameWalletScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.stories.tsx similarity index 64% rename from apps/wallet-mobile/src/features/Settings/RenameWalletScreen/RenameWalletScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.stories.tsx index 186f7ff5cc..8fb0211a36 100644 --- a/apps/wallet-mobile/src/features/Settings/RenameWalletScreen/RenameWalletScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.stories.tsx @@ -1,8 +1,8 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {mocks} from '../../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {RenameWalletScreen} from './RenameWalletScreen' storiesOf('RenameWallet', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/RenameWalletScreen/RenameWalletScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.tsx similarity index 82% rename from apps/wallet-mobile/src/features/Settings/RenameWalletScreen/RenameWalletScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.tsx index a0029b57fe..f6e47b2199 100644 --- a/apps/wallet-mobile/src/features/Settings/RenameWalletScreen/RenameWalletScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/RenameWalletScreen/RenameWalletScreen.tsx @@ -5,15 +5,15 @@ import {defineMessages, useIntl} from 'react-intl' import {ScrollView, StyleSheet, View} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Button} from '../../../components/Button/Button' -import {KeyboardAvoidingView} from '../../../components/KeyboardAvoidingView/KeyboardAvoidingView' -import {Spacer} from '../../../components/Spacer/Spacer' -import {TextInput} from '../../../components/TextInput/TextInput' -import globalMessages from '../../../kernel/i18n/global-messages' -import {isEmptyString} from '../../../kernel/utils' -import {getWalletNameError} from '../../../yoroi-wallets/utils/validators' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' -import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider' +import {Button} from '../../../../../components/Button/Button' +import {KeyboardAvoidingView} from '../../../../../components/KeyboardAvoidingView/KeyboardAvoidingView' +import {Spacer} from '../../../../../components/Spacer/Spacer' +import {TextInput} from '../../../../../components/TextInput/TextInput' +import globalMessages from '../../../../../kernel/i18n/global-messages' +import {isEmptyString} from '../../../../../kernel/utils' +import {getWalletNameError} from '../../../../../yoroi-wallets/utils/validators' +import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet' +import {useWalletManager} from '../../../../WalletManager/context/WalletManagerProvider' export const RenameWalletScreen = () => { const strings = useStrings() diff --git a/apps/wallet-mobile/src/features/Settings/WalletSettings/WalletSettingsScreen.stories.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.stories.tsx similarity index 66% rename from apps/wallet-mobile/src/features/Settings/WalletSettings/WalletSettingsScreen.stories.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.stories.tsx index 16fc925be8..c46755c4b6 100644 --- a/apps/wallet-mobile/src/features/Settings/WalletSettings/WalletSettingsScreen.stories.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.stories.tsx @@ -1,8 +1,8 @@ import {storiesOf} from '@storybook/react-native' import React from 'react' -import {mocks} from '../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../yoroi-wallets/mocks/WalletManagerProviderMock' +import {mocks} from '../../../../yoroi-wallets/mocks/wallet' +import {WalletManagerProviderMock} from '../../../../yoroi-wallets/mocks/WalletManagerProviderMock' import {WalletSettingsScreen} from './WalletSettingsScreen' storiesOf('WalletSettingsScreen', module).add('Default', () => ( diff --git a/apps/wallet-mobile/src/features/Settings/WalletSettings/WalletSettingsScreen.tsx b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.tsx similarity index 92% rename from apps/wallet-mobile/src/features/Settings/WalletSettings/WalletSettingsScreen.tsx rename to apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.tsx index 652a3e7429..ac252a3229 100644 --- a/apps/wallet-mobile/src/features/Settings/WalletSettings/WalletSettingsScreen.tsx +++ b/apps/wallet-mobile/src/features/Settings/useCases/changeWalletSettings/WalletSettingsScreen.tsx @@ -7,25 +7,25 @@ import {defineMessages, useIntl} from 'react-intl' import {ScrollView, StyleSheet} from 'react-native' import {SafeAreaView} from 'react-native-safe-area-context' -import {Icon} from '../../../components/Icon' -import {Spacer} from '../../../components/Spacer/Spacer' -import {DIALOG_BUTTONS, showConfirmationDialog} from '../../../kernel/dialogs' -import {confirmationMessages} from '../../../kernel/i18n/global-messages' -import {SettingsRouteNavigation, useWalletNavigation} from '../../../kernel/navigation' -import {useResync} from '../../../yoroi-wallets/hooks' -import {useAuth} from '../../Auth/AuthProvider' -import {useAuthSetting} from '../../Auth/common/hooks' -import {useAddressMode} from '../../WalletManager/common/hooks/useAddressMode' -import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet' -import {useNavigateTo} from '../common/navigation' -import {SettingsSwitch} from '../common/SettingsSwitch' +import {Icon} from '../../../../components/Icon' +import {Spacer} from '../../../../components/Spacer/Spacer' +import {DIALOG_BUTTONS, showConfirmationDialog} from '../../../../kernel/dialogs' +import {confirmationMessages} from '../../../../kernel/i18n/global-messages' +import {SettingsRouteNavigation, useWalletNavigation} from '../../../../kernel/navigation' +import {useResync} from '../../../../yoroi-wallets/hooks' +import {useAuth} from '../../../Auth/AuthProvider' +import {useAuthSetting} from '../../../Auth/common/hooks' +import {useAddressMode} from '../../../WalletManager/common/hooks/useAddressMode' +import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet' +import {useNavigateTo} from '../../common/navigation' +import {SettingsSwitch} from '../../common/SettingsSwitch' import { NavigatedSettingsItem, SettingsBuildItem, SettingsCollateralItem, SettingsItem, SettingsSection, -} from '../SettingsItems' +} from '../../SettingsItems' export const WalletSettingsScreen = () => { const intl = useIntl() diff --git a/apps/wallet-mobile/src/features/SetupWallet/SetupWalletNavigator.tsx b/apps/wallet-mobile/src/features/SetupWallet/SetupWalletNavigator.tsx index a74e50c70e..8fe12c83e6 100644 --- a/apps/wallet-mobile/src/features/SetupWallet/SetupWalletNavigator.tsx +++ b/apps/wallet-mobile/src/features/SetupWallet/SetupWalletNavigator.tsx @@ -4,7 +4,7 @@ import * as React from 'react' import {defineMessages, useIntl} from 'react-intl' import {defaultStackNavigationOptions, WalletInitRoutes} from '../../kernel/navigation' -import {NetworkTag} from '../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {PreparingWalletScreen} from './common/PreparingWalletScreen/PreparingWalletScreen' import {ImportReadOnlyWalletScreen} from './legacy/ImportReadOnlyWallet/ImportReadOnlyWalletScreen' import {SaveReadOnlyWalletScreen} from './legacy/SaveReadOnlyWallet/SaveReadOnlyWalletScreen' diff --git a/apps/wallet-mobile/src/features/Staking/Governance/GovernanceNavigator.tsx b/apps/wallet-mobile/src/features/Staking/Governance/GovernanceNavigator.tsx index f607901544..5df15e523e 100644 --- a/apps/wallet-mobile/src/features/Staking/Governance/GovernanceNavigator.tsx +++ b/apps/wallet-mobile/src/features/Staking/Governance/GovernanceNavigator.tsx @@ -4,7 +4,7 @@ import React from 'react' import {SafeArea} from '../../../components/SafeArea' import {defaultStackNavigationOptions} from '../../../kernel/navigation' -import {NetworkTag} from '../../Settings/ChangeNetwork/NetworkTag' +import {NetworkTag} from '../../Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag' import {useGovernanceManagerMaker} from './common/helpers' import {NavigationStack} from './common/navigation' import {useStrings} from './common/strings' diff --git a/apps/wallet-mobile/src/features/Swap/common/navigation.ts b/apps/wallet-mobile/src/features/Swap/common/navigation.ts index 93d89633e8..813aa4a5b0 100644 --- a/apps/wallet-mobile/src/features/Swap/common/navigation.ts +++ b/apps/wallet-mobile/src/features/Swap/common/navigation.ts @@ -13,7 +13,7 @@ export const useNavigateTo = () => { selectBuyToken: () => swapNavigation.navigate('swap-select-buy-token'), selectSellToken: () => swapNavigation.navigate('swap-select-sell-token'), startSwap: () => swapNavigation.navigate('swap-start-swap', {screen: 'token-swap'}), - confirmTx: () => swapNavigation.navigate('swap-confirm-tx'), + reviewSwap: () => swapNavigation.navigate('swap-review'), submittedTx: (txId: string) => swapNavigation.navigate('swap-submitted-tx', {txId}), failedTx: () => swapNavigation.navigate('swap-failed-tx'), swapOpenOrders: () => diff --git a/apps/wallet-mobile/src/features/Swap/common/strings.ts b/apps/wallet-mobile/src/features/Swap/common/strings.ts index 8be4f262bd..2fc173ebbb 100644 --- a/apps/wallet-mobile/src/features/Swap/common/strings.ts +++ b/apps/wallet-mobile/src/features/Swap/common/strings.ts @@ -7,6 +7,7 @@ export const useStrings = () => { return { swapTitle: intl.formatMessage(messages.swapTitle), + swapDetailsTitle: intl.formatMessage(messages.swapDetailsTitle), tokenSwap: intl.formatMessage(messages.tokenSwap), orderSwap: intl.formatMessage(messages.orderSwap), dex: intl.formatMessage(messages.dex), @@ -56,7 +57,7 @@ export const useStrings = () => { spendingPassword: intl.formatMessage(messages.spendingPassword), sign: intl.formatMessage(messages.sign), searchTokens: intl.formatMessage(messages.searchTokens), - confirm: intl.formatMessage(messages.confirm), + next: intl.formatMessage(messages.next), chooseConnectionMethod: intl.formatMessage(messages.chooseConnectionMethod), selecteAssetTitle: intl.formatMessage(messages.selectAssetTitle), tokens: (qty: number) => intl.formatMessage(globalMessages.tokens, {qty}), @@ -178,6 +179,10 @@ const messages = defineMessages({ id: 'swap.swapScreen.swapTitle', defaultMessage: '!!!Swap', }, + swapDetailsTitle: { + id: 'swap.swapScreen.swapDetailsTitle', + defaultMessage: '!!!Swap details', + }, tokenSwap: { id: 'swap.swapScreen.tokenSwapTab', defaultMessage: '!!!Token swap', @@ -299,7 +304,7 @@ const messages = defineMessages({ }, swapLiqProvFee: { id: 'swap.swapScreen.swapLiqProvFee', - defaultMessage: '!!!Liq. prov. fee', + defaultMessage: '!!!Liquidity provider fee', }, swapLiquidityFeeInfo: { id: 'swap.swapScreen.swapLiquidityFeeInfo', @@ -573,9 +578,9 @@ const messages = defineMessages({ id: 'components.send.selectasset.title', defaultMessage: '!!!Select asset', }, - confirm: { - id: 'components.send.confirmscreen.confirmButton', - defaultMessage: '!!!Confirm', + next: { + id: 'global.next', + defaultMessage: '!!!Next', }, assignCollateral: { id: 'components.send.confirmscreen.assignCollateral', diff --git a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTx.tsx b/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTx.tsx deleted file mode 100644 index 6db51ff690..0000000000 --- a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTx.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react' -import {ErrorBoundary} from 'react-error-boundary' - -import {ModalError} from '../../../../components/ModalError/ModalError' -import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types' -import {YoroiSignedTx, YoroiUnsignedTx} from '../../../../yoroi-wallets/types/yoroi' -import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet' -import {ConfirmTxWithHW} from './ConfirmTxWithHW' -import {ConfirmTxWithPassword} from './ConfirmTxWithPassword' - -type Props = { - wallet: YoroiWallet - unsignedTx: YoroiUnsignedTx - onCancel: () => void - onSuccess: (signedTx: YoroiSignedTx) => void -} - -export const ConfirmTx = ({wallet, onSuccess, onCancel, unsignedTx}: Props) => { - const {meta} = useSelectedWallet() - return meta.isHW ? ( - ( - - )} - > - - - ) : ( - - ) -} diff --git a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.stories.tsx b/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.stories.tsx deleted file mode 100644 index 5236d812dd..0000000000 --- a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.stories.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import {storiesOf} from '@storybook/react-native' -import {mockSwapManager, mockSwapStateDefault, orderMocks, SwapProvider} from '@yoroi/swap' -import React from 'react' - -import {rootStorage} from '../../../../kernel/storage/rootStorage' -import {mocks as walletMocks} from '../../../../yoroi-wallets/mocks/wallet' -import {WalletManagerProviderMock} from '../../../../yoroi-wallets/mocks/WalletManagerProviderMock' -import {buildPortfolioTokenManagers} from '../../../Portfolio/common/helpers/build-token-managers' -import {WalletManagerProvider} from '../../../WalletManager/context/WalletManagerProvider' -import {buildNetworkManagers} from '../../../WalletManager/network-manager/network-manager' -import {WalletManager} from '../../../WalletManager/wallet-manager' -import {mocks} from '../../common/mocks' -import {SwapFormProvider} from '../../common/SwapFormProvider' -import {ConfirmTxScreen} from './ConfirmTxScreen' - -// TODO: should be mocked -const {tokenManagers} = buildPortfolioTokenManagers() -const networkManagers = buildNetworkManagers({tokenManagers}) -const walletManager = new WalletManager({ - rootStorage, - networkManagers, -}) - -storiesOf('Swap ConfirmTxScreen', module) // - .add('swap confirm tx: with password', () => { - return - }) - .add('swap confirm tx: with os', () => { - return - }) - .add('swap confirm tx: with hw', () => { - return - }) - -const ConfirmTxWithPasswordScreen = () => { - return ( - - - - - - - - ) -} -const ConfirmTxWithOSScreen = () => { - return ( - - - - - - - - - - ) -} -const ConfirmTxWithHWScreen = () => { - return ( - - - - - - - - ) -} - -const calculation = orderMocks.mockedOrderCalculations1[0] diff --git a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithHW.tsx b/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithHW.tsx deleted file mode 100644 index a962da3a2c..0000000000 --- a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithHW.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import {useTheme} from '@yoroi/theme' -import {HW} from '@yoroi/types' -import React, {useState} from 'react' -import {ScrollView, StyleSheet, View} from 'react-native' - -import {Text} from '../../../../components/Text' -import {LedgerConnect} from '../../../../legacy/HW' -import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types' -import {useSignWithHwAndSubmitTx} from '../../../../yoroi-wallets/hooks' -import {withBLE, withUSB} from '../../../../yoroi-wallets/hw/hwWallet' -import {YoroiSignedTx, YoroiUnsignedTx} from '../../../../yoroi-wallets/types/yoroi' -import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet' -import {useWalletManager} from '../../../WalletManager/context/WalletManagerProvider' -import {ActivityIndicator} from '../../common/ConfirmRawTx/ActivityIndicator' -import {useStrings} from '../../common/strings' -import {LedgerTransportSwitch} from './LedgerTransportSwitch' - -type Props = { - wallet: YoroiWallet - unsignedTx: YoroiUnsignedTx - onCancel?: () => void - onSuccess: (signedTx: YoroiSignedTx) => void -} - -type TransportType = 'USB' | 'BLE' -type Step = 'select-transport' | 'connect-transport' | 'loading' - -export const ConfirmTxWithHW = ({onSuccess, wallet, unsignedTx}: Props) => { - const styles = useStyles() - const {meta} = useSelectedWallet() - const {walletManager} = useWalletManager() - const [transportType, setTransportType] = React.useState('USB') - const [step, setStep] = useState('select-transport') - const strings = useStrings() - - const {signAndSubmitTx} = useSignWithHwAndSubmitTx( - {wallet}, // - {signTx: {onSuccess}}, - ) - - const onSelectTransport = (transportType: TransportType) => { - setTransportType(transportType) - setStep('connect-transport') - } - - const onConnectBLE = (deviceId: string) => { - setStep('loading') - const hwDeviceInfo = withBLE(meta, deviceId) - walletManager.updateWalletHWDeviceInfo(meta.id, hwDeviceInfo) - signAndSubmitTx({unsignedTx, useUSB: false, hwDeviceInfo}) - } - - const onConnectUSB = (deviceObj: HW.DeviceObj) => { - setStep('loading') - const hwDeviceInfo = withUSB(meta, deviceObj) - walletManager.updateWalletHWDeviceInfo(meta.id, hwDeviceInfo) - signAndSubmitTx({unsignedTx, useUSB: true, hwDeviceInfo}) - } - - if (step === 'select-transport') { - return ( - onSelectTransport('BLE')} - onSelectUSB={() => onSelectTransport('USB')} - /> - ) - } - - if (step === 'connect-transport') { - return ( - - - - ) - } - - return ( - - - - {strings.continueOnLedger} - - ) -} - -const useStyles = () => { - const {color, atoms} = useTheme() - const styles = StyleSheet.create({ - container: { - ...atoms.flex_1, - ...atoms.align_center, - ...atoms.justify_center, - ...atoms.gap_2xl, - ...atoms.px_lg, - }, - text: { - ...atoms.body_1_lg_regular, - ...atoms.text_center, - color: color.text_gray_medium, - }, - }) - - return styles -} diff --git a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithPassword.tsx b/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithPassword.tsx deleted file mode 100644 index 9f587b995f..0000000000 --- a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxWithPassword.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import {App} from '@yoroi/types' -import React from 'react' - -import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types' -import {useSignWithPasswordAndSubmitTx} from '../../../../yoroi-wallets/hooks' -import {YoroiSignedTx, YoroiUnsignedTx} from '../../../../yoroi-wallets/types/yoroi' -import {ConfirmWithSpendingPassword} from '../../common/ConfirmWithSpendingPassword' -import {ErrorData} from '../../common/ConfirmWithSpendingPassword/ConfirmWithSpendingPassword' -import {useStrings} from '../../common/strings' - -type Props = { - wallet: YoroiWallet - unsignedTx: YoroiUnsignedTx - onSuccess: (signedTx: YoroiSignedTx) => void - onCancel?: () => void -} - -export const ConfirmTxWithPassword = ({wallet, onSuccess, unsignedTx}: Props) => { - const [errorData, setErrorData] = React.useState({ - errorMessage: '', - errorLogs: '', - }) - const strings = useStrings() - const signedTxRef = React.useRef(undefined) - - const {signAndSubmitTx, isLoading} = useSignWithPasswordAndSubmitTx( - {wallet}, // - { - submitTx: {onSuccess: () => signedTxRef.current && onSuccess(signedTxRef.current)}, - signTx: { - onSuccess: (signedTx) => { - signedTxRef.current = signedTx - }, - }, - }, - ) - - const showError = ({errorMessage, errorLogs}: ErrorData) => { - setErrorData({ - errorMessage, - errorLogs, - }) - } - - const onConfirm = async (password: string) => { - try { - const rootKey = await wallet.encryptedStorage.xpriv.read(password) - if (rootKey !== undefined) { - signAndSubmitTx({unsignedTx, password}) - } - } catch (err) { - if (err instanceof App.Errors.WrongPassword) { - showError({ - errorMessage: strings.incorrectPasswordTitle, - errorLogs: strings.incorrectPasswordMessage, - }) - } else { - showError({ - errorMessage: strings.generalTxErrorMessage, - errorLogs: err, - }) - } - } - } - - return ( - 0 ? new Error(errorData.errorMessage) : undefined} - onPasswordChange={() => setErrorData({errorMessage: '', errorLogs: ''})} - /> - ) -} diff --git a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.tsx b/apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx similarity index 58% rename from apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.tsx rename to apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx index 7a6d3281a8..2aeda6fe03 100644 --- a/apps/wallet-mobile/src/features/Swap/useCases/ConfirmTxScreen/ConfirmTxScreen.tsx +++ b/apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx @@ -1,5 +1,6 @@ -import {useSwap} from '@yoroi/swap' +import {getPoolUrlByProvider, useSwap} from '@yoroi/swap' import {useTheme} from '@yoroi/theme' +import {capitalize} from 'lodash' import React from 'react' import {InteractionManager, StyleSheet, useWindowDimensions, View, ViewProps} from 'react-native' import {ScrollView} from 'react-native-gesture-handler' @@ -7,32 +8,29 @@ import {SafeAreaView} from 'react-native-safe-area-context' import {Button} from '../../../../components/Button/Button' import {KeyboardAvoidingView} from '../../../../components/KeyboardAvoidingView/KeyboardAvoidingView' -import {LoadingOverlay} from '../../../../components/LoadingOverlay/LoadingOverlay' -import {useModal} from '../../../../components/Modal/ModalContext' -import {Spacer} from '../../../../components/Spacer/Spacer' import {useMetrics} from '../../../../kernel/metrics/metricsManager' -import {useSignAndSubmitTx} from '../../../../yoroi-wallets/hooks' +import {useWalletNavigation} from '../../../../kernel/navigation' import {YoroiSignedTx} from '../../../../yoroi-wallets/types/yoroi' import {asQuantity, Quantities} from '../../../../yoroi-wallets/utils/utils' -import {useAuthOsWithEasyConfirmation} from '../../../Auth/common/hooks' -import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet' +import {useReviewTx} from '../../../ReviewTx/common/ReviewTxProvider' +import {LiquidityPool} from '../../common/LiquidityPool/LiquidityPool' import {useNavigateTo} from '../../common/navigation' +import {PoolIcon} from '../../common/PoolIcon/PoolIcon' import {useStrings} from '../../common/strings' -import {ConfirmTx} from './ConfirmTx' import {TransactionSummary} from './TransactionSummary' const BOTTOM_ACTION_SECTION = 220 -export const ConfirmTxScreen = () => { +export const ReviewSwap = () => { const [contentHeight, setContentHeight] = React.useState(0) const strings = useStrings() const styles = useStyles() - const {wallet, meta} = useSelectedWallet() const navigate = useNavigateTo() const {track} = useMetrics() - const {openModal, closeModal} = useModal() const {height: deviceHeight} = useWindowDimensions() - const signedTxRef = React.useRef(null) + const {navigateToTxReview} = useWalletNavigation() + const {unsignedTxChanged, onSuccessChanged, onErrorChanged, customReceiverTitleChanged, detailsChanged} = + useReviewTx() const {unsignedTx, orderData} = useSwap() const sellTokenInfo = orderData.amounts.sell?.info @@ -45,11 +43,6 @@ export const ConfirmTxScreen = () => { const couldReceiveNoAssets = Quantities.isZero(minReceived) - const {authWithOs, isLoading: authenticating} = useAuthOsWithEasyConfirmation( - {id: wallet.id}, - {onSuccess: (rootKey) => signAndSubmitTx({unsignedTx, rootKey})}, - ) - const trackSwapOrderSubmitted = () => { if (orderData.selectedPoolCalculation === undefined) return track.swapOrderSubmitted({ @@ -72,38 +65,38 @@ export const ConfirmTxScreen = () => { }) } - const {signAndSubmitTx, isLoading: processingTx} = useSignAndSubmitTx( - {wallet}, - { - signTx: { - useErrorBoundary: true, - onSuccess: (signedTx) => { - signedTxRef.current = signedTx - }, - }, - submitTx: { - onSuccess: () => { - trackSwapOrderSubmitted() - navigate.submittedTx(signedTxRef.current?.signedTx.id ?? '') - }, - onError: () => { - navigate.failedTx() - }, - useErrorBoundary: true, - }, - }, - ) + const onSwapTxError = () => { + navigate.failedTx() + } - const onPasswordTxSuccess = (signedTx: YoroiSignedTx) => { + const onSwapTxSuccess = (signedTx: YoroiSignedTx) => { trackSwapOrderSubmitted() - closeModal() InteractionManager.runAfterInteractions(() => { navigate.submittedTx(signedTx.signedTx.id) }) } - const txIsLoading = authenticating || processingTx - const isButtonDisabled = txIsLoading || couldReceiveNoAssets + const onNext = () => { + let liquidityPool: React.ReactNode = null + if (orderData.selectedPoolCalculation) { + const poolIcon = + const poolProviderFormatted = capitalize(orderData.selectedPoolCalculation.pool.provider) + const poolUrl = getPoolUrlByProvider(orderData.selectedPoolCalculation.pool.provider) + + liquidityPool = ( + + ) + } + + if (liquidityPool != null) customReceiverTitleChanged(liquidityPool) + detailsChanged({component: , title: strings.swapDetailsTitle}) + unsignedTxChanged(unsignedTx) + onSuccessChanged(onSwapTxSuccess) + onErrorChanged(onSwapTxError) + navigateToTxReview() + } + + const isButtonDisabled = couldReceiveNoAssets return ( @@ -116,12 +109,10 @@ export const ConfirmTxScreen = () => { setContentHeight(height + BOTTOM_ACTION_SECTION) }} > - + - - { ...(deviceHeight < contentHeight && styles.actionBorder), }} > -