diff --git a/jest.config.js b/jest.config.js index 9aff8d58094..4092db308fe 100644 --- a/jest.config.js +++ b/jest.config.js @@ -44,6 +44,6 @@ module.exports = { '^.+\\.(txt)$': require.resolve('./node_modules/react-native/jest/assetFileTransformer.js'), }, transformIgnorePatterns: [ - 'node_modules/(?!(@celo/)?@?react-native|@react-navigation|@react-native-community|uuid|statsig-js|@react-native-firebase|react-navigation|redux-persist|date-fns|victory-*|@walletconnect/react-native-compat)', + 'node_modules/(?!(@celo/)?@?react-native|@react-navigation|@react-native-community|uuid|statsig-js|@react-native-firebase|react-navigation|redux-persist|date-fns|victory-*|@walletconnect/react-native-compat|react-redux)', ], } diff --git a/package.json b/package.json index a8daa49f113..ef2b63e7002 100644 --- a/package.json +++ b/package.json @@ -189,7 +189,7 @@ "react-native-url-polyfill": "^1.3.0", "react-native-video": "^6.0.0-beta.3", "react-native-webview": "^13.8.1", - "react-redux": "^7.2.9", + "react-redux": "^9.1.0", "redux": "^5.0.1", "redux-persist": "^6.0.0", "redux-persist-fs-storage": "^1.3.0", @@ -223,6 +223,7 @@ "@types/crypto-js": "^4.1.1", "@types/fast-levenshtein": "^0.0.2", "@types/fs-extra": "^9.0.13", + "@types/hoist-non-react-statics": "^3.3.5", "@types/isomorphic-fetch": "^0.0.35", "@types/jest": "^29.5.3", "@types/lodash": "^4.14.136", @@ -232,7 +233,6 @@ "@types/react-native-auth0": "^2.17.5", "@types/react-native-fs": "^2.13.0", "@types/react-native-video": "^5.0.15", - "@types/react-redux": "^7.1.7", "@types/react-test-renderer": "^18.0.0", "@types/redux-mock-store": "^1.0.6", "@types/seedrandom": "^3.0.5", diff --git a/src/RevokePhoneNumber.tsx b/src/RevokePhoneNumber.tsx index 474f24d8bab..e011f97a402 100644 --- a/src/RevokePhoneNumber.tsx +++ b/src/RevokePhoneNumber.tsx @@ -1,7 +1,6 @@ import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { defaultCountryCodeSelector, e164NumberSelector } from 'src/account/selectors' import { SettingsEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -12,6 +11,7 @@ import ToastWithCTA from 'src/components/ToastWithCTA' import AttentionIcon from 'src/icons/Attention' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' +import { useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/account/FiatExchange.tsx b/src/account/FiatExchange.tsx index ce0f62aa2bb..f8976876157 100644 --- a/src/account/FiatExchange.tsx +++ b/src/account/FiatExchange.tsx @@ -13,7 +13,7 @@ import { fiatExchange } from 'src/images/Images' import DrawerTopBar from 'src/navigator/DrawerTopBar' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useTypedSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' @@ -32,7 +32,7 @@ export function FiatExchangeSection({ showDrawerTopNav?: boolean }) { const [timestamp, setTimestamp] = useState(null) - const appState = useTypedSelector((state) => state.app.appState) + const appState = useSelector((state) => state.app.appState) useEffect(() => { if (appState === AppState.Active && timestamp) { diff --git a/src/account/GoldEducation.tsx b/src/account/GoldEducation.tsx index 8ed04210a41..8712566aeb5 100644 --- a/src/account/GoldEducation.tsx +++ b/src/account/GoldEducation.tsx @@ -1,9 +1,8 @@ import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' import { Platform } from 'react-native' -import { useDispatch } from 'react-redux' -import { setGoldEducationCompleted } from 'src/account/actions' import Education, { EducationTopic, EmbeddedNavBar } from 'src/account/Education' +import { setGoldEducationCompleted } from 'src/account/actions' import { celoEducationCompletedSelector } from 'src/account/selectors' import { OnboardingEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -12,7 +11,7 @@ import { celoEducation1, celoEducation2, celoEducation3, celoEducation4 } from ' import { noHeader } from 'src/navigator/Headers' import { navigate, navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' export default function GoldEducation() { const { t } = useTranslation() diff --git a/src/account/Persona.tsx b/src/account/Persona.tsx index 508b1ac23c3..c6a7eb8f581 100644 --- a/src/account/Persona.tsx +++ b/src/account/Persona.tsx @@ -3,7 +3,6 @@ import { useCallback, useState } from 'react' import { useAsync } from 'react-async-hook' import { useTranslation } from 'react-i18next' import { Fields, Inquiry } from 'react-native-persona' -import { useDispatch, useSelector } from 'react-redux' import { KycStatus } from 'src/account/reducer' import { showError } from 'src/alert/actions' import { CICOEvents } from 'src/analytics/Events' @@ -12,6 +11,7 @@ import { ErrorMessages } from 'src/app/ErrorMessages' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' import { getPersonaTemplateId } from 'src/firebase/firebase' import { createPersonaAccount, verifyWalletAddress } from 'src/in-house-liquidity' +import { useDispatch, useSelector } from 'src/redux/hooks' import Logger from 'src/utils/Logger' import networkConfig from 'src/web3/networkConfig' import { walletAddressSelector } from 'src/web3/selectors' diff --git a/src/account/Profile.tsx b/src/account/Profile.tsx index e4816286b80..1b4a2a4a32f 100644 --- a/src/account/Profile.tsx +++ b/src/account/Profile.tsx @@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import * as RNFS from 'react-native-fs' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { saveNameAndPicture } from 'src/account/actions' import { nameSelector, pictureSelector } from 'src/account/selectors' import { showError, showMessage } from 'src/alert/actions' @@ -24,11 +23,12 @@ import { emptyHeader } from 'src/navigator/Headers' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import PictureInput from 'src/onboarding/registration/PictureInput' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' -import { saveProfilePicture } from 'src/utils/image' import Logger from 'src/utils/Logger' +import { saveProfilePicture } from 'src/utils/image' type Props = NativeStackScreenProps diff --git a/src/account/Settings.tsx b/src/account/Settings.tsx index 353022526a7..d6372b0994a 100644 --- a/src/account/Settings.tsx +++ b/src/account/Settings.tsx @@ -12,7 +12,7 @@ import { View, } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' +import RevokePhoneNumber from 'src/RevokePhoneNumber' import { clearStoredAccount, devModeTriggerClicked, @@ -48,6 +48,8 @@ import { import BottomSheet, { BottomSheetRefType } from 'src/components/BottomSheet' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' import Dialog from 'src/components/Dialog' +import { Severity } from 'src/components/InLineNotification' +import InLineNotificationModal from 'src/components/InLineNotificationModal' import SectionHead from 'src/components/SectionHead' import SessionId from 'src/components/SessionId' import { @@ -72,19 +74,17 @@ import { ensurePincode, navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { removeStoredPin, setPincodeWithBiometry } from 'src/pincode/authentication' -import RevokePhoneNumber from 'src/RevokePhoneNumber' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig/index' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' -import { navigateToURI } from 'src/utils/linking' import Logger from 'src/utils/Logger' +import { navigateToURI } from 'src/utils/linking' import { useRevokeCurrentPhoneNumber } from 'src/verify/hooks' import { selectSessions } from 'src/walletConnect/selectors' import { walletAddressSelector } from 'src/web3/selectors' -import InLineNotificationModal from 'src/components/InLineNotificationModal' -import { Severity } from 'src/components/InLineNotification' type Props = NativeStackScreenProps diff --git a/src/account/ShakeForSupport.tsx b/src/account/ShakeForSupport.tsx index cc55f917086..31d58ac9fec 100644 --- a/src/account/ShakeForSupport.tsx +++ b/src/account/ShakeForSupport.tsx @@ -11,7 +11,7 @@ import Touchable from 'src/components/Touchable' import Times from 'src/icons/Times' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useTypedSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' @@ -19,7 +19,7 @@ import Logger from 'src/utils/Logger' export default function ShakeForSupport() { const { t } = useTranslation() - const appState = useTypedSelector(appStateSelector) + const appState = useSelector(appStateSelector) const [isVisible, setIsVisible] = React.useState(false) React.useEffect(() => { diff --git a/src/account/StoreWipeRecoveryScreen.tsx b/src/account/StoreWipeRecoveryScreen.tsx index 44c81aa5a2e..47c6e2abdc0 100644 --- a/src/account/StoreWipeRecoveryScreen.tsx +++ b/src/account/StoreWipeRecoveryScreen.tsx @@ -1,6 +1,5 @@ import React from 'react' import { useTranslation } from 'react-i18next' -import { useDispatch, useSelector } from 'react-redux' import AccountErrorScreen from 'src/account/AccountErrorScreen' import { startStoreWipeRecovery } from 'src/account/actions' import { recoveringFromStoreWipeSelector } from 'src/account/selectors' @@ -8,6 +7,7 @@ import { noHeaderGestureDisabled } from 'src/navigator/Headers' import { navigate } from 'src/navigator/NavigationService' import { firstOnboardingScreen } from 'src/onboarding/steps' import { requestPincodeInput } from 'src/pincode/authentication' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getExperimentParams } from 'src/statsig' import { ExperimentConfigs } from 'src/statsig/constants' import { StatsigExperiments } from 'src/statsig/types' diff --git a/src/account/SupportContact.tsx b/src/account/SupportContact.tsx index b558a4350dd..1e3c048a2e1 100644 --- a/src/account/SupportContact.tsx +++ b/src/account/SupportContact.tsx @@ -4,7 +4,6 @@ import React, { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, Platform, ScrollView, StyleSheet, Text, View } from 'react-native' import DeviceInfo from 'react-native-device-info' -import { useDispatch, useSelector } from 'react-redux' import { e164NumberSelector, nameSelector } from 'src/account/selectors' import { sendSupportRequest } from 'src/account/zendesk' import { showMessage } from 'src/alert/actions' @@ -24,6 +23,7 @@ import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { userLocationDataSelector } from 'src/networkInfo/selectors' import { hooksPreviewApiUrlSelector } from 'src/positions/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import Logger from 'src/utils/Logger' diff --git a/src/alert/AlertBanner.tsx b/src/alert/AlertBanner.tsx index 2492c185df4..c4194982196 100644 --- a/src/alert/AlertBanner.tsx +++ b/src/alert/AlertBanner.tsx @@ -1,12 +1,11 @@ import { noop } from 'lodash' import React, { memo, useMemo, useState } from 'react' import { StyleSheet, View } from 'react-native' -import { useDispatch } from 'react-redux' import { AlertTypes, hideAlert } from 'src/alert/actions' import { Alert, ErrorDisplayType } from 'src/alert/reducer' import SmartTopAlert from 'src/components/SmartTopAlert' import ToastWithCTA from 'src/components/ToastWithCTA' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' function AlertBanner() { const [toastAlert, setToastAlert] = useState<(Alert & { isActive: boolean }) | null>(null) diff --git a/src/app/AppInitGate.tsx b/src/app/AppInitGate.tsx index 45b40772772..b77fb6f00df 100644 --- a/src/app/AppInitGate.tsx +++ b/src/app/AppInitGate.tsx @@ -3,7 +3,6 @@ import React, { useEffect } from 'react' import { useAsync } from 'react-async-hook' import { Dimensions } from 'react-native' import { findBestAvailableLanguage } from 'react-native-localize' -import { useDispatch, useSelector } from 'react-redux' import { AppEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { appMounted, appUnmounted } from 'src/app/actions' @@ -12,6 +11,7 @@ import i18n from 'src/i18n' import { currentLanguageSelector } from 'src/i18n/selectors' import useChangeLanguage from 'src/i18n/useChangeLanguage' import { navigateToError } from 'src/navigator/NavigationService' +import { useDispatch, useSelector } from 'src/redux/hooks' import { waitUntilSagasFinishLoading } from 'src/redux/sagas' import Logger from 'src/utils/Logger' diff --git a/src/app/MultichainBeta.tsx b/src/app/MultichainBeta.tsx index 2bfb6ff47d3..2f76e466cf5 100644 --- a/src/app/MultichainBeta.tsx +++ b/src/app/MultichainBeta.tsx @@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import { ScrollView } from 'react-native-gesture-handler' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { AppEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { MultichainBetaStatus, optMultichainBeta } from 'src/app/actions' @@ -15,6 +14,7 @@ import i18n from 'src/i18n' import { emptyHeader } from 'src/navigator/Headers' import { navigate, navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' +import { useDispatch, useSelector } from 'src/redux/hooks' import { patchUpdateStatsigUser } from 'src/statsig' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' diff --git a/src/app/useDeepLinks.ts b/src/app/useDeepLinks.ts index 0d89910d233..5c8fcb042a5 100644 --- a/src/app/useDeepLinks.ts +++ b/src/app/useDeepLinks.ts @@ -3,12 +3,11 @@ import CleverTap from 'clevertap-react-native' import { useEffect, useState } from 'react' import { useAsync } from 'react-async-hook' import { Linking, Platform } from 'react-native' -import { useDispatch } from 'react-redux' import { deepLinkDeferred, openDeepLink } from 'src/app/actions' import { pendingDeepLinkSelector } from 'src/app/selectors' import { DYNAMIC_LINK_DOMAIN_URI_PREFIX, FIREBASE_ENABLED } from 'src/config' import { hasVisitedHomeSelector } from 'src/home/selectors' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import Logger from 'src/utils/Logger' import { walletAddressSelector } from 'src/web3/selectors' diff --git a/src/backup/BackupComplete.tsx b/src/backup/BackupComplete.tsx index a92de4c6d67..8a6df46cc6f 100644 --- a/src/backup/BackupComplete.tsx +++ b/src/backup/BackupComplete.tsx @@ -10,7 +10,7 @@ import Checkmark from 'src/icons/Checkmark' import { navigate, navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import fontStyles from 'src/styles/fonts' /** diff --git a/src/backup/utils.ts b/src/backup/utils.ts index 5f77a6e797a..dfdea1f17cb 100644 --- a/src/backup/utils.ts +++ b/src/backup/utils.ts @@ -6,12 +6,12 @@ import { import CryptoJS from 'crypto-js' import { useAsync } from 'react-async-hook' import * as bip39 from 'react-native-bip39' -import { useDispatch, useSelector } from 'react-redux' import { showError } from 'src/alert/actions' import { OnboardingEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { ErrorMessages } from 'src/app/ErrorMessages' import { getPassword } from 'src/pincode/authentication' +import { useDispatch, useSelector } from 'src/redux/hooks' import { removeStoredItem, retrieveStoredItem, storeItem } from 'src/storage/keychain' import Logger from 'src/utils/Logger' import { ETHEREUM_DERIVATION_PATH } from 'src/web3/consts' diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index f4e468b12c1..42c77aa2ebf 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -1,13 +1,13 @@ import * as React from 'react' import { WithTranslation } from 'react-i18next' import { StyleSheet, Text, TextStyle, View } from 'react-native' -import { useSelector } from 'react-redux' import { defaultCountryCodeSelector } from 'src/account/selectors' import ContactCircle from 'src/components/ContactCircle' import PhoneNumberWithFlag from 'src/components/PhoneNumberWithFlag' import { formatShortenedAddress } from 'src/components/ShortenedAddress' import { withTranslation } from 'src/i18n' -import { getDisplayName, Recipient } from 'src/recipients/recipient' +import { Recipient, getDisplayName } from 'src/recipients/recipient' +import { useSelector } from 'src/redux/hooks' import fontStyles from 'src/styles/fonts' const DEFAULT_ICON_SIZE = 40 diff --git a/src/components/AvatarSelf.tsx b/src/components/AvatarSelf.tsx index da380b76578..3bd7e7cd29f 100644 --- a/src/components/AvatarSelf.tsx +++ b/src/components/AvatarSelf.tsx @@ -3,7 +3,7 @@ import { TextStyle } from 'react-native' import { e164NumberSelector, nameSelector, userContactDetailsSelector } from 'src/account/selectors' import Avatar from 'src/components/Avatar' import { Recipient, RecipientType } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { currentAccountSelector } from 'src/web3/selectors' interface Props { diff --git a/src/components/ContactCircleSelf.tsx b/src/components/ContactCircleSelf.tsx index 82a80ac51da..47db66d7d06 100644 --- a/src/components/ContactCircleSelf.tsx +++ b/src/components/ContactCircleSelf.tsx @@ -1,9 +1,9 @@ import * as React from 'react' import { ViewStyle } from 'react-native' -import { useSelector } from 'react-redux' import { currentUserRecipientSelector } from 'src/account/selectors' import ContactCircle from 'src/components/ContactCircle' import { Recipient } from 'src/recipients/recipient' +import { useSelector } from 'src/redux/hooks' interface Props { style?: ViewStyle size?: number diff --git a/src/components/InviteOptionsModal.tsx b/src/components/InviteOptionsModal.tsx index f29bb881b8e..80fc69cad1b 100644 --- a/src/components/InviteOptionsModal.tsx +++ b/src/components/InviteOptionsModal.tsx @@ -2,14 +2,14 @@ import getPhoneHash from '@celo/phone-utils/lib/getPhoneHash' import * as React from 'react' import { useTranslation } from 'react-i18next' import { Share } from 'react-native' -import { useSelector } from 'react-redux' import { InviteEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { INVITE_REWARDS_NFTS_LEARN_MORE, INVITE_REWARDS_STABLETOKEN_LEARN_MORE } from 'src/config' import { inviteModal } from 'src/images/Images' -import { useShareUrl } from 'src/invite/hooks' import InviteModal from 'src/invite/InviteModal' -import { getDisplayName, Recipient } from 'src/recipients/recipient' +import { useShareUrl } from 'src/invite/hooks' +import { Recipient, getDisplayName } from 'src/recipients/recipient' +import { useSelector } from 'src/redux/hooks' import { inviteRewardsActiveSelector, inviteRewardsTypeSelector } from 'src/send/selectors' import { InviteRewardsType } from 'src/send/types' diff --git a/src/components/TokenBalance.tsx b/src/components/TokenBalance.tsx index 41b2dbeaca1..fe6c35afa1a 100644 --- a/src/components/TokenBalance.tsx +++ b/src/components/TokenBalance.tsx @@ -13,7 +13,6 @@ import { } from 'react-native' import { getNumberFormatSettings } from 'react-native-localize' import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated' -import { useDispatch, useSelector } from 'react-redux' import { hideAlert, showToast } from 'src/alert/actions' import { AssetsEvents, FiatExchangeEvents, HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -36,6 +35,7 @@ import { import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { totalPositionsBalanceUsdSelector } from 'src/positions/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import Colors from 'src/styles/colors' diff --git a/src/components/TokenDisplay.tsx b/src/components/TokenDisplay.tsx index 7bc55e7d458..36aee7352ca 100644 --- a/src/components/TokenDisplay.tsx +++ b/src/components/TokenDisplay.tsx @@ -3,7 +3,7 @@ import * as React from 'react' import { StyleProp, Text, TextStyle } from 'react-native' import { LocalCurrencyCode, LocalCurrencySymbol } from 'src/localCurrency/consts' import { getLocalCurrencySymbol, usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { useTokenInfo } from 'src/tokens/hooks' import { LocalAmount } from 'src/transactions/types' diff --git a/src/consumerIncentives/ConsumerIncentivesHomeScreen.tsx b/src/consumerIncentives/ConsumerIncentivesHomeScreen.tsx index f5567055e1d..e5b7aa0d672 100644 --- a/src/consumerIncentives/ConsumerIncentivesHomeScreen.tsx +++ b/src/consumerIncentives/ConsumerIncentivesHomeScreen.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { ActivityIndicator, Image, ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { showError } from 'src/alert/actions' import { RewardsEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -36,7 +35,7 @@ import { noHeader } from 'src/navigator/Headers' import { navigate, navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { userLocationDataSelector } from 'src/networkInfo/selectors' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' diff --git a/src/dappkit/DappKitAccountScreen.tsx b/src/dappkit/DappKitAccountScreen.tsx index 06ad5e17c28..271239c87b3 100644 --- a/src/dappkit/DappKitAccountScreen.tsx +++ b/src/dappkit/DappKitAccountScreen.tsx @@ -1,7 +1,6 @@ import { BottomSheetScreenProps } from '@th3rdwave/react-navigation-bottom-sheet' import React from 'react' import { useTranslation } from 'react-i18next' -import { useDispatch, useSelector } from 'react-redux' import { e164NumberSelector } from 'src/account/selectors' import { DappKitEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -11,6 +10,7 @@ import { activeDappSelector } from 'src/dapps/selectors' import { isBottomSheetVisible, navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import { SentryTransactionHub } from 'src/sentry/SentryTransactionHub' import { SentryTransaction } from 'src/sentry/SentryTransactions' import Logger from 'src/utils/Logger' diff --git a/src/dappkit/DappKitSignTxScreen.tsx b/src/dappkit/DappKitSignTxScreen.tsx index c56fec5717c..8c8ba74b3ca 100644 --- a/src/dappkit/DappKitSignTxScreen.tsx +++ b/src/dappkit/DappKitSignTxScreen.tsx @@ -4,7 +4,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import Toast from 'react-native-simple-toast' -import { useDispatch, useSelector } from 'react-redux' import { DappKitEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BottomSheetScrollView from 'src/components/BottomSheetScrollView' @@ -15,6 +14,7 @@ import CopyIcon from 'src/icons/CopyIcon' import { isBottomSheetVisible, navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { vibrateInformative } from 'src/styles/hapticFeedback' diff --git a/src/dapps/DappShortcutTransactionRequest.tsx b/src/dapps/DappShortcutTransactionRequest.tsx index 023f3b062bc..2984b56381f 100644 --- a/src/dapps/DappShortcutTransactionRequest.tsx +++ b/src/dapps/DappShortcutTransactionRequest.tsx @@ -2,7 +2,6 @@ import { BottomSheetScreenProps } from '@th3rdwave/react-navigation-bottom-sheet import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, StyleSheet } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { DappShortcutsEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BottomSheetScrollView from 'src/components/BottomSheetScrollView' @@ -11,6 +10,7 @@ import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { triggeredShortcutsStatusSelector } from 'src/positions/selectors' import { denyExecuteShortcut, executeShortcut } from 'src/positions/slice' +import { useDispatch, useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import { Spacing } from 'src/styles/styles' import Logger from 'src/utils/Logger' diff --git a/src/dapps/DappShortcutsRewards.tsx b/src/dapps/DappShortcutsRewards.tsx index fbfb866e94e..3c10a6ba54f 100644 --- a/src/dapps/DappShortcutsRewards.tsx +++ b/src/dapps/DappShortcutsRewards.tsx @@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next' import { Image, StyleSheet, Text, View } from 'react-native' import Animated from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { DappShortcutsEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes } from 'src/components/Button' @@ -17,11 +16,12 @@ import { } from 'src/positions/selectors' import { triggerShortcut } from 'src/positions/slice' import { ClaimablePosition } from 'src/positions/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' -import { Currency } from 'src/utils/currencies' import Logger from 'src/utils/Logger' +import { Currency } from 'src/utils/currencies' import { walletAddressSelector } from 'src/web3/selectors' function DappShortcutsRewards() { diff --git a/src/dappsExplorer/DAppsExplorerScreenSearchFilter.tsx b/src/dappsExplorer/DAppsExplorerScreenSearchFilter.tsx index f915796dd89..d2db1cb7832 100644 --- a/src/dappsExplorer/DAppsExplorerScreenSearchFilter.tsx +++ b/src/dappsExplorer/DAppsExplorerScreenSearchFilter.tsx @@ -4,7 +4,6 @@ import { RefreshControl, SectionList, SectionListProps, StyleSheet, Text, View } import { ScrollView } from 'react-native-gesture-handler' import Animated from 'react-native-reanimated' import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { DappExplorerEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { BottomSheetRefType } from 'src/components/BottomSheet' @@ -30,6 +29,7 @@ import useOpenDapp from 'src/dappsExplorer/useOpenDapp' import { currentLanguageSelector } from 'src/i18n/selectors' import DrawerTopBar from 'src/navigator/DrawerTopBar' import { styles as headerStyles } from 'src/navigator/Headers' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/dappsExplorer/DappCard.tsx b/src/dappsExplorer/DappCard.tsx index fc721c30955..f8345233893 100644 --- a/src/dappsExplorer/DappCard.tsx +++ b/src/dappsExplorer/DappCard.tsx @@ -1,6 +1,5 @@ import React from 'react' import { Image, StyleSheet, Text, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { DappExplorerEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Card from 'src/components/Card' @@ -10,6 +9,7 @@ import { favoriteDapp, unfavoriteDapp } from 'src/dapps/slice' import { Dapp, DappSection } from 'src/dapps/types' import Star from 'src/icons/Star' import StarOutline from 'src/icons/StarOutline' +import { useDispatch, useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { vibrateSuccess } from 'src/styles/hapticFeedback' diff --git a/src/dappsExplorer/DappFeaturedActions.tsx b/src/dappsExplorer/DappFeaturedActions.tsx index e390e8018c1..9c6bcc1b27e 100644 --- a/src/dappsExplorer/DappFeaturedActions.tsx +++ b/src/dappsExplorer/DappFeaturedActions.tsx @@ -2,7 +2,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native' import { ScrollView } from 'react-native-gesture-handler' -import { useSelector } from 'react-redux' import Touchable from 'src/components/Touchable' import { mostPopularDappsSelector } from 'src/dapps/selectors' import Trophy from 'src/icons/Trophy' @@ -10,6 +9,7 @@ import Wallet from 'src/icons/Wallet' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { positionsWithClaimableRewardsSelector } from 'src/positions/selectors' +import { useSelector } from 'src/redux/hooks' import { getExperimentParams, getFeatureGate } from 'src/statsig' import { ExperimentConfigs } from 'src/statsig/constants' import { StatsigExperiments, StatsigFeatureGates } from 'src/statsig/types' diff --git a/src/dappsExplorer/DappRankingsBottomSheet.tsx b/src/dappsExplorer/DappRankingsBottomSheet.tsx index e9ffaa388d5..5ab73ba7cf4 100644 --- a/src/dappsExplorer/DappRankingsBottomSheet.tsx +++ b/src/dappsExplorer/DappRankingsBottomSheet.tsx @@ -2,12 +2,12 @@ import React, { RefObject } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import Toast from 'react-native-simple-toast' -import { useSelector } from 'react-redux' import BottomSheet, { BottomSheetRefType } from 'src/components/BottomSheet' import Touchable from 'src/components/Touchable' import { mostPopularDappsSelector } from 'src/dapps/selectors' import { ActiveDapp, Dapp, DappSection } from 'src/dapps/types' import { DappCardContent } from 'src/dappsExplorer/DappCard' +import { useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import fontStyles from 'src/styles/fonts' diff --git a/src/dappsExplorer/NoResults.tsx b/src/dappsExplorer/NoResults.tsx index 397d6f344c1..3765c6596cc 100644 --- a/src/dappsExplorer/NoResults.tsx +++ b/src/dappsExplorer/NoResults.tsx @@ -1,12 +1,12 @@ import React from 'react' import { Trans, useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { FilterChip } from 'src/components/FilterChipsCarousel' import Touchable from 'src/components/Touchable' import { DappWithCategoryNames } from 'src/dapps/types' import { currentLanguageSelector } from 'src/i18n/selectors' import InfoIcon from 'src/icons/InfoIcon' +import { useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/dappsExplorer/useOpenDapp.tsx b/src/dappsExplorer/useOpenDapp.tsx index 3478873880c..cbca130f59f 100644 --- a/src/dappsExplorer/useOpenDapp.tsx +++ b/src/dappsExplorer/useOpenDapp.tsx @@ -1,5 +1,4 @@ import { Keyboard } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { DappExplorerEvents } from 'src/analytics/Events' import { AnalyticsPropertiesList } from 'src/analytics/Properties' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -8,6 +7,7 @@ import { recentDappsSelector } from 'src/dapps/selectors' import { dappSelected } from 'src/dapps/slice' import { ActiveDapp } from 'src/dapps/types' import { Screens } from 'src/navigator/Screens' +import { useDispatch, useSelector } from 'src/redux/hooks' type ExtraAnalyticsProperties = Partial diff --git a/src/escrow/EscrowedPaymentListScreen.tsx b/src/escrow/EscrowedPaymentListScreen.tsx index 8e406ce7e9f..a8aa215e4fc 100644 --- a/src/escrow/EscrowedPaymentListScreen.tsx +++ b/src/escrow/EscrowedPaymentListScreen.tsx @@ -8,7 +8,7 @@ import { NotificationList, titleWithBalanceNavigationOptions, } from 'src/notifications/NotificationList' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { Spacing } from 'src/styles/styles' export const listItemRenderer = (payment: EscrowedPayment, key: number | undefined = undefined) => { diff --git a/src/escrow/ReclaimPaymentConfirmationCard.tsx b/src/escrow/ReclaimPaymentConfirmationCard.tsx index 9fdc4d1ce9b..9e198bcf6a1 100644 --- a/src/escrow/ReclaimPaymentConfirmationCard.tsx +++ b/src/escrow/ReclaimPaymentConfirmationCard.tsx @@ -5,13 +5,13 @@ import { StyleSheet, View } from 'react-native' import Avatar from 'src/components/Avatar' import { SecurityFeeIcon } from 'src/components/FeeIcon' import HorizontalLine from 'src/components/HorizontalLine' -import LineItemRow from 'src/components/LineItemRow' import LegacyTokenDisplay from 'src/components/LegacyTokenDisplay' import LegacyTokenTotalLineItem from 'src/components/LegacyTokenTotalLineItem' +import LineItemRow from 'src/components/LineItemRow' import { FeeType } from 'src/fees/reducer' import { feeEstimatesSelector } from 'src/fees/selectors' import { MobileRecipient } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { useTokenInfoByAddress, useUsdToTokenAmount } from 'src/tokens/hooks' import { celoAddressSelector } from 'src/tokens/selectors' import { divideByWei } from 'src/utils/formatting' diff --git a/src/escrow/ReclaimPaymentConfirmationScreen.tsx b/src/escrow/ReclaimPaymentConfirmationScreen.tsx index 6299d57fefc..b063b82131f 100644 --- a/src/escrow/ReclaimPaymentConfirmationScreen.tsx +++ b/src/escrow/ReclaimPaymentConfirmationScreen.tsx @@ -5,7 +5,6 @@ import { useEffect } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, StyleSheet } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { showError } from 'src/alert/actions' import { EscrowEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -20,8 +19,8 @@ import { navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { RecipientType } from 'src/recipients/recipient' +import { useDispatch, useSelector } from 'src/redux/hooks' import { isAppConnected } from 'src/redux/selectors' -import useSelector from 'src/redux/useSelector' import DisconnectBanner from 'src/shared/DisconnectBanner' import colors from 'src/styles/colors' import Logger from 'src/utils/Logger' diff --git a/src/escrow/utils.ts b/src/escrow/utils.ts index 602fb125e8b..04cc84ce4f3 100644 --- a/src/escrow/utils.ts +++ b/src/escrow/utils.ts @@ -1,7 +1,7 @@ import { EscrowedPayment } from 'src/escrow/actions' import { identifierToE164NumberSelector } from 'src/identity/selectors' import { ContactRecipient } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' export const useEscrowPaymentRecipient = (payment: EscrowedPayment): ContactRecipient => { const { recipientPhone, recipientIdentifier } = payment diff --git a/src/exchange/CeloGoldHistoryChart.tsx b/src/exchange/CeloGoldHistoryChart.tsx index 6390112da52..20f5f00f254 100644 --- a/src/exchange/CeloGoldHistoryChart.tsx +++ b/src/exchange/CeloGoldHistoryChart.tsx @@ -18,7 +18,7 @@ import { withTranslation } from 'src/i18n' import { LocalCurrencyCode } from 'src/localCurrency/consts' import { convertDollarsToLocalAmount } from 'src/localCurrency/convert' import { getLocalCurrencyCode, usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import { Spacing } from 'src/styles/styles' import variables from 'src/styles/variables' diff --git a/src/exchange/CeloNewsFeed.tsx b/src/exchange/CeloNewsFeed.tsx index 3847c45da7a..6360e51c64e 100644 --- a/src/exchange/CeloNewsFeed.tsx +++ b/src/exchange/CeloNewsFeed.tsx @@ -11,7 +11,7 @@ import CeloNewsFeedItem from 'src/exchange/CeloNewsFeedItem' import { CeloNewsArticle, CeloNewsArticles } from 'src/exchange/types' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/exchange/ExchangeHomeScreen.tsx b/src/exchange/ExchangeHomeScreen.tsx index f45a25e5181..a5db1e461c2 100644 --- a/src/exchange/ExchangeHomeScreen.tsx +++ b/src/exchange/ExchangeHomeScreen.tsx @@ -18,7 +18,7 @@ import DrawerTopBar from 'src/navigator/DrawerTopBar' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import PriceHistoryChart from 'src/priceHistory/PriceHistoryChart' -import { default as useSelector } from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import DisconnectBanner from 'src/shared/DisconnectBanner' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' diff --git a/src/fees/hooks.ts b/src/fees/hooks.ts index f0869c177b4..f15578704bf 100644 --- a/src/fees/hooks.ts +++ b/src/fees/hooks.ts @@ -1,10 +1,9 @@ import BigNumber from 'bignumber.js' import { useEffect } from 'react' -import { useDispatch } from 'react-redux' import { FeeType, estimateFee } from 'src/fees/reducer' import { fetchFeeCurrency } from 'src/fees/saga' import { feeEstimatesSelector } from 'src/fees/selectors' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { useTokenInfo, useUsdToTokenAmount } from 'src/tokens/hooks' import { celoAddressSelector, tokensByUsdBalanceSelector } from 'src/tokens/selectors' import { ONE_HOUR_IN_MILLIS } from 'src/utils/time' diff --git a/src/fiatExchanges/BidaliScreen.tsx b/src/fiatExchanges/BidaliScreen.tsx index 71641fa3d7b..96a0dc26a4b 100644 --- a/src/fiatExchanges/BidaliScreen.tsx +++ b/src/fiatExchanges/BidaliScreen.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react' import { ActivityIndicator, StyleSheet } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import { WebViewMessageEvent } from 'react-native-webview' -import { useDispatch, useSelector } from 'react-redux' import { createSelector } from 'reselect' import { e164NumberSelector } from 'src/account/selectors' import { openUrl } from 'src/app/actions' @@ -15,6 +14,7 @@ import { navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { TopBarTextButton } from 'src/navigator/TopBarButton' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import { tokensByCurrencySelector } from 'src/tokens/selectors' import { getHigherBalanceCurrency } from 'src/tokens/utils' diff --git a/src/fiatExchanges/CoinbasePaymentSection.tsx b/src/fiatExchanges/CoinbasePaymentSection.tsx index 15af92e79f5..ec7c0e4b790 100644 --- a/src/fiatExchanges/CoinbasePaymentSection.tsx +++ b/src/fiatExchanges/CoinbasePaymentSection.tsx @@ -3,7 +3,6 @@ import React from 'react' import { generateOnRampURL } from '@coinbase/cbpay-js' import { useTranslation } from 'react-i18next' import { Image, StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { CoinbasePayEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Touchable from 'src/components/Touchable' @@ -11,6 +10,7 @@ import { ProviderSelectionAnalyticsData } from 'src/fiatExchanges/types' import { FetchProvidersOutput } from 'src/fiatExchanges/utils' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { useTokenInfo } from 'src/tokens/hooks' diff --git a/src/fiatExchanges/ExchangeQR.tsx b/src/fiatExchanges/ExchangeQR.tsx index 8ce69fdd7f3..8d1663163d4 100644 --- a/src/fiatExchanges/ExchangeQR.tsx +++ b/src/fiatExchanges/ExchangeQR.tsx @@ -1,7 +1,6 @@ import { RouteProp } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' import React, { useLayoutEffect, useRef } from 'react' -import { useDispatch } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BackButton from 'src/components/BackButton' @@ -13,6 +12,7 @@ import { Screens } from 'src/navigator/Screens' import { TopBarIconButton } from 'src/navigator/TopBarButton' import { StackParamList } from 'src/navigator/types' import QRCode from 'src/qrcode/QRCode' +import { useDispatch } from 'src/redux/hooks' import { SVG, shareQRCode } from 'src/send/actions' import { CICOFlow } from './utils' diff --git a/src/fiatExchanges/FiatExchangeAmount.tsx b/src/fiatExchanges/FiatExchangeAmount.tsx index 3525d9ca024..650082b44e1 100644 --- a/src/fiatExchanges/FiatExchangeAmount.tsx +++ b/src/fiatExchanges/FiatExchangeAmount.tsx @@ -7,7 +7,6 @@ import { useTranslation } from 'react-i18next' import { Platform, StyleSheet, Text, TextInput, View } from 'react-native' import { getNumberFormatSettings } from 'react-native-localize' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { showError } from 'src/alert/actions' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -34,6 +33,7 @@ import { HeaderTitleWithTokenBalance, emptyHeader } from 'src/navigator/Headers' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import DisconnectBanner from 'src/shared/DisconnectBanner' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' diff --git a/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx b/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx index 05fbe507b29..d43e91bd4f3 100644 --- a/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx +++ b/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx @@ -2,12 +2,12 @@ import { BottomSheetScreenProps } from '@th3rdwave/react-navigation-bottom-sheet import React, { useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text } from 'react-native' -import { useDispatch } from 'react-redux' import BottomSheetScrollView from 'src/components/BottomSheetScrollView' import { fetchFiatConnectProviders } from 'src/fiatconnect/slice' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch } from 'src/redux/hooks' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' import { TokenBalanceItem } from 'src/tokens/TokenBalanceItem' diff --git a/src/fiatExchanges/PaymentMethodSection.tsx b/src/fiatExchanges/PaymentMethodSection.tsx index 6587e0ee25e..bb328c0b3d0 100644 --- a/src/fiatExchanges/PaymentMethodSection.tsx +++ b/src/fiatExchanges/PaymentMethodSection.tsx @@ -1,20 +1,20 @@ import React, { useEffect, useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { Image, LayoutAnimation, StyleSheet, Text, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Dialog from 'src/components/Dialog' import Expandable from 'src/components/Expandable' import Touchable from 'src/components/Touchable' import { CryptoAmount, FiatAmount } from 'src/fiatExchanges/amount' -import { SettlementEstimation, SettlementTime } from 'src/fiatExchanges/quotes/constants' import NormalizedQuote from 'src/fiatExchanges/quotes/NormalizedQuote' +import { SettlementEstimation, SettlementTime } from 'src/fiatExchanges/quotes/constants' import { getSettlementTimeString } from 'src/fiatExchanges/quotes/utils' import { ProviderSelectionAnalyticsData } from 'src/fiatExchanges/types' import { CICOFlow, PaymentMethod } from 'src/fiatExchanges/utils' import InfoIcon from 'src/icons/InfoIcon' import { getLocalCurrencyCode, usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { useTokenInfo } from 'src/tokens/hooks' diff --git a/src/fiatExchanges/SelectProvider.tsx b/src/fiatExchanges/SelectProvider.tsx index c02713734d1..d04b4e8e1d2 100644 --- a/src/fiatExchanges/SelectProvider.tsx +++ b/src/fiatExchanges/SelectProvider.tsx @@ -5,7 +5,6 @@ import React, { useEffect, useMemo, useState } from 'react' import { useAsync } from 'react-async-hook' import { Trans, useTranslation } from 'react-i18next' import { ActivityIndicator, ScrollView, StyleSheet, Text, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { showError } from 'src/alert/actions' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -48,6 +47,7 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { userLocationDataSelector } from 'src/networkInfo/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/fiatExchanges/SimplexScreen.tsx b/src/fiatExchanges/SimplexScreen.tsx index 4ca2d161ff3..b982c217b03 100644 --- a/src/fiatExchanges/SimplexScreen.tsx +++ b/src/fiatExchanges/SimplexScreen.tsx @@ -3,7 +3,6 @@ import React, { useLayoutEffect, useState } from 'react' import { useAsync } from 'react-async-hook' import { useTranslation } from 'react-i18next' import { ActivityIndicator, StyleSheet, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { e164NumberSelector } from 'src/account/selectors' import { showError } from 'src/alert/actions' import { FiatExchangeEvents } from 'src/analytics/Events' @@ -22,6 +21,7 @@ import { HeaderTitleWithBalance, emptyHeader } from 'src/navigator/Headers' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { userLocationDataSelector } from 'src/networkInfo/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import { useTokenInfo } from 'src/tokens/hooks' import { resolveCurrency } from 'src/utils/currencies' diff --git a/src/fiatconnect/FiatDetailsScreen.tsx b/src/fiatconnect/FiatDetailsScreen.tsx index d3c3e8a8176..ffc52fefe53 100644 --- a/src/fiatconnect/FiatDetailsScreen.tsx +++ b/src/fiatconnect/FiatDetailsScreen.tsx @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next' import { ActivityIndicator, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native' import PickerSelect from 'react-native-picker-select' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BackButton from 'src/components/BackButton' @@ -34,7 +33,7 @@ import { navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { userLocationDataSelector } from 'src/networkInfo/selectors' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' diff --git a/src/fiatconnect/KycLanding.tsx b/src/fiatconnect/KycLanding.tsx index b8c764513d1..017f96d0e7a 100644 --- a/src/fiatconnect/KycLanding.tsx +++ b/src/fiatconnect/KycLanding.tsx @@ -13,24 +13,24 @@ import { TouchableOpacity, View, } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import Persona from 'src/account/Persona' import { KycStatus } from 'src/account/reducer' import { CICOEvents, FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { PRIVACY_LINK } from 'src/brandingConfig' import BackButton from 'src/components/BackButton' -import { getTranslationStrings, LinkAccountSection } from 'src/fiatconnect/LinkAccountScreen' -import { personaInProgressSelector } from 'src/fiatconnect/selectors' -import { personaFinished, personaStarted, postKyc } from 'src/fiatconnect/slice' import FiatConnectQuote from 'src/fiatExchanges/quotes/FiatConnectQuote' import { CICOFlow } from 'src/fiatExchanges/utils' +import { LinkAccountSection, getTranslationStrings } from 'src/fiatconnect/LinkAccountScreen' +import { personaInProgressSelector } from 'src/fiatconnect/selectors' +import { personaFinished, personaStarted, postKyc } from 'src/fiatconnect/slice' import i18n from 'src/i18n' import CheckBox from 'src/icons/CheckBox' import GreyOut from 'src/icons/GreyOut' import { emptyHeader } from 'src/navigator/Headers' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' diff --git a/src/fiatconnect/RefetchQuoteScreen.tsx b/src/fiatconnect/RefetchQuoteScreen.tsx index ca629af2389..d3d808f5811 100644 --- a/src/fiatconnect/RefetchQuoteScreen.tsx +++ b/src/fiatconnect/RefetchQuoteScreen.tsx @@ -1,7 +1,6 @@ import { NativeStackScreenProps } from '@react-navigation/native-stack' import React, { useEffect } from 'react' import { ActivityIndicator, StyleSheet, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { cachedQuoteParamsSelector, fiatConnectQuotesErrorSelector, @@ -10,6 +9,7 @@ import { refetchQuote } from 'src/fiatconnect/slice' import { navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import variables from 'src/styles/variables' import { useTokenInfoWithAddressBySymbol } from 'src/tokens/hooks' diff --git a/src/fiatconnect/ReviewScreen.tsx b/src/fiatconnect/ReviewScreen.tsx index 4a4bdae000d..06036cba263 100644 --- a/src/fiatconnect/ReviewScreen.tsx +++ b/src/fiatconnect/ReviewScreen.tsx @@ -5,7 +5,6 @@ import BigNumber from 'bignumber.js' import React, { useEffect, useLayoutEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, BackHandler, SafeAreaView, StyleSheet, Text, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BackButton from 'src/components/BackButton' @@ -35,6 +34,7 @@ import { emptyHeader } from 'src/navigator/Headers' import { navigate, navigateBack, navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' diff --git a/src/fiatconnect/TransferStatusScreen.tsx b/src/fiatconnect/TransferStatusScreen.tsx index c698abf7722..9399d9ff1a8 100644 --- a/src/fiatconnect/TransferStatusScreen.tsx +++ b/src/fiatconnect/TransferStatusScreen.tsx @@ -2,7 +2,6 @@ import { NativeStackScreenProps } from '@react-navigation/native-stack' import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, SafeAreaView, StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BackButton from 'src/components/BackButton' @@ -23,6 +22,7 @@ import { emptyHeader } from 'src/navigator/Headers' import { navigate, navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useSelector } from 'src/redux/hooks' import appTheme from 'src/styles/appTheme' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' diff --git a/src/fiatconnect/kyc/KycDenied.tsx b/src/fiatconnect/kyc/KycDenied.tsx index 0b3965fd83f..a3f86774d34 100644 --- a/src/fiatconnect/kyc/KycDenied.tsx +++ b/src/fiatconnect/kyc/KycDenied.tsx @@ -4,7 +4,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' @@ -14,6 +13,7 @@ import { kycTryAgain } from 'src/fiatconnect/slice' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' diff --git a/src/fiatconnect/kyc/KycExpired.tsx b/src/fiatconnect/kyc/KycExpired.tsx index d2a81e5ce45..71f91517abd 100644 --- a/src/fiatconnect/kyc/KycExpired.tsx +++ b/src/fiatconnect/kyc/KycExpired.tsx @@ -4,7 +4,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' @@ -14,6 +13,7 @@ import { kycTryAgain } from 'src/fiatconnect/slice' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' diff --git a/src/home/ActionsCarousel.tsx b/src/home/ActionsCarousel.tsx index 4fed223f60c..cab56d78abd 100644 --- a/src/home/ActionsCarousel.tsx +++ b/src/home/ActionsCarousel.tsx @@ -1,7 +1,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text } from 'react-native' -import { useSelector } from 'react-redux' import { HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Card from 'src/components/Card' @@ -16,6 +15,7 @@ import QuickActionsWithdraw from 'src/icons/quick-actions/Withdraw' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { isAppSwapsEnabledSelector } from 'src/navigator/selectors' +import { useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' diff --git a/src/home/CashInBottomSheet.tsx b/src/home/CashInBottomSheet.tsx index 8b0718d896d..05cbbf58487 100644 --- a/src/home/CashInBottomSheet.tsx +++ b/src/home/CashInBottomSheet.tsx @@ -16,7 +16,7 @@ import { getLocalCurrencyCode } from 'src/localCurrency/selectors' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { userLocationDataSelector } from 'src/networkInfo/selectors' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' diff --git a/src/home/DappsCarousel.tsx b/src/home/DappsCarousel.tsx index 10f689fec43..8b054fb5a8d 100644 --- a/src/home/DappsCarousel.tsx +++ b/src/home/DappsCarousel.tsx @@ -10,7 +10,6 @@ import { Text, View, } from 'react-native' -import { useSelector } from 'react-redux' import { DappExplorerEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Card from 'src/components/Card' @@ -24,6 +23,7 @@ import { ActiveDapp, DappSection } from 'src/dapps/types' import ArrowRight from 'src/icons/ArrowRight' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' +import { useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/home/GetStarted.tsx b/src/home/GetStarted.tsx index bd70db4fdb7..8abeb091683 100644 --- a/src/home/GetStarted.tsx +++ b/src/home/GetStarted.tsx @@ -8,7 +8,7 @@ import { FiatExchangeFlow } from 'src/fiatExchanges/utils' import Bird from 'src/icons/Bird' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/home/NotificationBellSpotlight.tsx b/src/home/NotificationBellSpotlight.tsx index 92a2f510461..2f9eec21e0f 100644 --- a/src/home/NotificationBellSpotlight.tsx +++ b/src/home/NotificationBellSpotlight.tsx @@ -3,13 +3,13 @@ import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { notificationSpotlightSeen } from 'src/app/actions' import Button, { BtnSizes } from 'src/components/Button' import { useShowOrHideAnimation } from 'src/components/useShowOrHideAnimation' import NotificationBell from 'src/home/NotificationBell' +import { useDispatch } from 'src/redux/hooks' import Colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/home/NotificationBox.tsx b/src/home/NotificationBox.tsx index 0f8d7564145..6d774781776 100644 --- a/src/home/NotificationBox.tsx +++ b/src/home/NotificationBox.tsx @@ -2,7 +2,6 @@ import * as React from 'react' import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { NativeScrollEvent, ScrollView, StyleSheet, View } from 'react-native' -import { useDispatch } from 'react-redux' import { dismissGetVerified, dismissGoldEducation, @@ -11,8 +10,8 @@ import { } from 'src/account/actions' import { celoEducationCompletedSelector } from 'src/account/selectors' import { HomeEvents, RewardsEvents } from 'src/analytics/Events' -import { ScrollDirection } from 'src/analytics/types' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' +import { ScrollDirection } from 'src/analytics/types' import { openUrl } from 'src/app/actions' import { numberVerifiedDecentrallySelector, @@ -36,12 +35,12 @@ import GuideKeyIcon from 'src/icons/GuideKeyHomeCardIcon' import { boostRewards, getVerified, learnCelo, lightningPhone } from 'src/images/Images' import { ensurePincode, navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import variables from 'src/styles/variables' -import { getContentForCurrentLang } from 'src/utils/contentTranslations' import Logger from 'src/utils/Logger' +import { getContentForCurrentLang } from 'src/utils/contentTranslations' const TAG = 'NotificationBox' // Priority of static notifications diff --git a/src/home/NotificationCenter.tsx b/src/home/NotificationCenter.tsx index 0330ffd45cc..882872005c0 100644 --- a/src/home/NotificationCenter.tsx +++ b/src/home/NotificationCenter.tsx @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next' import { LayoutChangeEvent, StyleSheet, Text, View, ViewToken } from 'react-native' import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { openUrl } from 'src/app/actions' @@ -20,7 +19,7 @@ import ThumbsUpIllustration from 'src/icons/ThumbsUpIllustration' import { Screens } from 'src/navigator/Screens' import useScrollAwareHeader from 'src/navigator/ScrollAwareHeader' import { StackParamList } from 'src/navigator/types' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/home/SendBar.tsx b/src/home/SendBar.tsx index c2ee7c9233d..a32df603c2f 100644 --- a/src/home/SendBar.tsx +++ b/src/home/SendBar.tsx @@ -6,7 +6,7 @@ import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes } from 'src/components/Button' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { canSendTokensSelector } from 'src/send/selectors' import colors from 'src/styles/colors' import variables from 'src/styles/variables' diff --git a/src/home/WalletHome.tsx b/src/home/WalletHome.tsx index 642ad13640d..ef68e7688e8 100644 --- a/src/home/WalletHome.tsx +++ b/src/home/WalletHome.tsx @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next' import { RefreshControl, RefreshControlProps, SectionList, StyleSheet, View } from 'react-native' import Animated from 'react-native-reanimated' import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { showMessage } from 'src/alert/actions' import { AppState } from 'src/app/actions' import { @@ -36,7 +35,7 @@ import { showNftCelebrationSelector } from 'src/home/selectors' import { importContacts } from 'src/identity/actions' import DrawerTopBar from 'src/navigator/DrawerTopBar' import { phoneRecipientCacheSelector } from 'src/recipients/reducer' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { initializeSentryUserContext } from 'src/sentry/actions' import { getExperimentParams, getFeatureGate } from 'src/statsig' import { ExperimentConfigs } from 'src/statsig/constants' diff --git a/src/home/celebration/NftCelebration.tsx b/src/home/celebration/NftCelebration.tsx index 18f498fdbc8..6acad8c9068 100644 --- a/src/home/celebration/NftCelebration.tsx +++ b/src/home/celebration/NftCelebration.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { BottomSheetRefType } from 'src/components/BottomSheet' @@ -16,6 +15,7 @@ import ImageErrorIcon from 'src/icons/ImageErrorIcon' import NftMedia from 'src/nfts/NftMedia' import { nftsWithMetadataSelector } from 'src/nfts/selectors' import { NftOrigin } from 'src/nfts/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { vibrateSuccess } from 'src/styles/hapticFeedback' diff --git a/src/home/useBalanceAutoRefresh.ts b/src/home/useBalanceAutoRefresh.ts index 61b4bd40a2e..b2fcc57a953 100644 --- a/src/home/useBalanceAutoRefresh.ts +++ b/src/home/useBalanceAutoRefresh.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { useDispatch } from 'react-redux' import { startBalanceAutorefresh, stopBalanceAutorefresh } from 'src/home/actions' +import { useDispatch } from 'src/redux/hooks' export default function useBalanceAutoRefresh() { const dispatch = useDispatch() diff --git a/src/i18n/useChangeLanguage.ts b/src/i18n/useChangeLanguage.ts index da2f7fe0d9b..c6f0ad08381 100644 --- a/src/i18n/useChangeLanguage.ts +++ b/src/i18n/useChangeLanguage.ts @@ -1,6 +1,6 @@ -import { useDispatch } from 'react-redux' import i18n from 'src/i18n' import { setLanguage } from 'src/i18n/slice' +import { useDispatch } from 'src/redux/hooks' import Logger from 'src/utils/Logger' const TAG = 'i18n/actions' diff --git a/src/import/ImportWallet.tsx b/src/import/ImportWallet.tsx index 67ee54f22ff..26eb0d0bbc3 100644 --- a/src/import/ImportWallet.tsx +++ b/src/import/ImportWallet.tsx @@ -6,7 +6,6 @@ import React, { useEffect, useLayoutEffect, useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { Keyboard, StyleSheet, Text, View } from 'react-native' import { SafeAreaInsetsContext } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { cancelCreateOrRestoreAccount } from 'src/account/actions' import { accountToRecoverSelector, recoveringFromStoreWipeSelector } from 'src/account/selectors' import { hideAlert } from 'src/alert/actions' @@ -30,8 +29,8 @@ import { navigate, navigateClearingStack } from 'src/navigator/NavigationService import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import TopBarTextButtonOnboarding from 'src/onboarding/TopBarTextButtonOnboarding' +import { useDispatch, useSelector } from 'src/redux/hooks' import { isAppConnected } from 'src/redux/selectors' -import useTypedSelector from 'src/redux/useSelector' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' @@ -50,10 +49,10 @@ function ImportWallet({ navigation, route }: Props) { const [backupPhrase, setBackupPhrase] = useState('') const [keyboardVisible, setKeyboardVisible] = useState(false) - const isImportingWallet = useTypedSelector((state) => state.imports.isImportingWallet) + const isImportingWallet = useSelector((state) => state.imports.isImportingWallet) const appConnected = useSelector(isAppConnected) - const isRecoveringFromStoreWipe = useTypedSelector(recoveringFromStoreWipeSelector) - const accountToRecoverFromStoreWipe = useTypedSelector(accountToRecoverSelector) + const isRecoveringFromStoreWipe = useSelector(recoveringFromStoreWipeSelector) + const accountToRecoverFromStoreWipe = useSelector(accountToRecoverSelector) const dispatch = useDispatch() const { t } = useTranslation() diff --git a/src/invite/Invite.tsx b/src/invite/Invite.tsx index c90be5ae9e9..e112347f84e 100644 --- a/src/invite/Invite.tsx +++ b/src/invite/Invite.tsx @@ -2,17 +2,17 @@ import { isNil } from 'lodash' import React from 'react' import { useTranslation } from 'react-i18next' import { Share } from 'react-native' -import { useSelector } from 'react-redux' import { InviteEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { INVITE_REWARDS_NFTS_LEARN_MORE, INVITE_REWARDS_STABLETOKEN_LEARN_MORE } from 'src/config' import { inviteModal, inviteWithRewards } from 'src/images/Images' import { noHeader } from 'src/navigator/Headers' import { navigateBack } from 'src/navigator/NavigationService' +import { useSelector } from 'src/redux/hooks' import { inviteRewardsActiveSelector, inviteRewardsTypeSelector } from 'src/send/selectors' import { InviteRewardsType } from 'src/send/types' -import { useShareUrl } from './hooks' import InviteModal from './InviteModal' +import { useShareUrl } from './hooks' export default function Invite() { const { t } = useTranslation() diff --git a/src/invite/hooks.tsx b/src/invite/hooks.tsx index 5b4ed6d7c7c..2a3bf47d83b 100644 --- a/src/invite/hooks.tsx +++ b/src/invite/hooks.tsx @@ -2,9 +2,9 @@ import { isNil } from 'lodash' import { useState } from 'react' import { useAsync } from 'react-async-hook' import { useTranslation } from 'react-i18next' -import { useDispatch, useSelector } from 'react-redux' import { showError } from 'src/alert/actions' import { FIREBASE_ENABLED } from 'src/config' +import { useDispatch, useSelector } from 'src/redux/hooks' import Logger from 'src/utils/Logger' import { walletAddressSelector } from 'src/web3/selectors' import { createInviteLink } from '../firebase/dynamicLinks' diff --git a/src/jumpstart/JumpstartEnterAmount.tsx b/src/jumpstart/JumpstartEnterAmount.tsx index a51498dee4a..e9f51ee956a 100644 --- a/src/jumpstart/JumpstartEnterAmount.tsx +++ b/src/jumpstart/JumpstartEnterAmount.tsx @@ -9,7 +9,7 @@ import { createJumpstartLink } from 'src/firebase/dynamicLinks' import { usePrepareJumpstartTransactions } from 'src/jumpstart/usePrepareJumpstartTransactions' import { convertDollarsToLocalAmount } from 'src/localCurrency/convert' import { getLocalCurrencyCode, usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import EnterAmount from 'src/send/EnterAmount' import { getDynamicConfigParams } from 'src/statsig' import { DynamicConfigs } from 'src/statsig/constants' diff --git a/src/jumpstart/SelectJumpstartRecipientButton.tsx b/src/jumpstart/SelectJumpstartRecipientButton.tsx index 45edac0b5cd..c886a5fcda2 100644 --- a/src/jumpstart/SelectJumpstartRecipientButton.tsx +++ b/src/jumpstart/SelectJumpstartRecipientButton.tsx @@ -8,7 +8,7 @@ import CircledIcon from 'src/icons/CircledIcon' import MagicWand from 'src/icons/MagicWand' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' diff --git a/src/keylessBackup/KeylessBackupPhoneInput.tsx b/src/keylessBackup/KeylessBackupPhoneInput.tsx index 992cefb1441..142cb194660 100644 --- a/src/keylessBackup/KeylessBackupPhoneInput.tsx +++ b/src/keylessBackup/KeylessBackupPhoneInput.tsx @@ -4,7 +4,6 @@ import React, { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native' import * as RNLocalize from 'react-native-localize' -import { useSelector } from 'react-redux' import { defaultCountryCodeSelector, e164NumberSelector } from 'src/account/selectors' import { getPhoneNumberDetails } from 'src/account/utils' import { KeylessBackupEvents } from 'src/analytics/Events' @@ -18,6 +17,7 @@ import { emptyHeader } from 'src/navigator/Headers' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/keylessBackup/KeylessBackupProgress.tsx b/src/keylessBackup/KeylessBackupProgress.tsx index b1cb131d73c..19d3e8bd993 100644 --- a/src/keylessBackup/KeylessBackupProgress.tsx +++ b/src/keylessBackup/KeylessBackupProgress.tsx @@ -4,7 +4,6 @@ import React, { useEffect, useLayoutEffect } from 'react' import { Trans, useTranslation } from 'react-i18next' import { BackHandler, ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { KeylessBackupEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' @@ -24,6 +23,7 @@ import { TopBarTextButton } from 'src/navigator/TopBarButton' import { StackParamList } from 'src/navigator/types' import { goToNextOnboardingScreen, onboardingPropsSelector } from 'src/onboarding/steps' import { totalPositionsBalanceUsdSelector } from 'src/positions/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/keylessBackup/SignInWithEmail.tsx b/src/keylessBackup/SignInWithEmail.tsx index 16847b2aabc..210a70b0798 100644 --- a/src/keylessBackup/SignInWithEmail.tsx +++ b/src/keylessBackup/SignInWithEmail.tsx @@ -3,7 +3,6 @@ import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import { SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native' import { useAuth0 } from 'react-native-auth0' -import { useDispatch } from 'react-redux' import { KeylessBackupEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' @@ -15,6 +14,7 @@ import { emptyHeader } from 'src/navigator/Headers' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' +import { useDispatch } from 'src/redux/hooks' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/keylessBackup/hooks.ts b/src/keylessBackup/hooks.ts index d5d72aa9c35..ec45266af97 100644 --- a/src/keylessBackup/hooks.ts +++ b/src/keylessBackup/hooks.ts @@ -2,13 +2,13 @@ import { useRef, useState } from 'react' import { useAsync } from 'react-async-hook' import { Platform } from 'react-native' import DeviceInfo from 'react-native-device-info' -import { useDispatch } from 'react-redux' import { showError } from 'src/alert/actions' import { KeylessBackupEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { ErrorMessages } from 'src/app/ErrorMessages' import { valoraKeyshareIssued } from 'src/keylessBackup/slice' import { KeylessBackupFlow } from 'src/keylessBackup/types' +import { useDispatch } from 'src/redux/hooks' import Logger from 'src/utils/Logger' import { PhoneNumberVerificationStatus } from 'src/verify/hooks' import networkConfig from 'src/web3/networkConfig' diff --git a/src/localCurrency/SelectLocalCurrency.tsx b/src/localCurrency/SelectLocalCurrency.tsx index c235f53ce86..b7a95d6d974 100644 --- a/src/localCurrency/SelectLocalCurrency.tsx +++ b/src/localCurrency/SelectLocalCurrency.tsx @@ -2,14 +2,14 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { FlatList, ListRenderItemInfo, ScrollView, StyleSheet, Text } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import SelectionOption from 'src/components/SelectionOption' import i18n from 'src/i18n' import { selectPreferredCurrency } from 'src/localCurrency/actions' -import { LocalCurrencyCode, LOCAL_CURRENCY_CODES } from 'src/localCurrency/consts' +import { LOCAL_CURRENCY_CODES, LocalCurrencyCode } from 'src/localCurrency/consts' import { useLocalCurrencyCode } from 'src/localCurrency/hooks' import { headerWithBackButton } from 'src/navigator/Headers' import { navigateBack } from 'src/navigator/NavigationService' +import { useDispatch } from 'src/redux/hooks' import fontStyles from 'src/styles/fonts' const DEFAULT_CURRENCY_CODE = LocalCurrencyCode.USD diff --git a/src/localCurrency/hooks.ts b/src/localCurrency/hooks.ts index 31c91586d11..5ffa86ceea7 100644 --- a/src/localCurrency/hooks.ts +++ b/src/localCurrency/hooks.ts @@ -3,7 +3,7 @@ import { LocalCurrencyCode } from 'src/localCurrency/consts' import { convertDollarsToLocalAmount } from 'src/localCurrency/convert' import { getLocalCurrencyCode, usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' import { CurrencyInfo } from 'src/localCurrency/types' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { useTokenInfoWithAddressBySymbol } from 'src/tokens/hooks' import { convertTokenToLocalAmount } from 'src/tokens/utils' import { Currency } from 'src/utils/currencies' diff --git a/src/navigator/DrawerNavigator.tsx b/src/navigator/DrawerNavigator.tsx index ee6b7f6c632..2829c28608c 100644 --- a/src/navigator/DrawerNavigator.tsx +++ b/src/navigator/DrawerNavigator.tsx @@ -58,7 +58,7 @@ import RewardsPill from 'src/navigator/RewardsPill' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import NftGallery from 'src/nfts/NftGallery' -import { default as useSelector } from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' @@ -314,7 +314,6 @@ export default function DrawerNavigator({ route }: Props) { {showRecoveryPhrase && ( ( diff --git a/src/navigator/Navigator.tsx b/src/navigator/Navigator.tsx index 6c7de14c657..de0668dafc4 100644 --- a/src/navigator/Navigator.tsx +++ b/src/navigator/Navigator.tsx @@ -627,7 +627,6 @@ const modalAnimatedScreens = (Navigator: typeof Stack) => ( /> diff --git a/src/navigator/NavigatorWrapper.tsx b/src/navigator/NavigatorWrapper.tsx index 2959b59b363..3802e477aae 100644 --- a/src/navigator/NavigatorWrapper.tsx +++ b/src/navigator/NavigatorWrapper.tsx @@ -6,13 +6,12 @@ import { SeverityLevel } from '@sentry/types' import * as React from 'react' import { StyleSheet, View } from 'react-native' import DeviceInfo from 'react-native-device-info' -import { useDispatch } from 'react-redux' import ShakeForSupport from 'src/account/ShakeForSupport' import AlertBanner from 'src/alert/AlertBanner' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' +import UpgradeScreen from 'src/app/UpgradeScreen' import { activeScreenChanged } from 'src/app/actions' import { getAppLocked } from 'src/app/selectors' -import UpgradeScreen from 'src/app/UpgradeScreen' import { useDeepLinks } from 'src/app/useDeepLinks' import { DEV_RESTORE_NAV_STATE_ON_RELOAD } from 'src/config' import { @@ -24,11 +23,11 @@ import Navigator from 'src/navigator/Navigator' import { Screens } from 'src/navigator/Screens' import PincodeLock from 'src/pincode/PincodeLock' import HooksPreviewModeBanner from 'src/positions/HooksPreviewModeBanner' -import useTypedSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { sentryRoutingInstrumentation } from 'src/sentry/Sentry' import appTheme from 'src/styles/appTheme' -import { userInSanctionedCountrySelector } from 'src/utils/countryFeatures' import Logger from 'src/utils/Logger' +import { userInSanctionedCountrySelector } from 'src/utils/countryFeatures' import { isVersionBelowMinimum } from 'src/utils/versionCheck' // This uses RN Navigation's experimental nav state persistence @@ -53,10 +52,10 @@ const RESTORE_STATE = __DEV__ && DEV_RESTORE_NAV_STATE_ON_RELOAD export const NavigatorWrapper = () => { const [isReady, setIsReady] = React.useState(RESTORE_STATE ? false : true) const [initialState, setInitialState] = React.useState() - const appLocked = useTypedSelector(getAppLocked) - const minRequiredVersion = useTypedSelector((state) => state.app.minVersion) + const appLocked = useSelector(getAppLocked) + const minRequiredVersion = useSelector((state) => state.app.minVersion) const routeNameRef = React.useRef() - const inSanctionedCountry = useTypedSelector(userInSanctionedCountrySelector) + const inSanctionedCountry = useSelector(userInSanctionedCountrySelector) const dispatch = useDispatch() diff --git a/src/navigator/QRNavigator.tsx b/src/navigator/QRNavigator.tsx index 90c42d81f03..8088e9f4428 100644 --- a/src/navigator/QRNavigator.tsx +++ b/src/navigator/QRNavigator.tsx @@ -11,7 +11,6 @@ import { Dimensions, Platform, StatusBar, StyleSheet } from 'react-native' import { PERMISSIONS, RESULTS, check } from 'react-native-permissions' import Animated, { call, greaterThan, onChange } from 'react-native-reanimated' import { ScrollPager } from 'react-native-tab-view' -import { useDispatch } from 'react-redux' import { QrScreenEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { noHeader } from 'src/navigator/Headers' @@ -20,6 +19,7 @@ import { QRTabParamList, StackParamList } from 'src/navigator/types' import QRCode from 'src/qrcode/QRCode' import QRScanner from 'src/qrcode/QRScanner' import QRTabBar from 'src/qrcode/QRTabBar' +import { useDispatch } from 'src/redux/hooks' import { SVG, handleQRCodeDetected } from 'src/send/actions' import { QrCode } from 'src/send/types' import Logger from 'src/utils/Logger' diff --git a/src/navigator/RewardsPill.tsx b/src/navigator/RewardsPill.tsx index 08076c6b5a0..7d61c2ca67e 100644 --- a/src/navigator/RewardsPill.tsx +++ b/src/navigator/RewardsPill.tsx @@ -10,7 +10,7 @@ import { superchargeInfoSelector } from 'src/consumerIncentives/selectors' import Rings from 'src/icons/Rings' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' diff --git a/src/nfts/NftGallery.tsx b/src/nfts/NftGallery.tsx index 98491bf4048..1c8867f42ad 100644 --- a/src/nfts/NftGallery.tsx +++ b/src/nfts/NftGallery.tsx @@ -2,7 +2,6 @@ import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' import { FlatList, RefreshControl, StyleSheet, Text, View } from 'react-native' import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { NftEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Touchable from 'src/components/Touchable' @@ -20,6 +19,7 @@ import { } from 'src/nfts/selectors' import { fetchNfts } from 'src/nfts/slice' import { NftOrigin } from 'src/nfts/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/nfts/NftMedia.tsx b/src/nfts/NftMedia.tsx index 300612fae64..845d027e63e 100644 --- a/src/nfts/NftMedia.tsx +++ b/src/nfts/NftMedia.tsx @@ -3,12 +3,12 @@ import React, { useEffect, useState } from 'react' import { Platform, View } from 'react-native' import FastImage from 'react-native-fast-image' import Video, { ResizeMode } from 'react-native-video' -import { useSelector } from 'react-redux' import { NftEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import SkeletonPlaceholder from 'src/components/SkeletonPlaceholder' import { nftsLoadingSelector } from 'src/nfts/selectors' import { Nft, NftOrigin } from 'src/nfts/types' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import variables from 'src/styles/variables' import Logger from 'src/utils/Logger' diff --git a/src/onboarding/ChooseYourAdventure.tsx b/src/onboarding/ChooseYourAdventure.tsx index ef49fd65ea3..592496b1445 100644 --- a/src/onboarding/ChooseYourAdventure.tsx +++ b/src/onboarding/ChooseYourAdventure.tsx @@ -2,7 +2,6 @@ import React, { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useSelector } from 'react-redux' import { OnboardingEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Card from 'src/components/Card' @@ -18,6 +17,7 @@ import { nuxNavigationOptionsNoBackButton } from 'src/navigator/Headers' import { navigate, navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { AdventureCardName } from 'src/onboarding/types' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Shadow, Spacing } from 'src/styles/styles' diff --git a/src/onboarding/registration/EnableBiometry.tsx b/src/onboarding/registration/EnableBiometry.tsx index e08771f98dc..64c02184136 100644 --- a/src/onboarding/registration/EnableBiometry.tsx +++ b/src/onboarding/registration/EnableBiometry.tsx @@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import * as Keychain from 'react-native-keychain' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { setPincodeSuccess } from 'src/account/actions' import { PincodeType } from 'src/account/reducer' import { OnboardingEvents } from 'src/analytics/Events' @@ -26,7 +25,7 @@ import { onboardingPropsSelector, } from 'src/onboarding/steps' import { setPincodeWithBiometry } from 'src/pincode/authentication' -import useTypedSelector, { default as useSelector } from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { isUserCancelledError } from 'src/storage/keychain' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' @@ -52,7 +51,7 @@ export default function EnableBiometry({ navigation }: Props) { // This screen would not be displayed if supportedBiometryType were null const supportedBiometryType = useSelector(supportedBiometryTypeSelector) - const onboardingProps = useTypedSelector(onboardingPropsSelector) + const onboardingProps = useSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues(Screens.EnableBiometry, onboardingProps) diff --git a/src/onboarding/registration/ImportSelect.tsx b/src/onboarding/registration/ImportSelect.tsx index 41dc46ad533..e4da9814129 100644 --- a/src/onboarding/registration/ImportSelect.tsx +++ b/src/onboarding/registration/ImportSelect.tsx @@ -4,7 +4,6 @@ import React, { useLayoutEffect } from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { cancelCreateOrRestoreAccount } from 'src/account/actions' import { OnboardingEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -18,6 +17,7 @@ import { navigate, navigateClearingStack } from 'src/navigator/NavigationService import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import TopBarTextButtonOnboarding from 'src/onboarding/TopBarTextButtonOnboarding' +import { useDispatch } from 'src/redux/hooks' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Shadow, Spacing } from 'src/styles/styles' diff --git a/src/onboarding/registration/NameAndPicture.tsx b/src/onboarding/registration/NameAndPicture.tsx index d4b694257c1..0e2509fd89d 100644 --- a/src/onboarding/registration/NameAndPicture.tsx +++ b/src/onboarding/registration/NameAndPicture.tsx @@ -3,7 +3,6 @@ import React, { useLayoutEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { setName } from 'src/account/actions' import { nameSelector } from 'src/account/selectors' import { hideAlert, showError } from 'src/alert/actions' @@ -23,16 +22,16 @@ import { goToNextOnboardingScreen, onboardingPropsSelector, } from 'src/onboarding/steps' -import { default as useTypedSelector } from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' type Props = NativeStackScreenProps function NameAndPicture({ navigation, route }: Props) { const [nameInput, setNameInput] = useState('') - const cachedName = useTypedSelector(nameSelector) - const choseToRestoreAccount = useTypedSelector((state) => state.account.choseToRestoreAccount) - const onboardingProps = useTypedSelector(onboardingPropsSelector) + const cachedName = useSelector(nameSelector) + const choseToRestoreAccount = useSelector((state) => state.account.choseToRestoreAccount) + const onboardingProps = useSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues(Screens.NameAndPicture, onboardingProps) const dispatch = useDispatch() diff --git a/src/onboarding/registration/OnboardingRecoveryPhrase.tsx b/src/onboarding/registration/OnboardingRecoveryPhrase.tsx index a04e0f48e91..dd681c95f0c 100644 --- a/src/onboarding/registration/OnboardingRecoveryPhrase.tsx +++ b/src/onboarding/registration/OnboardingRecoveryPhrase.tsx @@ -4,7 +4,6 @@ import React, { useLayoutEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { recoveryPhraseInOnboardingCompleted } from 'src/account/actions' import { OnboardingEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -26,7 +25,7 @@ import { goToNextOnboardingScreen, onboardingPropsSelector, } from 'src/onboarding/steps' -import { default as useTypedSelector } from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import Logger from 'src/utils/Logger' @@ -34,7 +33,7 @@ import Logger from 'src/utils/Logger' type Props = NativeStackScreenProps function OnboardingRecoveryPhrase({ navigation }: Props) { - const onboardingProps = useTypedSelector(onboardingPropsSelector) + const onboardingProps = useSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues(Screens.ProtectWallet, onboardingProps) const accountKey = useAccountKey() const [showBottomSheet, setShowBottomSheet] = useState(false) diff --git a/src/onboarding/registration/PictureInput.tsx b/src/onboarding/registration/PictureInput.tsx index 86b4c7ce3ce..22a630aedfb 100644 --- a/src/onboarding/registration/PictureInput.tsx +++ b/src/onboarding/registration/PictureInput.tsx @@ -2,13 +2,13 @@ import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import { Platform, StyleSheet, View } from 'react-native' import ImagePicker from 'react-native-image-crop-picker' -import { useSelector } from 'react-redux' import { currentUserRecipientSelector } from 'src/account/selectors' import ContactCircle from 'src/components/ContactCircle' import OptionsChooser from 'src/components/OptionsChooser' import Touchable from 'src/components/Touchable' import Edit from 'src/icons/Edit' import { Recipient } from 'src/recipients/recipient' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import Logger from 'src/utils/Logger' import { ensureError } from 'src/utils/ensureError' diff --git a/src/onboarding/registration/ProtectWallet.tsx b/src/onboarding/registration/ProtectWallet.tsx index d4effd7adbb..aa8be77b26c 100644 --- a/src/onboarding/registration/ProtectWallet.tsx +++ b/src/onboarding/registration/ProtectWallet.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useLayoutEffect } from 'react' import { useTranslation } from 'react-i18next' import { ActivityIndicator, ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { recoveryPhraseInOnboardingStarted } from 'src/account/actions' import { RecoveryPhraseInOnboardingStatus } from 'src/account/reducer' import { recoveryPhraseInOnboardingStatusSelector } from 'src/account/selectors' @@ -16,7 +15,7 @@ import { ensurePincode, navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { getOnboardingStepValues, onboardingPropsSelector } from 'src/onboarding/steps' -import { default as useTypedSelector } from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' @@ -28,7 +27,7 @@ const TAG = 'ProtectWallet' type Props = NativeStackScreenProps function ProtectWallet({ navigation }: Props) { - const onboardingProps = useTypedSelector(onboardingPropsSelector) + const onboardingProps = useSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues(Screens.ProtectWallet, onboardingProps) const address = useSelector(walletAddressSelector) const { t } = useTranslation() diff --git a/src/onboarding/success/OnboardingSuccessScreen.tsx b/src/onboarding/success/OnboardingSuccessScreen.tsx index 4c9075546b4..28bd72e1f92 100644 --- a/src/onboarding/success/OnboardingSuccessScreen.tsx +++ b/src/onboarding/success/OnboardingSuccessScreen.tsx @@ -6,13 +6,13 @@ import { background } from 'src/images/Images' import { nuxNavigationOptionsNoBackButton } from 'src/navigator/Headers' import { Screens } from 'src/navigator/Screens' import { goToNextOnboardingScreen, onboardingPropsSelector } from 'src/onboarding/steps' -import useTypedSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' function OnboardingSuccessScreen() { - const onboardingProps = useTypedSelector(onboardingPropsSelector) + const onboardingProps = useSelector(onboardingPropsSelector) useEffect(() => { const timeout = setTimeout( () => diff --git a/src/onboarding/welcome/Welcome.tsx b/src/onboarding/welcome/Welcome.tsx index a9bfce881df..a19ca72d40f 100644 --- a/src/onboarding/welcome/Welcome.tsx +++ b/src/onboarding/welcome/Welcome.tsx @@ -2,7 +2,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { Image, ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { chooseCreateAccount, chooseRestoreAccount } from 'src/account/actions' import { recoveringFromStoreWipeSelector } from 'src/account/selectors' import { OnboardingEvents } from 'src/analytics/Events' @@ -15,7 +14,7 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import LanguageButton from 'src/onboarding/LanguageButton' import { firstOnboardingScreen } from 'src/onboarding/steps' -import { default as useSelector } from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getExperimentParams, patchUpdateStatsigUser } from 'src/statsig' import { ExperimentConfigs } from 'src/statsig/constants' import { StatsigExperiments } from 'src/statsig/types' diff --git a/src/pincode/PincodeEnter.tsx b/src/pincode/PincodeEnter.tsx index bbe1994e79d..67e4818212b 100644 --- a/src/pincode/PincodeEnter.tsx +++ b/src/pincode/PincodeEnter.tsx @@ -15,7 +15,7 @@ import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { checkPin } from 'src/pincode/authentication' import Pincode from 'src/pincode/Pincode' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { SentryTransactionHub } from 'src/sentry/SentryTransactionHub' import { SentryTransaction } from 'src/sentry/SentryTransactions' import { currentAccountSelector } from 'src/web3/selectors' diff --git a/src/pincode/PincodeLock.tsx b/src/pincode/PincodeLock.tsx index 209a3a3a971..339c96073a1 100644 --- a/src/pincode/PincodeLock.tsx +++ b/src/pincode/PincodeLock.tsx @@ -8,15 +8,15 @@ import { useTranslation } from 'react-i18next' import { BackHandler, Image, StyleSheet } from 'react-native' import RNExitApp from 'react-native-exit-app' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { PincodeType } from 'src/account/reducer' import { pincodeTypeSelector } from 'src/account/selectors' -import { appUnlock } from 'src/app/actions' import { ErrorMessages } from 'src/app/ErrorMessages' +import { appUnlock } from 'src/app/actions' import { supportedBiometryTypeSelector } from 'src/app/selectors' import { background } from 'src/images/Images' -import { checkPin, getPincodeWithBiometry } from 'src/pincode/authentication' import Pincode from 'src/pincode/Pincode' +import { checkPin, getPincodeWithBiometry } from 'src/pincode/authentication' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import { currentAccountSelector } from 'src/web3/selectors' diff --git a/src/positions/HooksPreviewModeBanner.tsx b/src/positions/HooksPreviewModeBanner.tsx index 13322f2a3ef..0e14b9631db 100644 --- a/src/positions/HooksPreviewModeBanner.tsx +++ b/src/positions/HooksPreviewModeBanner.tsx @@ -3,12 +3,12 @@ import { useTranslation } from 'react-i18next' import { StyleSheet, Text } from 'react-native' import Animated, { SlideInUp, SlideOutUp } from 'react-native-reanimated' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { BuilderHooksEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Touchable from 'src/components/Touchable' import { hooksPreviewApiUrlSelector, hooksPreviewStatusSelector } from 'src/positions/selectors' import { previewModeDisabled } from 'src/positions/slice' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fonts from 'src/styles/fonts' diff --git a/src/priceHistory/PriceHistoryChart.tsx b/src/priceHistory/PriceHistoryChart.tsx index 085b257944f..1e0a619e24a 100644 --- a/src/priceHistory/PriceHistoryChart.tsx +++ b/src/priceHistory/PriceHistoryChart.tsx @@ -10,15 +10,14 @@ import { ViewStyle, } from 'react-native' import { Circle, G, Line, Text as SvgText } from 'react-native-svg' -import { useDispatch } from 'react-redux' import i18n from 'src/i18n' import { LocalCurrencyCode } from 'src/localCurrency/consts' import { convertDollarsToLocalAmount } from 'src/localCurrency/convert' import { getLocalCurrencyCode, usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' import { priceHistoryPricesSelector, priceHistoryStatusSelector } from 'src/priceHistory/selectors' import { Price, fetchPriceHistoryStart } from 'src/priceHistory/slice' +import { useDispatch, useSelector } from 'src/redux/hooks' import { RootState } from 'src/redux/reducers' -import useSelector from 'src/redux/useSelector' import colors from 'src/styles/colors' import { Spacing } from 'src/styles/styles' import variables from 'src/styles/variables' diff --git a/src/qrcode/QRCode.tsx b/src/qrcode/QRCode.tsx index 070a3193ed5..a23e2f528dc 100644 --- a/src/qrcode/QRCode.tsx +++ b/src/qrcode/QRCode.tsx @@ -2,7 +2,6 @@ import Clipboard from '@react-native-clipboard/clipboard' import React, { useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { nameSelector } from 'src/account/selectors' import Button from 'src/components/Button' import ExchangesBottomSheet from 'src/components/ExchangesBottomSheet' @@ -10,6 +9,7 @@ import InLineNotification, { Severity } from 'src/components/InLineNotification' import { ExternalExchangeProvider } from 'src/fiatExchanges/ExternalExchanges' import CopyIcon from 'src/icons/CopyIcon' import StyledQRCode from 'src/qrcode/StyledQRCode' +import { useSelector } from 'src/redux/hooks' import { SVG } from 'src/send/actions' import { NETWORK_NAMES } from 'src/shared/conts' import { getDynamicConfigParams } from 'src/statsig' diff --git a/src/qrcode/QRTabBar.tsx b/src/qrcode/QRTabBar.tsx index 12fcc6d140a..b3078871628 100644 --- a/src/qrcode/QRTabBar.tsx +++ b/src/qrcode/QRTabBar.tsx @@ -4,12 +4,12 @@ import { useTranslation } from 'react-i18next' import { Dimensions, Platform, StyleSheet, Text, View } from 'react-native' import Animated from 'react-native-reanimated' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import SegmentedControl from 'src/components/SegmentedControl' import BackChevron from 'src/icons/BackChevron' import Share from 'src/icons/Share' import Times from 'src/icons/Times' import { TopBarIconButton } from 'src/navigator/TopBarButton' +import { useDispatch } from 'src/redux/hooks' import { SVG, shareQRCode } from 'src/send/actions' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' diff --git a/src/recipients/RecipientItemV2.tsx b/src/recipients/RecipientItemV2.tsx index 6df4c986abc..b2a5b34aacb 100644 --- a/src/recipients/RecipientItemV2.tsx +++ b/src/recipients/RecipientItemV2.tsx @@ -6,8 +6,8 @@ import Touchable from 'src/components/Touchable' import Logo, { LogoTypes } from 'src/icons/Logo' import QuestionIcon from 'src/icons/QuestionIcon' import { - e164NumberToAddressSelector, addressToVerificationStatusSelector, + e164NumberToAddressSelector, } from 'src/identity/selectors' import { Recipient, @@ -15,7 +15,7 @@ import { getDisplayDetail, getDisplayName, } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors, { Colors } from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/redux/hooks.ts b/src/redux/hooks.ts new file mode 100644 index 00000000000..cdc6131ddc3 --- /dev/null +++ b/src/redux/hooks.ts @@ -0,0 +1,5 @@ +import * as ReactRedux from 'react-redux' +import type { AppDispatch, RootState } from 'src/redux/store' + +export const useDispatch = ReactRedux.useDispatch.withTypes() +export const useSelector = ReactRedux.useSelector.withTypes() diff --git a/src/redux/store.ts b/src/redux/store.ts index 800a8a5d3c8..aacbe45bf78 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -8,7 +8,7 @@ import { PerformanceEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { createMigrate } from 'src/redux/createMigrate' import { migrations } from 'src/redux/migrations' -import rootReducer, { RootState } from 'src/redux/reducers' +import rootReducer, { RootState as ReducersRootState } from 'src/redux/reducers' import { rootSaga } from 'src/redux/sagas' import { resetStateOnInvalidStoredAccount } from 'src/utils/accountChecker' import Logger from 'src/utils/Logger' @@ -17,7 +17,7 @@ import { ONE_DAY_IN_MILLIS } from 'src/utils/time' const timeBetweenStoreSizeEvents = ONE_DAY_IN_MILLIS let lastEventTime = Date.now() -const persistConfig: PersistConfig = { +const persistConfig: PersistConfig = { key: 'root', // default is -1, increment as we make migrations // See https://github.com/valora-inc/wallet/tree/main/WALLET.md#redux-state-migration @@ -90,7 +90,7 @@ export const _persistConfig = persistConfig // eslint-disable-next-line no-var declare var window: any -export const setupStore = (initialState?: RootState, config = persistConfig) => { +export const setupStore = (initialState?: ReducersRootState, config = persistConfig) => { const sagaMiddleware = createSagaMiddleware({ onError: (error, errorInfo) => { // Log the uncaught error so it's captured by Sentry @@ -168,3 +168,6 @@ export const setupStore = (initialState?: RootState, config = persistConfig) => const { store, persistor } = setupStore() export { persistor, store } + +export type RootState = ReturnType +export type AppDispatch = typeof store.dispatch diff --git a/src/redux/useSelector.ts b/src/redux/useSelector.ts deleted file mode 100644 index f5019969bea..00000000000 --- a/src/redux/useSelector.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { TypedUseSelectorHook, useSelector } from 'react-redux' -import { RootState } from 'src/redux/reducers' - -// useSelector hook that is properly typed for our store's root state -const useTypedSelector: TypedUseSelectorHook = useSelector - -export default useTypedSelector diff --git a/src/send/EnterAmount.tsx b/src/send/EnterAmount.tsx index 975390153cd..8ff1f5e0411 100644 --- a/src/send/EnterAmount.tsx +++ b/src/send/EnterAmount.tsx @@ -25,7 +25,7 @@ import TokenIcon, { IconSize } from 'src/components/TokenIcon' import Touchable from 'src/components/Touchable' import CustomHeader from 'src/components/header/CustomHeader' import DownArrowIcon from 'src/icons/DownArrowIcon' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' diff --git a/src/send/InviteRewardsCard.tsx b/src/send/InviteRewardsCard.tsx index 6bafd8136e0..1d2fc203e8f 100644 --- a/src/send/InviteRewardsCard.tsx +++ b/src/send/InviteRewardsCard.tsx @@ -1,8 +1,8 @@ import React from 'react' import { Trans, useTranslation } from 'react-i18next' import { Image, StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { notificationInvite } from 'src/images/Images' +import { useSelector } from 'src/redux/hooks' import { inviteRewardsTypeSelector } from 'src/send/selectors' import { InviteRewardsType } from 'src/send/types' import Colors from 'src/styles/colors' diff --git a/src/send/SelectRecipientButtons.tsx b/src/send/SelectRecipientButtons.tsx index fc759c48523..2bf58c38118 100644 --- a/src/send/SelectRecipientButtons.tsx +++ b/src/send/SelectRecipientButtons.tsx @@ -18,7 +18,7 @@ import Social from 'src/icons/Social' import SelectRecipientJumpstartButton from 'src/jumpstart/SelectJumpstartRecipientButton' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import Logger from 'src/utils/Logger' import { CONTACTS_PERMISSION } from 'src/utils/contacts' import { navigateToPhoneSettings } from 'src/utils/linking' diff --git a/src/send/SendConfirmation.tsx b/src/send/SendConfirmation.tsx index 48361012b5a..67f0528f629 100644 --- a/src/send/SendConfirmation.tsx +++ b/src/send/SendConfirmation.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Platform, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { showError } from 'src/alert/actions' import { SendEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -29,7 +28,7 @@ import { noHeader } from 'src/navigator/Headers' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { getDisplayName } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { encryptComment, sendPayment } from 'src/send/actions' import { encryptedCommentSelector, diff --git a/src/send/SendEnterAmount.tsx b/src/send/SendEnterAmount.tsx index 02dfd262cd4..187b52707c4 100644 --- a/src/send/SendEnterAmount.tsx +++ b/src/send/SendEnterAmount.tsx @@ -7,7 +7,7 @@ import { getLocalCurrencyCode, usdToLocalCurrencyRateSelector } from 'src/localC import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import EnterAmount from 'src/send/EnterAmount' import { lastUsedTokenIdSelector } from 'src/send/selectors' import { usePrepareSendTransactions } from 'src/send/usePrepareSendTransactions' diff --git a/src/send/SendSelectRecipient.tsx b/src/send/SendSelectRecipient.tsx index e41368276ec..60ed7398f98 100644 --- a/src/send/SendSelectRecipient.tsx +++ b/src/send/SendSelectRecipient.tsx @@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next' import { Platform, StyleSheet, Text, View } from 'react-native' import { getFontScaleSync } from 'react-native-device-info' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { isAddressFormat } from 'src/account/utils' import { SendEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -31,7 +30,7 @@ import { TopBarIconButton } from 'src/navigator/TopBarButton' import { StackParamList } from 'src/navigator/types' import RecipientPicker from 'src/recipients/RecipientPickerV2' import { Recipient, RecipientType, recipientHasNumber } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import InviteRewardsCard from 'src/send/InviteRewardsCard' import PasteAddressButton from 'src/send/PasteAddressButton' import SelectRecipientButtons from 'src/send/SelectRecipientButtons' diff --git a/src/send/ValidateRecipientIntro.tsx b/src/send/ValidateRecipientIntro.tsx index fb1c79ae777..ea3d972bb80 100644 --- a/src/send/ValidateRecipientIntro.tsx +++ b/src/send/ValidateRecipientIntro.tsx @@ -3,7 +3,6 @@ import * as React from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { SendEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import CancelButton from 'src/components/CancelButton' @@ -14,6 +13,7 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { getDisplayName } from 'src/recipients/recipient' +import { useDispatch } from 'src/redux/hooks' import { handleQRCodeDetectedSecureSend } from 'src/send/actions' import { QrCode } from 'src/send/types' import fontStyles from 'src/styles/fonts' diff --git a/src/send/hooks.ts b/src/send/hooks.ts index 4d8b239470a..ccece3d35bf 100644 --- a/src/send/hooks.ts +++ b/src/send/hooks.ts @@ -16,7 +16,7 @@ import { } from 'src/recipients/recipient' import { phoneRecipientCacheSelector, recipientInfoSelector } from 'src/recipients/reducer' import { resolveId } from 'src/recipients/resolve-id' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' const TYPING_DEBOUNCE_MILLSECONDS = 300 const SEARCH_THROTTLE_TIME = 100 diff --git a/src/send/useFetchRecipientVerificationStatus.ts b/src/send/useFetchRecipientVerificationStatus.ts index e8dfeccf7cc..acd221ec929 100644 --- a/src/send/useFetchRecipientVerificationStatus.ts +++ b/src/send/useFetchRecipientVerificationStatus.ts @@ -1,5 +1,4 @@ import { useEffect, useState } from 'react' -import { useDispatch } from 'react-redux' import { phoneNumberVerifiedSelector } from 'src/app/selectors' import { fetchAddressVerification, fetchAddressesAndValidate } from 'src/identity/actions' import { @@ -8,7 +7,7 @@ import { } from 'src/identity/selectors' import { RecipientVerificationStatus } from 'src/identity/types' import { Recipient, RecipientType, getRecipientVerificationStatus } from 'src/recipients/recipient' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' const useFetchRecipientVerificationStatus = () => { const [recipient, setRecipient] = useState(null) diff --git a/src/swap/SwapScreen.tsx b/src/swap/SwapScreen.tsx index eb16536201e..616ae0a6d99 100644 --- a/src/swap/SwapScreen.tsx +++ b/src/swap/SwapScreen.tsx @@ -8,7 +8,6 @@ import { StyleSheet, Text, View } from 'react-native' import { ScrollView } from 'react-native-gesture-handler' import { getNumberFormatSettings } from 'react-native-localize' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { showError } from 'src/alert/actions' import { SwapEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -30,7 +29,7 @@ import { getLocalCurrencyCode } from 'src/localCurrency/selectors' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import { getDynamicConfigParams, getExperimentParams } from 'src/statsig' import { DynamicConfigs, ExperimentConfigs } from 'src/statsig/constants' diff --git a/src/swap/useFilterChips.ts b/src/swap/useFilterChips.ts index a2f3b279873..1f610e6313b 100644 --- a/src/swap/useFilterChips.ts +++ b/src/swap/useFilterChips.ts @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next' import { FilterChip } from 'src/components/FilterChipsCarousel' import { TOKEN_MIN_AMOUNT } from 'src/config' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import { getDynamicConfigParams, getFeatureGate } from 'src/statsig' import { DynamicConfigs } from 'src/statsig/constants' diff --git a/src/swap/useSwapQuote.ts b/src/swap/useSwapQuote.ts index 71e170f0e7f..a9bab2934b8 100644 --- a/src/swap/useSwapQuote.ts +++ b/src/swap/useSwapQuote.ts @@ -1,7 +1,7 @@ import BigNumber from 'bignumber.js' import { useAsyncCallback } from 'react-async-hook' import erc20 from 'src/abis/IERC20' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { FetchQuoteResponse, Field, ParsedSwapAmount, SwapTransaction } from 'src/swap/types' import { feeCurrenciesSelector } from 'src/tokens/selectors' import { TokenBalance } from 'src/tokens/slice' diff --git a/src/tokens/Assets.tsx b/src/tokens/Assets.tsx index 6d4b54e9a25..db5ac6298d5 100644 --- a/src/tokens/Assets.tsx +++ b/src/tokens/Assets.tsx @@ -18,7 +18,6 @@ import Animated, { useSharedValue, } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import { AssetsEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' @@ -48,7 +47,7 @@ import { totalPositionsBalanceUsdSelector, } from 'src/positions/selectors' import { Position } from 'src/positions/types' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import Colors from 'src/styles/colors' diff --git a/src/tokens/TokenBalances.tsx b/src/tokens/TokenBalances.tsx index 6d4fdd0ea8c..5d6cabbb363 100644 --- a/src/tokens/TokenBalances.tsx +++ b/src/tokens/TokenBalances.tsx @@ -19,7 +19,6 @@ import Animated, { useSharedValue, } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { useSelector } from 'react-redux' import { AssetsEvents, HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' @@ -39,6 +38,7 @@ import { totalPositionsBalanceUsdSelector, } from 'src/positions/selectors' import { Position } from 'src/positions/types' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import Colors from 'src/styles/colors' diff --git a/src/tokens/TokenDetails.tsx b/src/tokens/TokenDetails.tsx index e7f02874b5d..187581aebaa 100644 --- a/src/tokens/TokenDetails.tsx +++ b/src/tokens/TokenDetails.tsx @@ -3,7 +3,6 @@ import React, { useRef } from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useSelector } from 'react-redux' import { AssetsEvents } from 'src/analytics/Events' import { TokenProperties } from 'src/analytics/Properties' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -32,6 +31,7 @@ import { Screens } from 'src/navigator/Screens' import { isAppSwapsEnabledSelector } from 'src/navigator/selectors' import { StackParamList } from 'src/navigator/types' import PriceHistoryChart from 'src/priceHistory/PriceHistoryChart' +import { useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' diff --git a/src/tokens/TokenImport.tsx b/src/tokens/TokenImport.tsx index 1d0b753288a..108050a7d8e 100644 --- a/src/tokens/TokenImport.tsx +++ b/src/tokens/TokenImport.tsx @@ -4,7 +4,6 @@ import { useAsyncCallback } from 'react-async-hook' import { useTranslation } from 'react-i18next' import { Keyboard, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch } from 'react-redux' import erc20 from 'src/abis/IERC20' import { showMessage } from 'src/alert/actions' import { AssetsEvents } from 'src/analytics/Events' @@ -22,7 +21,7 @@ import { noHeader } from 'src/navigator/Headers' import { navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' -import useSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import { Colors } from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' diff --git a/src/tokens/hooks.ts b/src/tokens/hooks.ts index b3c4fc1fd05..a29368826fe 100644 --- a/src/tokens/hooks.ts +++ b/src/tokens/hooks.ts @@ -1,7 +1,7 @@ import BigNumber from 'bignumber.js' import { TIME_UNTIL_TOKEN_INFO_BECOMES_STALE } from 'src/config' import { usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { getDynamicConfigParams, getFeatureGate } from 'src/statsig' import { DynamicConfigs } from 'src/statsig/constants' import { StatsigDynamicConfigs, StatsigFeatureGates } from 'src/statsig/types' diff --git a/src/transactions/CommentSection.tsx b/src/transactions/CommentSection.tsx index 090b5edc25b..5af4ccdf7ac 100644 --- a/src/transactions/CommentSection.tsx +++ b/src/transactions/CommentSection.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import HorizontalLine from 'src/components/HorizontalLine' import { decryptComment } from 'src/identity/commentEncryption' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { dataEncryptionKeySelector } from 'src/web3/selectors' diff --git a/src/transactions/feed/NftFeedItem.tsx b/src/transactions/feed/NftFeedItem.tsx index ca003d65fd7..c3de03ca9b8 100644 --- a/src/transactions/feed/NftFeedItem.tsx +++ b/src/transactions/feed/NftFeedItem.tsx @@ -11,7 +11,7 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import NftMedia from 'src/nfts/NftMedia' import { Nft, NftOrigin } from 'src/nfts/types' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' diff --git a/src/transactions/feed/SwapFeedItem.tsx b/src/transactions/feed/SwapFeedItem.tsx index 79862bed9cd..f86f6415760 100644 --- a/src/transactions/feed/SwapFeedItem.tsx +++ b/src/transactions/feed/SwapFeedItem.tsx @@ -1,7 +1,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { hideHomeBalancesSelector } from 'src/app/selectors' @@ -9,6 +8,7 @@ import TokenDisplay from 'src/components/TokenDisplay' import Touchable from 'src/components/Touchable' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' diff --git a/src/transactions/feed/TransactionDetailsScreen.tsx b/src/transactions/feed/TransactionDetailsScreen.tsx index b8f83c6f934..69fc7b0c116 100644 --- a/src/transactions/feed/TransactionDetailsScreen.tsx +++ b/src/transactions/feed/TransactionDetailsScreen.tsx @@ -14,7 +14,7 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { coinbasePaySendersSelector, rewardsSendersSelector } from 'src/recipients/reducer' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/transactions/feed/TransactionFeed.tsx b/src/transactions/feed/TransactionFeed.tsx index 13409408850..eb2f47f8a7f 100644 --- a/src/transactions/feed/TransactionFeed.tsx +++ b/src/transactions/feed/TransactionFeed.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react' import { ActivityIndicator, SectionList, StyleSheet, View } from 'react-native' import SectionHead from 'src/components/SectionHead' import GetStarted from 'src/home/GetStarted' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' diff --git a/src/transactions/feed/TransferFeedItem.tsx b/src/transactions/feed/TransferFeedItem.tsx index 9c740ebce2c..6f572ff3eef 100644 --- a/src/transactions/feed/TransferFeedItem.tsx +++ b/src/transactions/feed/TransferFeedItem.tsx @@ -1,7 +1,6 @@ import BigNumber from 'bignumber.js' import React from 'react' import { StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import { HomeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { hideHomeBalancesSelector } from 'src/app/selectors' @@ -9,6 +8,7 @@ import TokenDisplay from 'src/components/TokenDisplay' import Touchable from 'src/components/Touchable' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' +import { useSelector } from 'src/redux/hooks' import { getFeatureGate } from 'src/statsig' import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' diff --git a/src/transactions/feed/detailContent/RewardReceivedContent.tsx b/src/transactions/feed/detailContent/RewardReceivedContent.tsx index b4fad32f477..8a01d860916 100644 --- a/src/transactions/feed/detailContent/RewardReceivedContent.tsx +++ b/src/transactions/feed/detailContent/RewardReceivedContent.tsx @@ -2,7 +2,6 @@ import BigNumber from 'bignumber.js' import React from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text } from 'react-native' -import { useSelector } from 'react-redux' import { RewardsEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { rewardsEnabledSelector } from 'src/app/selectors' @@ -14,6 +13,7 @@ import { RewardsScreenOrigin } from 'src/consumerIncentives/analyticsEventsTrack import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { RecipientType } from 'src/recipients/recipient' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import TransferAvatars from 'src/transactions/TransferAvatars' diff --git a/src/transactions/feed/detailContent/TransferReceivedContent.tsx b/src/transactions/feed/detailContent/TransferReceivedContent.tsx index 8c7bc8940a7..42ee0e55881 100644 --- a/src/transactions/feed/detailContent/TransferReceivedContent.tsx +++ b/src/transactions/feed/detailContent/TransferReceivedContent.tsx @@ -8,16 +8,16 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { getRecipientFromAddress } from 'src/recipients/recipient' import { recipientInfoSelector } from 'src/recipients/reducer' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { useTokenInfo } from 'src/tokens/hooks' -import networkConfig from 'src/web3/networkConfig' import CommentSection from 'src/transactions/CommentSection' import TransferAvatars from 'src/transactions/TransferAvatars' -import { TokenTransfer } from 'src/transactions/types' import UserSection from 'src/transactions/UserSection' +import { TokenTransfer } from 'src/transactions/types' import { Currency } from 'src/utils/currencies' +import networkConfig from 'src/web3/networkConfig' // Note that this is tested from TransactionDetailsScreen.test.tsx function TransferReceivedContent({ transfer }: { transfer: TokenTransfer }) { diff --git a/src/transactions/feed/detailContent/TransferSentContent.tsx b/src/transactions/feed/detailContent/TransferSentContent.tsx index 23f9094e1a6..4b9ca44b5ce 100644 --- a/src/transactions/feed/detailContent/TransferSentContent.tsx +++ b/src/transactions/feed/detailContent/TransferSentContent.tsx @@ -7,7 +7,7 @@ import LineItemRow from 'src/components/LineItemRow' import TokenDisplay from 'src/components/TokenDisplay' import { getRecipientFromAddress } from 'src/recipients/recipient' import { recipientInfoSelector } from 'src/recipients/reducer' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/transactions/feed/queryHelper.ts b/src/transactions/feed/queryHelper.ts index ab7b78899d3..0daf0e20b18 100644 --- a/src/transactions/feed/queryHelper.ts +++ b/src/transactions/feed/queryHelper.ts @@ -3,11 +3,11 @@ import { useEffect, useState } from 'react' import { useAsync } from 'react-async-hook' import { useTranslation } from 'react-i18next' import Toast from 'react-native-simple-toast' -import { useDispatch, useSelector } from 'react-redux' import { showError } from 'src/alert/actions' import { ErrorMessages } from 'src/app/ErrorMessages' import useInterval from 'src/hooks/useInterval' import { getLocalCurrencyCode } from 'src/localCurrency/selectors' +import { useDispatch, useSelector } from 'src/redux/hooks' import { DynamicConfigs } from 'src/statsig/constants' import { getDynamicConfigParams } from 'src/statsig/index' import { StatsigDynamicConfigs } from 'src/statsig/types' diff --git a/src/transactions/transferFeedUtils.ts b/src/transactions/transferFeedUtils.ts index 41a3997d98e..adb269bf02e 100644 --- a/src/transactions/transferFeedUtils.ts +++ b/src/transactions/transferFeedUtils.ts @@ -30,7 +30,7 @@ import { recipientInfoSelector, rewardsSendersSelector, } from 'src/recipients/reducer' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { useTokenInfoByAddress } from 'src/tokens/hooks' import { FeedTokenTransfer } from 'src/transactions/feed/TransferFeedItem' import { diff --git a/src/utils/countryFeatures.ts b/src/utils/countryFeatures.ts index 2b39826c221..8139c8fc833 100644 --- a/src/utils/countryFeatures.ts +++ b/src/utils/countryFeatures.ts @@ -1,7 +1,7 @@ import { createSelector } from 'reselect' import { countryFeatures } from 'src/flags' import { userLocationDataSelector } from 'src/networkInfo/selectors' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' type CountryFeatures = typeof countryFeatures type SpecificCountryFeatures = { [K in keyof CountryFeatures]: boolean } diff --git a/src/verify/VerificationStartScreen.tsx b/src/verify/VerificationStartScreen.tsx index 8f0d7703d8e..d9bd865deaa 100644 --- a/src/verify/VerificationStartScreen.tsx +++ b/src/verify/VerificationStartScreen.tsx @@ -7,7 +7,6 @@ import { useTranslation } from 'react-i18next' import { ActivityIndicator, BackHandler, StyleSheet, Text, View } from 'react-native' import * as RNLocalize from 'react-native-localize' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' import { initializeAccount } from 'src/account/actions' import { choseToRestoreAccountSelector, @@ -37,7 +36,7 @@ import { onboardingPropsSelector, } from 'src/onboarding/steps' import { retrieveSignedMessage } from 'src/pincode/authentication' -import useTypedSelector from 'src/redux/useSelector' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' @@ -65,7 +64,7 @@ function VerificationStartScreen({ const cachedNumber = useSelector(e164NumberSelector) const cachedCountryCallingCode = useSelector(defaultCountryCodeSelector) const walletAddress = useSelector(walletAddressSelector) - const onboardingProps = useTypedSelector(onboardingPropsSelector) + const onboardingProps = useSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues( Screens.VerificationStartScreen, onboardingProps diff --git a/src/verify/hooks.ts b/src/verify/hooks.ts index 554ca127b7f..f5b17227b43 100644 --- a/src/verify/hooks.ts +++ b/src/verify/hooks.ts @@ -5,22 +5,22 @@ import { useEffect, useRef, useState } from 'react' import { useAsync, useAsyncCallback } from 'react-async-hook' import { Platform } from 'react-native' import DeviceInfo from 'react-native-device-info' -import { useDispatch, useSelector } from 'react-redux' import { e164NumberSelector } from 'src/account/selectors' import { showError } from 'src/alert/actions' import { PhoneVerificationEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' -import { phoneNumberRevoked, phoneNumberVerificationCompleted } from 'src/app/actions' import { ErrorMessages } from 'src/app/ErrorMessages' +import { phoneNumberRevoked, phoneNumberVerificationCompleted } from 'src/app/actions' import { inviterAddressSelector } from 'src/app/selectors' import { PHONE_NUMBER_VERIFICATION_CODE_LENGTH } from 'src/config' import { + SmsEvent, addSmsListener, removeSmsListener, - SmsEvent, startSmsRetriever, } from 'src/identity/smsRetrieval' import { retrieveSignedMessage } from 'src/pincode/authentication' +import { useDispatch, useSelector } from 'src/redux/hooks' import Logger from 'src/utils/Logger' import networkConfig from 'src/web3/networkConfig' import { dataEncryptionKeySelector, walletAddressSelector } from 'src/web3/selectors' diff --git a/src/walletConnect/screens/ActionRequest.tsx b/src/walletConnect/screens/ActionRequest.tsx index 44b038fffa2..c730fd30e9e 100644 --- a/src/walletConnect/screens/ActionRequest.tsx +++ b/src/walletConnect/screens/ActionRequest.tsx @@ -3,8 +3,8 @@ import { Web3WalletTypes } from '@walletconnect/web3wallet' import React, { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import InLineNotification, { Severity } from 'src/components/InLineNotification' +import { useDispatch, useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import { Spacing } from 'src/styles/styles' import Logger from 'src/utils/Logger' diff --git a/src/walletConnect/screens/ActionRequestPayload.tsx b/src/walletConnect/screens/ActionRequestPayload.tsx index b005a2dc636..47a5a925bf4 100644 --- a/src/walletConnect/screens/ActionRequestPayload.tsx +++ b/src/walletConnect/screens/ActionRequestPayload.tsx @@ -3,11 +3,11 @@ import { SessionTypes } from '@walletconnect/types' import { Web3WalletTypes } from '@walletconnect/web3wallet' import React, { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useSelector } from 'react-redux' import { WalletConnectEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import DataFieldWithCopy from 'src/components/DataFieldWithCopy' import { activeDappSelector } from 'src/dapps/selectors' +import { useSelector } from 'src/redux/hooks' import { SerializableTransactionRequest } from 'src/viem/preparedTransactionSerialization' import { getDefaultRequestTrackedProperties, diff --git a/src/walletConnect/screens/EstimatedNetworkFee.tsx b/src/walletConnect/screens/EstimatedNetworkFee.tsx index 6e81520acd5..33f66e096e8 100644 --- a/src/walletConnect/screens/EstimatedNetworkFee.tsx +++ b/src/walletConnect/screens/EstimatedNetworkFee.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import TokenDisplay from 'src/components/TokenDisplay' -import useSelector from 'src/redux/useSelector' +import { useSelector } from 'src/redux/hooks' import { NETWORK_NAMES } from 'src/shared/conts' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' diff --git a/src/walletConnect/screens/RequestContent.tsx b/src/walletConnect/screens/RequestContent.tsx index 575f7c3230b..f86362fc32a 100644 --- a/src/walletConnect/screens/RequestContent.tsx +++ b/src/walletConnect/screens/RequestContent.tsx @@ -3,9 +3,9 @@ import { CoreTypes } from '@walletconnect/types' import React, { ReactElement, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' -import { useSelector } from 'react-redux' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' import { activeDappSelector } from 'src/dapps/selectors' +import { useSelector } from 'src/redux/hooks' import { Colors } from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/walletConnect/screens/SessionRequest.tsx b/src/walletConnect/screens/SessionRequest.tsx index 2b42c14341e..cfc7ae6d232 100644 --- a/src/walletConnect/screens/SessionRequest.tsx +++ b/src/walletConnect/screens/SessionRequest.tsx @@ -4,8 +4,8 @@ import { Web3WalletTypes } from '@walletconnect/web3wallet' import React from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import InLineNotification, { Severity } from 'src/components/InLineNotification' +import { useDispatch, useSelector } from 'src/redux/hooks' import { SentryTransactionHub } from 'src/sentry/SentryTransactionHub' import { SentryTransaction } from 'src/sentry/SentryTransactions' import { NETWORK_NAMES } from 'src/shared/conts' diff --git a/src/walletConnect/screens/Sessions.tsx b/src/walletConnect/screens/Sessions.tsx index f2207ad74e5..56282713884 100644 --- a/src/walletConnect/screens/Sessions.tsx +++ b/src/walletConnect/screens/Sessions.tsx @@ -2,11 +2,11 @@ import { CoreTypes, SessionTypes } from '@walletconnect/types' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import { Image, ScrollView, StyleSheet, Text, View } from 'react-native' -import { useDispatch, useSelector } from 'react-redux' import Dialog from 'src/components/Dialog' import QrScanButton from 'src/components/QrScanButton' import Touchable from 'src/components/Touchable' import { headerWithBackButton } from 'src/navigator/Headers' +import { useDispatch, useSelector } from 'src/redux/hooks' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' diff --git a/src/walletConnect/screens/useIsDappListed.ts b/src/walletConnect/screens/useIsDappListed.ts index 345a49f8b2d..b7cd9b3d88c 100644 --- a/src/walletConnect/screens/useIsDappListed.ts +++ b/src/walletConnect/screens/useIsDappListed.ts @@ -1,5 +1,5 @@ -import { useSelector } from 'react-redux' import { dappsListSelector } from 'src/dapps/selectors' +import { useSelector } from 'src/redux/hooks' export const useIsDappListed = (dappUrl?: string) => { const dappsList = useSelector(dappsListSelector) diff --git a/src/webview/WebViewScreen.tsx b/src/webview/WebViewScreen.tsx index dcc89a91ad7..921699e591b 100644 --- a/src/webview/WebViewScreen.tsx +++ b/src/webview/WebViewScreen.tsx @@ -12,7 +12,6 @@ import { } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import { ShouldStartLoadRequest } from 'react-native-webview/lib/WebViewTypes' -import { useDispatch, useSelector } from 'react-redux' import { DappExplorerEvents, WebViewEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import { openDeepLink } from 'src/app/actions' @@ -29,13 +28,14 @@ import { navigateBack } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { TopBarTextButton } from 'src/navigator/TopBarButton' import { StackParamList } from 'src/navigator/types' +import { useDispatch, useSelector } from 'src/redux/hooks' import { getDynamicConfigParams } from 'src/statsig' import { DynamicConfigs } from 'src/statsig/constants' import { StatsigDynamicConfigs } from 'src/statsig/types' import colors from 'src/styles/colors' import { iconHitslop } from 'src/styles/variables' -import { navigateToURI } from 'src/utils/linking' import Logger from 'src/utils/Logger' +import { navigateToURI } from 'src/utils/linking' import useBackHandler from 'src/utils/useBackHandler' import { isWalletConnectDeepLink } from 'src/walletConnect/walletConnect' import { WebViewAndroidBottomSheet } from 'src/webview/WebViewAndroidBottomSheet' diff --git a/yarn.lock b/yarn.lock index 35dac43ff58..6234d0aab29 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1040,7 +1040,7 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.0.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.6", "@babel/runtime@^7.21.0", "@babel/runtime@^7.4.4", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.6", "@babel/runtime@^7.21.0", "@babel/runtime@^7.4.4", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4": version "7.22.11" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.11.tgz#7a9ba3bbe406ad6f9e8dd4da2ece453eb23a77a4" integrity sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA== @@ -4733,10 +4733,10 @@ resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.36.tgz#17ce0a235e9ffbcdcdf5095646b374c2bf615a4c" integrity sha512-7TUK/k2/QGpEAv/BCwSHlYu3NXZhQ9ZwBYpzr9tjlPIL2C5BeGhH3DmVavRx3ZNyELX5TLC91JTz/cen6AAtIQ== -"@types/hoist-non-react-statics@^3.3.0": - version "3.3.1" - resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" - integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== +"@types/hoist-non-react-statics@^3.3.5": + version "3.3.5" + resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz#dab7867ef789d87e2b4b0003c9d65c49cc44a494" + integrity sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg== dependencies: "@types/react" "*" hoist-non-react-statics "^3.3.0" @@ -4908,16 +4908,6 @@ dependencies: "@types/react" "*" -"@types/react-redux@^7.1.20", "@types/react-redux@^7.1.7": - version "7.1.25" - resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.25.tgz#de841631205b24f9dfb4967dd4a7901e048f9a88" - integrity sha512-bAGh4e+w5D8dajd6InASVIyCo4pZLJ66oLb80F9OBLO1gKESbZcRCJpTT6uLXX+HAB57zw1WTdwJdAsewuTweg== - dependencies: - "@types/hoist-non-react-statics" "^3.3.0" - "@types/react" "*" - hoist-non-react-statics "^3.3.0" - redux "^4.0.0" - "@types/react-test-renderer@^18.0.0": version "18.0.0" resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-18.0.0.tgz#7b7f69ca98821ea5501b21ba24ea7b6139da2243" @@ -4996,6 +4986,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff" integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw== +"@types/use-sync-external-store@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz#b6725d5f4af24ace33b36fafd295136e75509f43" + integrity sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA== + "@types/utf8@^2.1.6": version "2.1.6" resolved "https://registry.yarnpkg.com/@types/utf8/-/utf8-2.1.6.tgz#430cabb71a42d0a3613cce5621324fe4f5a25753" @@ -14888,7 +14883,7 @@ react-i18next@^12.3.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-is@^17.0.1, react-is@^17.0.2: +react-is@^17.0.1: version "17.0.2" resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== @@ -15330,17 +15325,13 @@ react-native@0.71.12: whatwg-fetch "^3.0.0" ws "^6.2.2" -react-redux@^7.2.9: - version "7.2.9" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.9.tgz#09488fbb9416a4efe3735b7235055442b042481d" - integrity sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ== +react-redux@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-9.1.0.tgz#46a46d4cfed4e534ce5452bb39ba18e1d98a8197" + integrity sha512-6qoDzIO+gbrza8h3hjMA9aq4nwVFCKFtY2iLxCtVT38Swyy2C/dJCGBXHeHLtx6qlg/8qzc2MrhOeduf5K32wQ== dependencies: - "@babel/runtime" "^7.15.4" - "@types/react-redux" "^7.1.20" - hoist-non-react-statics "^3.3.2" - loose-envify "^1.4.0" - prop-types "^15.7.2" - react-is "^17.0.2" + "@types/use-sync-external-store" "^0.0.3" + use-sync-external-store "^1.0.0" react-refresh@^0.4.0: version "0.4.2" @@ -15580,7 +15571,7 @@ redux-thunk@^3.1.0: resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-3.1.0.tgz#94aa6e04977c30e14e892eae84978c1af6058ff3" integrity sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw== -redux@^4.0.0, redux@^4.0.5, redux@^5.0.1: +redux@^4.0.5, redux@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/redux/-/redux-5.0.1.tgz#97fa26881ce5746500125585d5642c77b6e9447b" integrity sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==