diff --git a/App.tsx b/App.tsx index 390580ebd..f549c7d02 100644 --- a/App.tsx +++ b/App.tsx @@ -5,11 +5,11 @@ import React from 'react'; import { useColorScheme } from 'react-native'; import { SafeAreaProvider } from 'react-native-safe-area-context'; import { LargeScreenProvider } from './components/Context/LargeScreenProvider'; -import { SettingsProvider } from './components/Context/SettingsContext'; +import { SettingsProvider } from './components/Context/SettingsProvider'; import { BlueDarkTheme, BlueDefaultTheme } from './components/themes'; import MasterView from './navigation/MasterView'; import { navigationRef } from './NavigationService'; -import { BlueStorageProvider } from './components/Context/BlueStorageContext'; +import { StorageProvider } from './components/Context/StorageProvider'; const App = () => { const colorScheme = useColorScheme(); @@ -18,11 +18,11 @@ const App = () => { - + - + diff --git a/MasterView.tsx b/MasterView.tsx index 5180c86e3..e982d6207 100644 --- a/MasterView.tsx +++ b/MasterView.tsx @@ -1,9 +1,8 @@ import 'react-native-gesture-handler'; // should be on top import React, { lazy, Suspense } from 'react'; - -import { useStorage } from './blue_modules/storage-context'; import MainRoot from './navigation'; +import { useStorage } from './hooks/context/useStorage'; const CompanionDelegates = lazy(() => import('./components/CompanionDelegates')); const MasterView = () => { diff --git a/components/Context/SettingsProvider.tsx b/components/Context/SettingsProvider.tsx index c1b3a2cf5..aaa832e09 100644 --- a/components/Context/SettingsProvider.tsx +++ b/components/Context/SettingsProvider.tsx @@ -280,4 +280,4 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = ({ chil ); return {children}; -}; \ No newline at end of file +}; diff --git a/components/DeviceQuickActions.tsx b/components/DeviceQuickActions.tsx index 0ca764bbd..36d72d921 100644 --- a/components/DeviceQuickActions.tsx +++ b/components/DeviceQuickActions.tsx @@ -1,16 +1,15 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; import { CommonActions } from '@react-navigation/native'; -import { useContext, useEffect } from 'react'; +import { useEffect } from 'react'; import { DeviceEventEmitter, Linking, Platform } from 'react-native'; import QuickActions from 'react-native-quick-actions'; - -import { BlueStorageContext } from '../blue_modules/storage-context'; import DeeplinkSchemaMatch from '../class/deeplink-schema-match'; import { TWallet } from '../class/wallets/types'; -import { useSettings } from '../components/Context/SettingsContext'; import useOnAppLaunch from '../hooks/useOnAppLaunch'; import { formatBalance } from '../loc'; import * as NavigationService from '../NavigationService'; +import { useSettings } from '../hooks/context/useSettings'; +import { useStorage } from '../hooks/context/useStorage'; const DeviceQuickActionsStorageKey = 'DeviceQuickActionsEnabled'; diff --git a/components/HandOffComponent.ios.tsx b/components/HandOffComponent.ios.tsx index 3291429bb..93df39d49 100644 --- a/components/HandOffComponent.ios.tsx +++ b/components/HandOffComponent.ios.tsx @@ -2,10 +2,9 @@ import React from 'react'; import DefaultPreference from 'react-native-default-preference'; // @ts-ignore: react-native-handoff is not in the type definition import Handoff from 'react-native-handoff'; - import { GROUP_IO_BLUEWALLET } from '../blue_modules/currency'; import { BlueApp } from '../class'; -import { useSettings } from './Context/SettingsContext'; +import { useSettings } from '../hooks/context/useSettings'; interface HandOffComponentProps { url?: string; diff --git a/components/HandOffComponentListener.ios.tsx b/components/HandOffComponentListener.ios.tsx index 61d1c1311..5da4aa30b 100644 --- a/components/HandOffComponentListener.ios.tsx +++ b/components/HandOffComponentListener.ios.tsx @@ -1,9 +1,8 @@ import React, { useEffect } from 'react'; import { NativeEventEmitter, NativeModules } from 'react-native'; - -import { useStorage } from '../blue_modules/storage-context'; import * as NavigationService from '../NavigationService'; import HandOffComponent from './HandOffComponent.ios'; +import { useStorage } from '../hooks/context/useStorage'; interface UserActivityData { activityType: keyof typeof HandOffComponent.activityTypes; diff --git a/components/MenuElements.ios.tsx b/components/MenuElements.ios.tsx index 6e60b21e1..34e171f7c 100644 --- a/components/MenuElements.ios.tsx +++ b/components/MenuElements.ios.tsx @@ -1,8 +1,8 @@ import { CommonActions } from '@react-navigation/native'; -import { useCallback, useContext, useEffect } from 'react'; +import { useCallback, useEffect } from 'react'; import { NativeEventEmitter, NativeModules, Platform } from 'react-native'; -import { BlueStorageContext } from '../blue_modules/storage-context'; import * as NavigationService from '../NavigationService'; +import { useStorage } from '../hooks/context/useStorage'; /* Component for iPadOS and macOS menu items with keyboard shortcuts. diff --git a/components/TransactionListItem.tsx b/components/TransactionListItem.tsx index f9f6c861e..398154154 100644 --- a/components/TransactionListItem.tsx +++ b/components/TransactionListItem.tsx @@ -13,7 +13,7 @@ import TransactionOutgoingIcon from '../components/icons/TransactionOutgoingIcon import TransactionPendingIcon from '../components/icons/TransactionPendingIcon'; import loc, { formatBalanceWithoutSuffix, transactionTimeToReadable } from '../loc'; import { BitcoinUnit } from '../models/bitcoinUnits'; -import { useSettings } from './Context/SettingsContext'; +import { useSettings } from '../hooks/context/useSettings'; import ListItem from './ListItem'; import { useTheme } from './themes'; import ToolTipMenu from './TooltipMenu'; diff --git a/components/TransactionsNavigationHeader.tsx b/components/TransactionsNavigationHeader.tsx index fc0d8a5e5..31efb6512 100644 --- a/components/TransactionsNavigationHeader.tsx +++ b/components/TransactionsNavigationHeader.tsx @@ -10,7 +10,7 @@ import loc, { formatBalance, formatBalanceWithoutSuffix } from '../loc'; import { BitcoinUnit } from '../models/bitcoinUnits'; import { FiatUnit } from '../models/fiatUnit'; import { BlurredBalanceView } from './BlurredBalanceView'; -import { useSettings } from './Context/SettingsContext'; +import { useSettings } from '../hooks/context/useSettings'; import ToolTipMenu from './TooltipMenu'; import { ToolTipMenuProps } from './types'; diff --git a/components/WalletsCarousel.js b/components/WalletsCarousel.js index eeac50283..e6ffd09b2 100644 --- a/components/WalletsCarousel.js +++ b/components/WalletsCarousel.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React, { forwardRef, useCallback, useContext, useImperativeHandle, useRef } from 'react'; +import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react'; import { Animated, FlatList, @@ -14,16 +14,16 @@ import { View, } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; - -import { BlueStorageContext, WalletTransactionsStatus } from '../blue_modules/storage-context'; import { BlueSpacing10 } from '../BlueComponents'; import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet } from '../class'; import WalletGradient from '../class/wallet-gradient'; import { useIsLargeScreen } from '../hooks/useIsLargeScreen'; import loc, { formatBalance, transactionTimeToReadable } from '../loc'; import { BlurredBalanceView } from './BlurredBalanceView'; -import { useSettings } from './Context/SettingsContext'; +import { useSettings } from '../../hooks/context/useSettings'; import { useTheme } from './themes'; +import { useStorage } from '../hooks/context/useStorage'; +import { WalletTransactionsStatus } from './Context/StorageProvider'; const nStyles = StyleSheet.create({ container: { diff --git a/components/WatchConnectivity.ios.js b/components/WatchConnectivity.ios.js index 774a19f4a..880d54eee 100644 --- a/components/WatchConnectivity.ios.js +++ b/components/WatchConnectivity.ios.js @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { transferCurrentComplicationUserInfo, transferUserInfo, @@ -7,14 +7,13 @@ import { useReachability, watchEvents, } from 'react-native-watch-connectivity'; - import Notifications from '../blue_modules/notifications'; -import { BlueStorageContext } from '../blue_modules/storage-context'; import { MultisigHDWallet } from '../class'; import loc, { formatBalance, transactionTimeToReadable } from '../loc'; import { Chain } from '../models/bitcoinUnits'; import { FiatUnit } from '../models/fiatUnit'; -import { useSettings } from './Context/SettingsContext'; +import { useSettings } from '../hooks/context/useSettings'; +import { useStorage } from '../hooks/context/useStorage'; function WatchConnectivity() { const { walletsInitialized, wallets, fetchWalletTransactions, saveToDisk, txMetadata } = useStorage(); diff --git a/components/WidgetCommunication.ios.tsx b/components/WidgetCommunication.ios.tsx index 77f360a19..03f6fe616 100644 --- a/components/WidgetCommunication.ios.tsx +++ b/components/WidgetCommunication.ios.tsx @@ -1,9 +1,8 @@ -import React, { useContext, useEffect } from 'react'; +import React, { useEffect } from 'react'; import DefaultPreference from 'react-native-default-preference'; - -import { BlueStorageContext } from '../blue_modules/storage-context'; import { TWallet } from '../class/wallets/types'; -import { useSettings } from './Context/SettingsContext'; +import { useSettings } from '../hooks/context/useSettings'; +import { useStorage } from '../hooks/context/useStorage'; enum WidgetCommunicationKeys { AllWalletsSatoshiBalance = 'WidgetCommunicationAllWalletsSatoshiBalance', diff --git a/hooks/context/useSettings.ts b/hooks/context/useSettings.ts index a7a8bec03..2af1959e0 100644 --- a/hooks/context/useSettings.ts +++ b/hooks/context/useSettings.ts @@ -1,4 +1,4 @@ import { useContext } from 'react'; -import { SettingsContext } from '../../components/Context/SettingsPriver'; +import { SettingsContext } from '../../components/Context/SettingsProvider'; export const useSettings = () => useContext(SettingsContext); diff --git a/hooks/useBiometrics.ts b/hooks/useBiometrics.ts index 4a60714b9..efa334c29 100644 --- a/hooks/useBiometrics.ts +++ b/hooks/useBiometrics.ts @@ -5,8 +5,8 @@ import PasscodeAuth from 'react-native-passcode-auth'; import RNSecureKeyStore, { ACCESSIBLE } from 'react-native-secure-key-store'; import loc from '../loc'; import * as NavigationService from '../NavigationService'; -import { useStorage } from '../blue_modules/storage-context'; import presentAlert from '../components/Alert'; +import { useStorage } from './context/useStorage'; const STORAGEKEY = 'Biometrics'; const rnBiometrics = new ReactNativeBiometrics({ allowDeviceCredentials: true }); diff --git a/hooks/useExtendedNavigation.ts b/hooks/useExtendedNavigation.ts index 7da7f4d19..82216f055 100644 --- a/hooks/useExtendedNavigation.ts +++ b/hooks/useExtendedNavigation.ts @@ -1,8 +1,8 @@ import { useNavigation, NavigationProp, ParamListBase } from '@react-navigation/native'; import { navigationRef } from '../NavigationService'; -import { useStorage } from '../blue_modules/storage-context'; import { presentWalletExportReminder } from '../helpers/presentWalletExportReminder'; import { useBiometrics } from './useBiometrics'; +import { useStorage } from './context/useStorage'; // List of screens that require biometrics const requiresBiometrics = ['WalletExportRoot', 'WalletXpubRoot', 'ViewEditMultisigCosignersRoot', 'ExportMultisigCoordinationSetupRoot']; diff --git a/hooks/useOnAppLaunch.ts b/hooks/useOnAppLaunch.ts index c752d8fb7..c3fb7b7e1 100644 --- a/hooks/useOnAppLaunch.ts +++ b/hooks/useOnAppLaunch.ts @@ -1,7 +1,7 @@ -import { useCallback, useContext } from 'react'; +import { useCallback } from 'react'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import { BlueStorageContext } from '../blue_modules/storage-context'; import { TWallet } from '../class/wallets/types'; +import { useStorage } from './context/useStorage'; const useOnAppLaunch = () => { const STORAGE_KEY = 'ONAPP_LAUNCH_SELECTED_DEFAULT_WALLET_KEY'; diff --git a/hooks/usePrivacy.android.tsx b/hooks/usePrivacy.android.tsx index f8c6f81b0..68bc751c2 100644 --- a/hooks/usePrivacy.android.tsx +++ b/hooks/usePrivacy.android.tsx @@ -1,7 +1,7 @@ import { useEffect, useCallback } from 'react'; // @ts-ignore: react-native-obscure is not in the type definition import Obscure from 'react-native-obscure'; -import { useSettings } from '../components/Context/SettingsContext'; +import { useSettings } from './context/useSettings'; export const usePrivacy = () => { const { isPrivacyBlurEnabled } = useSettings(); diff --git a/hooks/usePrivacy.ios.tsx b/hooks/usePrivacy.ios.tsx index f2812880f..f9342cb2d 100644 --- a/hooks/usePrivacy.ios.tsx +++ b/hooks/usePrivacy.ios.tsx @@ -1,7 +1,7 @@ import { useEffect, useCallback } from 'react'; // @ts-ignore: react-native-obscure is not in the type definition import { enabled } from 'react-native-privacy-snapshot'; -import { useSettings } from '../components/Context/SettingsContext'; +import { useSettings } from './context/useSettings'; export const usePrivacy = () => { const { isPrivacyBlurEnabled } = useSettings(); diff --git a/navigation/LazyLoadSendDetailsStack.tsx b/navigation/LazyLoadSendDetailsStack.tsx index f06199696..e26984306 100644 --- a/navigation/LazyLoadSendDetailsStack.tsx +++ b/navigation/LazyLoadSendDetailsStack.tsx @@ -2,7 +2,7 @@ import React, { lazy, Suspense } from 'react'; import { LazyLoadingIndicator } from './LazyLoadingIndicator'; -const SendDetails = lazy(() => import('../screen/send/details')); +const SendDetails = lazy(() => import('../screen/send/SendDetails')); const Confirm = lazy(() => import('../screen/send/Confirm')); const PsbtWithHardwareWallet = lazy(() => import('../screen/send/psbtWithHardwareWallet')); const CreateTransaction = lazy(() => import('../screen/send/create')); diff --git a/navigation/MasterView.tsx b/navigation/MasterView.tsx index e7581c1d7..18212ef14 100644 --- a/navigation/MasterView.tsx +++ b/navigation/MasterView.tsx @@ -1,9 +1,8 @@ import 'react-native-gesture-handler'; // should be on top import React, { lazy, Suspense } from 'react'; - -import { useStorage } from '../blue_modules/storage-context'; import MainRoot from '../navigation'; +import { useStorage } from '../hooks/context/useStorage'; const CompanionDelegates = lazy(() => import('../components/CompanionDelegates')); const MasterView = () => { diff --git a/navigation/index.tsx b/navigation/index.tsx index f9d3d872c..e8f9f1443 100644 --- a/navigation/index.tsx +++ b/navigation/index.tsx @@ -1,11 +1,10 @@ import { createNativeStackNavigator, NativeStackNavigationOptions } from '@react-navigation/native-stack'; import React, { lazy, Suspense } from 'react'; - import { isHandset } from '../blue_modules/environment'; -import { useStorage } from '../blue_modules/storage-context'; import UnlockWith from '../screen/UnlockWith'; import { LazyLoadingIndicator } from './LazyLoadingIndicator'; import { DetailViewStackParamList } from './DetailViewStackParamList'; +import { useStorage } from '../hooks/context/useStorage'; const DetailViewScreensStack = lazy(() => import('./DetailViewScreensStack')); const DrawerRoot = lazy(() => import('./DrawerRoot')); diff --git a/screen/PlausibleDeniability.tsx b/screen/PlausibleDeniability.tsx index 3cdd6e140..6d6074d09 100644 --- a/screen/PlausibleDeniability.tsx +++ b/screen/PlausibleDeniability.tsx @@ -1,15 +1,14 @@ import { useNavigation } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; -import React, { useContext, useReducer } from 'react'; +import React, { useReducer } from 'react'; import { ScrollView } from 'react-native'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../blue_modules/storage-context'; import { BlueCard, BlueLoading, BlueSpacing20, BlueText } from '../BlueComponents'; import presentAlert from '../components/Alert'; import Button from '../components/Button'; import prompt from '../helpers/prompt'; import loc from '../loc'; +import { useStorage } from '../hooks/context/useStorage'; // Action Types const SET_LOADING = 'SET_LOADING'; diff --git a/screen/UnlockWith.tsx b/screen/UnlockWith.tsx index 841a35b32..d2b09085a 100644 --- a/screen/UnlockWith.tsx +++ b/screen/UnlockWith.tsx @@ -1,12 +1,12 @@ import React, { useCallback, useEffect, useReducer, useRef } from 'react'; import { ActivityIndicator, Image, StyleSheet, View } from 'react-native'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback'; -import { useStorage } from '../blue_modules/storage-context'; import { BlueTextCentered } from '../BlueComponents'; import Button from '../components/Button'; import SafeArea from '../components/SafeArea'; import { BiometricType, useBiometrics } from '../hooks/useBiometrics'; import loc from '../loc'; +import { useStorage } from '../hooks/context/useStorage'; enum AuthType { Encrypted, diff --git a/screen/lnd/ldkInfo.tsx b/screen/lnd/ldkInfo.tsx index f03ab3133..066a2a198 100644 --- a/screen/lnd/ldkInfo.tsx +++ b/screen/lnd/ldkInfo.tsx @@ -1,9 +1,7 @@ import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'; import { Psbt } from 'bitcoinjs-lib'; -import React, { useContext, useEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { Keyboard, SectionList, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueLoading, BlueSpacing10, BlueSpacing20, BlueTextCentered } from '../../BlueComponents'; import { LightningLdkWallet } from '../../class'; import { TWallet } from '../../class/wallets/types'; @@ -19,6 +17,7 @@ import confirm from '../../helpers/confirm'; import selectWallet from '../../helpers/select-wallet'; import loc, { formatBalance } from '../../loc'; import { Chain } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; const LdkNodeInfoChannelStatus = { ACTIVE: 'Active', INACTIVE: 'Inactive', PENDING: 'PENDING', STATUS: 'status' }; diff --git a/screen/lnd/ldkOpenChannel.tsx b/screen/lnd/ldkOpenChannel.tsx index 752cf743e..765bd999a 100644 --- a/screen/lnd/ldkOpenChannel.tsx +++ b/screen/lnd/ldkOpenChannel.tsx @@ -3,10 +3,8 @@ import BigNumber from 'bignumber.js'; import { Psbt } from 'bitcoinjs-lib'; import React, { useEffect, useRef, useState } from 'react'; import { StyleSheet, View } from 'react-native'; - import { btcToSatoshi, fiatToBTC } from '../../blue_modules/currency'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { useStorage } from '../../blue_modules/storage-context'; import { BlueDismissKeyboardInputAccessory, BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents'; import { HDSegwitBech32Wallet, LightningLdkWallet } from '../../class'; import AddressInput from '../../components/AddressInput'; @@ -19,6 +17,7 @@ import { useTheme } from '../../components/themes'; import { useBiometrics } from '../../hooks/useBiometrics'; import loc from '../../loc'; import { BitcoinUnit } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; type LdkOpenChannelProps = RouteProp< { diff --git a/screen/lnd/lndCreateInvoice.js b/screen/lnd/lndCreateInvoice.js index eb879d082..549892d98 100644 --- a/screen/lnd/lndCreateInvoice.js +++ b/screen/lnd/lndCreateInvoice.js @@ -1,5 +1,5 @@ +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect, useRef, useState } from 'react'; import { ActivityIndicator, I18nManager, @@ -16,11 +16,9 @@ import { } from 'react-native'; import { Icon } from 'react-native-elements'; import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api - import { btcToSatoshi, fiatToBTC, satoshiToBTC } from '../../blue_modules/currency'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; import Notifications from '../../blue_modules/notifications'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueDismissKeyboardInputAccessory, BlueLoading } from '../../BlueComponents'; import Lnurl from '../../class/lnurl'; import presentAlert from '../../components/Alert'; @@ -32,6 +30,7 @@ import { requestCameraAuthorization } from '../../helpers/scan-qr'; import loc, { formatBalance, formatBalancePlain, formatBalanceWithoutSuffix } from '../../loc'; import { BitcoinUnit, Chain } from '../../models/bitcoinUnits'; import * as NavigationService from '../../NavigationService'; +import { useStorage } from '../../hooks/context/useStorage'; const LNDCreateInvoice = () => { const { wallets, saveToDisk, setSelectedWalletID } = useStorage(); diff --git a/screen/lnd/lndViewAdditionalInvoiceInformation.js b/screen/lnd/lndViewAdditionalInvoiceInformation.js index f0489096e..44ed18b7d 100644 --- a/screen/lnd/lndViewAdditionalInvoiceInformation.js +++ b/screen/lnd/lndViewAdditionalInvoiceInformation.js @@ -1,8 +1,6 @@ import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Share, StyleSheet, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents'; import presentAlert from '../../components/Alert'; import Button from '../../components/Button'; @@ -11,6 +9,7 @@ import QRCodeComponent from '../../components/QRCodeComponent'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const LNDViewAdditionalInvoiceInformation = () => { const { walletID } = useRoute().params; diff --git a/screen/lnd/lndViewInvoice.js b/screen/lnd/lndViewInvoice.js index a8c45b625..4e3da91dc 100644 --- a/screen/lnd/lndViewInvoice.js +++ b/screen/lnd/lndViewInvoice.js @@ -1,11 +1,9 @@ -import { useNavigation, useNavigationState, useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; +import { useNavigationState, useRoute } from '@react-navigation/native'; import { BackHandler, I18nManager, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { Icon } from 'react-native-elements'; import Share from 'react-native-share'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueLoading, BlueSpacing20, BlueText, BlueTextCentered } from '../../BlueComponents'; import Button from '../../components/Button'; import CopyTextToClipboard from '../../components/CopyTextToClipboard'; @@ -16,13 +14,15 @@ import loc from '../../loc'; import { BitcoinUnit } from '../../models/bitcoinUnits'; import { SuccessView } from '../send/success'; import LNDCreateInvoice from './lndCreateInvoice'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; const LNDViewInvoice = () => { const { invoice, walletID } = useRoute().params; const { wallets, setSelectedWalletID, fetchAndSaveWalletTransactions } = useStorage(); const wallet = wallets.find(w => w.getID() === walletID); const { colors, closeImage } = useTheme(); - const { goBack, navigate, setParams, setOptions, getParent } = useNavigation(); + const { goBack, navigate, setParams, setOptions, getParent } = useExtendedNavigation(); const [isLoading, setIsLoading] = useState(typeof invoice === 'string'); const [isFetchingInvoices, setIsFetchingInvoices] = useState(true); const [invoiceStatusChanged, setInvoiceStatusChanged] = useState(false); diff --git a/screen/lnd/lnurlAuth.js b/screen/lnd/lnurlAuth.js index 1500c110e..ebe25ba7f 100644 --- a/screen/lnd/lnurlAuth.js +++ b/screen/lnd/lnurlAuth.js @@ -1,10 +1,8 @@ import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useMemo, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { I18nManager, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { Icon } from 'react-native-elements'; import URL from 'url'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueCard, BlueLoading, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents'; import Lnurl from '../../class/lnurl'; import Button from '../../components/Button'; @@ -15,6 +13,7 @@ import selectWallet from '../../helpers/select-wallet'; import loc from '../../loc'; import { Chain } from '../../models/bitcoinUnits'; import { SuccessView } from '../send/success'; +import { useStorage } from '../../hooks/context/useStorage'; const AuthState = { USER_PROMPT: 0, diff --git a/screen/receive/details.js b/screen/receive/details.js index a69c36c72..4371228f6 100644 --- a/screen/receive/details.js +++ b/screen/receive/details.js @@ -1,5 +1,5 @@ import { useFocusEffect, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { BackHandler, InteractionManager, @@ -17,7 +17,6 @@ import * as BlueElectrum from '../../blue_modules/BlueElectrum'; import { fiatToBTC, satoshiToBTC } from '../../blue_modules/currency'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; import Notifications from '../../blue_modules/notifications'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueButtonLink, BlueCard, BlueLoading, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents'; import DeeplinkSchemaMatch from '../../class/deeplink-schema-match'; import AmountInput from '../../components/AmountInput'; @@ -32,6 +31,7 @@ import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import loc, { formatBalance } from '../../loc'; import { BitcoinUnit, Chain } from '../../models/bitcoinUnits'; import { SuccessView } from '../send/success'; +import { useStorage } from '../../hooks/context/useStorage'; const ReceiveDetails = () => { const { walletID, address } = useRoute().params; diff --git a/screen/send/Confirm.tsx b/screen/send/Confirm.tsx index bf0b122d8..b9ef0f3b8 100644 --- a/screen/send/Confirm.tsx +++ b/screen/send/Confirm.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useMemo, useReducer } from 'react'; +import React, { useEffect, useMemo, useReducer } from 'react'; import { ActivityIndicator, FlatList, TouchableOpacity, StyleSheet, Switch, View } from 'react-native'; import { Text } from 'react-native-elements'; import { PayjoinClient } from 'payjoin-client'; @@ -8,7 +8,6 @@ import { BlueText, BlueCard } from '../../BlueComponents'; import { BitcoinUnit } from '../../models/bitcoinUnits'; import loc, { formatBalance, formatBalanceWithoutSuffix } from '../../loc'; import Notifications from '../../blue_modules/notifications'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { useRoute, RouteProp } from '@react-navigation/native'; import presentAlert from '../../components/Alert'; import { useTheme } from '../../components/themes'; @@ -24,6 +23,7 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import { SendDetailsStackParamList } from '../../navigation/SendDetailsStackParamList'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import { ContactList } from '../../class/contact-list'; +import { useStorage } from '../../hooks/context/useStorage'; enum ActionType { SET_LOADING = 'SET_LOADING', diff --git a/screen/send/details.tsx b/screen/send/SendDetails.tsx similarity index 99% rename from screen/send/details.tsx rename to screen/send/SendDetails.tsx index 11d9d1d57..2014c10c6 100644 --- a/screen/send/details.tsx +++ b/screen/send/SendDetails.tsx @@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; import { RouteProp, StackActions, useFocusEffect, useRoute } from '@react-navigation/native'; import BigNumber from 'bignumber.js'; import * as bitcoin from 'bitcoinjs-lib'; -import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { ActivityIndicator, Alert, @@ -29,7 +29,6 @@ import RNFS from 'react-native-fs'; import { btcToSatoshi, fiatToBTC } from '../../blue_modules/currency'; import * as fs from '../../blue_modules/fs'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueDismissKeyboardInputAccessory, BlueLoading, BlueText } from '../../BlueComponents'; import { HDSegwitBech32Wallet, MultisigHDWallet, WatchOnlyWallet } from '../../class'; import DeeplinkSchemaMatch from '../../class/deeplink-schema-match'; @@ -57,6 +56,7 @@ import { SendDetailsStackParamList } from '../../navigation/SendDetailsStackPara import { isTablet } from '../../blue_modules/environment'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import { ContactList } from '../../class/contact-list'; +import { useStorage } from '../../hooks/context/useStorage'; interface IPaymentDestinations { address: string; // btc address or payment code diff --git a/screen/send/coinControl.js b/screen/send/coinControl.js index c5701ec46..fc918941d 100644 --- a/screen/send/coinControl.js +++ b/screen/send/coinControl.js @@ -1,6 +1,6 @@ import { useNavigation, useRoute } from '@react-navigation/native'; import PropTypes from 'prop-types'; -import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { ActivityIndicator, FlatList, @@ -18,9 +18,7 @@ import { } from 'react-native'; import { Avatar, Badge, Icon, ListItem as RNElementsListItem } from 'react-native-elements'; import * as RNLocalize from 'react-native-localize'; - import debounce from '../../blue_modules/debounce'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueSpacing10, BlueSpacing20 } from '../../BlueComponents'; import BottomModal from '../../components/BottomModal'; import Button from '../../components/Button'; @@ -30,6 +28,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc, { formatBalance } from '../../loc'; import { BitcoinUnit } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; const FrozenBadge = () => { const { colors } = useTheme(); diff --git a/screen/send/psbtMultisig.js b/screen/send/psbtMultisig.js index 080cb1dcb..15bb02abd 100644 --- a/screen/send/psbtMultisig.js +++ b/screen/send/psbtMultisig.js @@ -1,12 +1,11 @@ -import { useNavigation, useRoute } from '@react-navigation/native'; +import React, { useEffect, useState } from 'react'; +import { useRoute } from '@react-navigation/native'; import BigNumber from 'bignumber.js'; import * as bitcoin from 'bitcoinjs-lib'; -import React, { useContext, useEffect, useState } from 'react'; import { FlatList, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { Icon } from 'react-native-elements'; import { satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueCard, BlueText } from '../../BlueComponents'; import presentAlert from '../../components/Alert'; import Button from '../../components/Button'; @@ -14,6 +13,8 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc from '../../loc'; import { BitcoinUnit } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; const shortenAddress = addr => { return addr.substr(0, Math.floor(addr.length / 2) - 1) + '\n' + addr.substr(Math.floor(addr.length / 2) - 1, addr.length); @@ -21,7 +22,7 @@ const shortenAddress = addr => { const PsbtMultisig = () => { const { wallets } = useStorage(); - const { navigate, setParams } = useNavigation(); + const { navigate, setParams } = useExtendedNavigation(); const { colors } = useTheme(); const [flatListHeight, setFlatListHeight] = useState(0); const { walletID, psbtBase64, memo, receivedPSBTBase64, launchedBy } = useRoute().params; diff --git a/screen/settings/Currency.tsx b/screen/settings/Currency.tsx index b2ea446fd..dd42b5767 100644 --- a/screen/settings/Currency.tsx +++ b/screen/settings/Currency.tsx @@ -12,12 +12,12 @@ import { } from '../../blue_modules/currency'; import { BlueCard, BlueSpacing10, BlueText } from '../../BlueComponents'; import presentAlert from '../../components/Alert'; -import { useSettings } from '../../components/Context/SettingsContext'; import ListItem from '../../components/ListItem'; import { useTheme } from '../../components/themes'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import loc from '../../loc'; import { FiatUnit, FiatUnitSource, FiatUnitType, getFiatRate } from '../../models/fiatUnit'; +import { useSettings } from '../../hooks/context/useSettings'; dayjs.extend(calendar); diff --git a/screen/settings/DefaultView.tsx b/screen/settings/DefaultView.tsx index f512a338d..b20afd87c 100644 --- a/screen/settings/DefaultView.tsx +++ b/screen/settings/DefaultView.tsx @@ -2,13 +2,12 @@ import { useNavigation } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import React, { useEffect, useReducer } from 'react'; import { ScrollView, TouchableWithoutFeedback, View } from 'react-native'; - -import { useStorage } from '../../blue_modules/storage-context'; import { BlueCard, BlueText } from '../../BlueComponents'; import { TWallet } from '../../class/wallets/types'; import ListItem from '../../components/ListItem'; import useOnAppLaunch from '../../hooks/useOnAppLaunch'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; type RootStackParamList = { SelectWallet: { onWalletSelect: (wallet: TWallet) => void; onChainRequireSend: boolean }; diff --git a/screen/settings/EncryptStorage.tsx b/screen/settings/EncryptStorage.tsx index 2f2e46652..8b041ee22 100644 --- a/screen/settings/EncryptStorage.tsx +++ b/screen/settings/EncryptStorage.tsx @@ -3,7 +3,6 @@ import { Alert, Platform, ScrollView, StyleSheet, Text, TouchableOpacity, Toucha import { StackActions } from '@react-navigation/native'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { useStorage } from '../../blue_modules/storage-context'; import { BlueCard, BlueSpacing20, BlueText } from '../../BlueComponents'; import presentAlert from '../../components/Alert'; import ListItem from '../../components/ListItem'; @@ -12,6 +11,7 @@ import prompt from '../../helpers/prompt'; import { useBiometrics } from '../../hooks/useBiometrics'; import loc from '../../loc'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; +import { useStorage } from '../../hooks/context/useStorage'; enum ActionType { SetLoading = 'SET_LOADING', diff --git a/screen/settings/GeneralSettings.tsx b/screen/settings/GeneralSettings.tsx index 5f6473e5d..fd24fde36 100644 --- a/screen/settings/GeneralSettings.tsx +++ b/screen/settings/GeneralSettings.tsx @@ -1,13 +1,12 @@ import { useNavigation } from '@react-navigation/native'; import React from 'react'; import { Platform, ScrollView, StyleSheet } from 'react-native'; - -import { useStorage } from '../../blue_modules/storage-context'; import { BlueCard, BlueSpacing20, BlueText } from '../../BlueComponents'; -import { useSettings } from '../../components/Context/SettingsContext'; import ListItem, { PressableWrapper } from '../../components/ListItem'; import { useTheme } from '../../components/themes'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useSettings } from '../../hooks/context/useSettings'; const styles = StyleSheet.create({ root: { diff --git a/screen/settings/Language.tsx b/screen/settings/Language.tsx index 09d48c67b..66309b6e6 100644 --- a/screen/settings/Language.tsx +++ b/screen/settings/Language.tsx @@ -1,13 +1,12 @@ import React, { useEffect, useLayoutEffect, useState } from 'react'; import { FlatList, NativeSyntheticEvent, StyleSheet } from 'react-native'; - import presentAlert from '../../components/Alert'; -import { useSettings } from '../../components/Context/SettingsContext'; import ListItem from '../../components/ListItem'; import { useTheme } from '../../components/themes'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import loc from '../../loc'; import { AvailableLanguages, TLanguage } from '../../loc/languages'; +import { useSettings } from '../../hooks/context/useSettings'; const Language = () => { const { setLanguageStorage, language } = useSettings(); diff --git a/screen/settings/Settings.js b/screen/settings/Settings.js index 0e37612e5..87833e54d 100644 --- a/screen/settings/Settings.js +++ b/screen/settings/Settings.js @@ -1,11 +1,10 @@ import React from 'react'; import { Platform, ScrollView, StyleSheet } from 'react-native'; - -import { useSettings } from '../../components/Context/SettingsContext'; import { Header } from '../../components/Header'; import ListItem from '../../components/ListItem'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import loc from '../../loc'; +import { useSettings } from '../../hooks/context/useSettings'; const styles = StyleSheet.create({ root: { diff --git a/screen/settings/SettingsPrivacy.tsx b/screen/settings/SettingsPrivacy.tsx index a92e009e3..819858fcf 100644 --- a/screen/settings/SettingsPrivacy.tsx +++ b/screen/settings/SettingsPrivacy.tsx @@ -1,16 +1,15 @@ -import React, { useContext, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Platform, Pressable, ScrollView, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native'; import { openSettings } from 'react-native-permissions'; - import A from '../../blue_modules/analytics'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueCard, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents'; -import { useSettings } from '../../components/Context/SettingsContext'; import { Header } from '../../components/Header'; import ListItem from '../../components/ListItem'; import { useTheme } from '../../components/themes'; import { setBalanceDisplayAllowed } from '../../components/WidgetCommunication'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useSettings } from '../../hooks/context/useSettings'; enum SettingsPrivacySection { None, diff --git a/screen/settings/about.js b/screen/settings/about.js index b39aa6142..23e4915ad 100644 --- a/screen/settings/about.js +++ b/screen/settings/about.js @@ -1,13 +1,10 @@ +import React from 'react'; import Clipboard from '@react-native-clipboard/clipboard'; -import { useNavigation } from '@react-navigation/native'; -import React, { useContext } from 'react'; import { Alert, Image, Linking, Platform, ScrollView, StyleSheet, Text, TouchableOpacity, useWindowDimensions, View } from 'react-native'; import { getApplicationName, getBuildNumber, getBundleId, getUniqueIdSync, getVersion, hasGmsSync } from 'react-native-device-info'; import { Icon } from 'react-native-elements'; import Rate, { AndroidMarket } from 'react-native-rate'; - import A from '../../blue_modules/analytics'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueCard, BlueSpacing20, BlueTextCentered } from '../../BlueComponents'; import { HDSegwitBech32Wallet } from '../../class'; import presentAlert from '../../components/Alert'; @@ -15,11 +12,13 @@ import Button from '../../components/Button'; import ListItem from '../../components/ListItem'; import { useTheme } from '../../components/themes'; import loc, { formatStringAddTwoWhiteSpaces } from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; const branch = require('../../current-branch.json'); const About = () => { - const { navigate } = useNavigation(); + const { navigate } = useExtendedNavigation(); const { colors } = useTheme(); const { width, height } = useWindowDimensions(); const { isElectrumDisabled } = useStorage(); diff --git a/screen/transactions/TransactionDetails.tsx b/screen/transactions/TransactionDetails.tsx index d7476b1c7..530e5b3f5 100644 --- a/screen/transactions/TransactionDetails.tsx +++ b/screen/transactions/TransactionDetails.tsx @@ -1,13 +1,11 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import Clipboard from '@react-native-clipboard/clipboard'; import { RouteProp, useFocusEffect, useRoute } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import assert from 'assert'; import dayjs from 'dayjs'; -import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { InteractionManager, Keyboard, Linking, ScrollView, StyleSheet, Text, TextInput, View } from 'react-native'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueCard, BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents'; import { Transaction, TWallet } from '../../class/wallets/types'; import presentAlert from '../../components/Alert'; @@ -20,6 +18,7 @@ import ToolTipMenu from '../../components/TooltipMenu'; import loc from '../../loc'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamList'; +import { useStorage } from '../../hooks/context/useStorage'; interface TransactionDetailsProps { route: RouteProp<{ params: { hash: string; walletID: string } }, 'params'>; diff --git a/screen/transactions/TransactionStatus.tsx b/screen/transactions/TransactionStatus.tsx index 90a341901..6be28aa00 100644 --- a/screen/transactions/TransactionStatus.tsx +++ b/screen/transactions/TransactionStatus.tsx @@ -3,10 +3,8 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import React, { useEffect, useLayoutEffect, useReducer, useRef } from 'react'; import { ActivityIndicator, BackHandler, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { Icon } from 'react-native-elements'; - import * as BlueElectrum from '../../blue_modules/BlueElectrum'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { useStorage } from '../../blue_modules/storage-context'; import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText } from '../../BlueComponents'; import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class'; import { Transaction } from '../../class/wallets/types'; @@ -19,6 +17,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc, { formatBalanceWithoutSuffix } from '../../loc'; import { BitcoinUnit } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; enum ButtonStatus { Possible, diff --git a/screen/wallets/Add.tsx b/screen/wallets/Add.tsx index 00b6060a9..59090dbf8 100644 --- a/screen/wallets/Add.tsx +++ b/screen/wallets/Add.tsx @@ -1,6 +1,6 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; import { useNavigation } from '@react-navigation/native'; -import React, { useContext, useEffect, useReducer } from 'react'; +import React, { useEffect, useReducer } from 'react'; import { ActivityIndicator, Keyboard, @@ -17,7 +17,6 @@ import { import A from '../../blue_modules/analytics'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueButtonLink, BlueFormLabel, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents'; import { BlueApp, @@ -29,13 +28,14 @@ import { } from '../../class'; import presentAlert from '../../components/Alert'; import Button from '../../components/Button'; -import { useSettings } from '../../components/Context/SettingsContext'; import { LdkButton } from '../../components/LdkButton'; import ListItem from '../../components/ListItem'; import { useTheme } from '../../components/themes'; import WalletButton from '../../components/WalletButton'; import loc from '../../loc'; import { Chain } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useSettings } from '../../hooks/context/useSettings'; enum ButtonSelected { // @ts-ignore: Return later to update @@ -123,7 +123,7 @@ const WalletsAdd: React.FC = () => { const entropyButtonText = state.entropyButtonText; // const colorScheme = useColorScheme(); - const { addWallet, saveToDisk, wallets } = useContext(BlueStorageContext); + const { addWallet, saveToDisk, wallets } = useStorage(); const { isAdvancedModeEnabled } = useSettings(); const { navigate, goBack, setOptions } = useNavigation(); const stylesHook = { diff --git a/screen/wallets/DrawerList.tsx b/screen/wallets/DrawerList.tsx index 134c13208..f16e91ac6 100644 --- a/screen/wallets/DrawerList.tsx +++ b/screen/wallets/DrawerList.tsx @@ -1,15 +1,15 @@ import { DrawerContentScrollView } from '@react-navigation/drawer'; import { NavigationProp, ParamListBase, useIsFocused } from '@react-navigation/native'; -import React, { memo, useCallback, useContext, useEffect, useMemo, useReducer, useRef } from 'react'; +import React, { memo, useCallback, useEffect, useMemo, useReducer, useRef } from 'react'; import { FlatList, InteractionManager, LayoutAnimation, StyleSheet, ViewStyle } from 'react-native'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { TWallet } from '../../class/wallets/types'; import { Header } from '../../components/Header'; import { useTheme } from '../../components/themes'; import WalletsCarousel from '../../components/WalletsCarousel'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; enum WalletActionType { SetWallets = 'SET_WALLETS', diff --git a/screen/wallets/ExportMultisigCoordinationSetup.tsx b/screen/wallets/ExportMultisigCoordinationSetup.tsx index 0235e1e3b..22b121721 100644 --- a/screen/wallets/ExportMultisigCoordinationSetup.tsx +++ b/screen/wallets/ExportMultisigCoordinationSetup.tsx @@ -1,8 +1,6 @@ import { RouteProp, useFocusEffect, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useMemo, useReducer, useRef } from 'react'; +import React, { useCallback, useMemo, useReducer, useRef } from 'react'; import { ActivityIndicator, InteractionManager, ScrollView, StyleSheet, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueSpacing20, BlueText } from '../../BlueComponents'; import { TWallet } from '../../class/wallets/types'; import { DynamicQRCode } from '../../components/DynamicQRCode'; @@ -11,6 +9,7 @@ import { SquareButton } from '../../components/SquareButton'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; type RootStackParamList = { ExportMultisigCoordinationSetup: { diff --git a/screen/wallets/PaymentCodesList.tsx b/screen/wallets/PaymentCodesList.tsx index da188c892..3c2c9680f 100644 --- a/screen/wallets/PaymentCodesList.tsx +++ b/screen/wallets/PaymentCodesList.tsx @@ -1,14 +1,12 @@ +import React, { useEffect, useMemo, useState } from 'react'; import Clipboard from '@react-native-clipboard/clipboard'; import { RouteProp, useRoute } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import assert from 'assert'; import createHash from 'create-hash'; -import React, { useEffect, useMemo, useState } from 'react'; import { SectionList, StyleSheet, Text, View } from 'react-native'; - import * as BlueElectrum from '../../blue_modules/BlueElectrum'; import { satoshiToLocalCurrency } from '../../blue_modules/currency'; -import { useStorage } from '../../blue_modules/storage-context'; import { BlueButtonLink, BlueLoading } from '../../BlueComponents'; import { HDSegwitBech32Wallet } from '../../class'; import { ContactList } from '../../class/contact-list'; @@ -25,6 +23,7 @@ import { BitcoinUnit } from '../../models/bitcoinUnits'; import { PaymentCodeStackParamList } from '../../navigation/PaymentCodeStack'; import SafeArea from '../../components/SafeArea'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; +import { useStorage } from '../../hooks/context/useStorage'; interface DataSection { title: string; diff --git a/screen/wallets/PleaseBackup.tsx b/screen/wallets/PleaseBackup.tsx index 25ed9f129..98e445cdf 100644 --- a/screen/wallets/PleaseBackup.tsx +++ b/screen/wallets/PleaseBackup.tsx @@ -1,12 +1,11 @@ -import { useNavigation, useRoute } from '@react-navigation/native'; import React, { useCallback, useEffect } from 'react'; +import { useNavigation, useRoute } from '@react-navigation/native'; import { BackHandler, I18nManager, ScrollView, StyleSheet, Text, View } from 'react-native'; - -import { useStorage } from '../../blue_modules/storage-context'; import Button from '../../components/Button'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const PleaseBackup: React.FC = () => { const { wallets } = useStorage(); diff --git a/screen/wallets/ViewEditMultisigCosigners.tsx b/screen/wallets/ViewEditMultisigCosigners.tsx index 8bedb8b3a..16402eaba 100644 --- a/screen/wallets/ViewEditMultisigCosigners.tsx +++ b/screen/wallets/ViewEditMultisigCosigners.tsx @@ -1,5 +1,5 @@ -import { useFocusEffect, useRoute } from '@react-navigation/native'; import React, { useCallback, useRef, useState } from 'react'; +import { useFocusEffect, useRoute } from '@react-navigation/native'; import { ActivityIndicator, Alert, @@ -17,9 +17,7 @@ import { View, } from 'react-native'; import { Badge, Icon } from 'react-native-elements'; - import { isDesktop, isTablet } from '../../blue_modules/environment'; -import { useStorage } from '../../blue_modules/storage-context'; import { encodeUR } from '../../blue_modules/ur'; import { BlueButtonLink, @@ -35,7 +33,6 @@ import { HDSegwitBech32Wallet, MultisigCosigner, MultisigHDWallet } from '../../ import presentAlert from '../../components/Alert'; import BottomModal from '../../components/BottomModal'; import Button from '../../components/Button'; -import { useSettings } from '../../components/Context/SettingsContext'; import MultipleStepsListItem, { MultipleStepsListItemButtohType, MultipleStepsListItemDashType, @@ -52,6 +49,8 @@ import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; import ActionSheet from '../ActionSheet'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useSettings } from '../../hooks/context/useSettings'; const ViewEditMultisigCosigners: React.FC = () => { const hasLoaded = useRef(false); diff --git a/screen/wallets/WalletsList.tsx b/screen/wallets/WalletsList.tsx index f629ee9e3..55707529b 100644 --- a/screen/wallets/WalletsList.tsx +++ b/screen/wallets/WalletsList.tsx @@ -1,13 +1,11 @@ -import { useFocusEffect, useIsFocused, useRoute } from '@react-navigation/native'; import React, { useCallback, useEffect, useReducer, useRef } from 'react'; +import { useFocusEffect, useIsFocused, useRoute } from '@react-navigation/native'; import { findNodeHandle, Image, InteractionManager, SectionList, StyleSheet, Text, useWindowDimensions, View } from 'react-native'; - import A from '../../blue_modules/analytics'; import BlueClipboard from '../../blue_modules/clipboard'; import { isDesktop } from '../../blue_modules/environment'; import * as fs from '../../blue_modules/fs'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { useStorage } from '../../blue_modules/storage-context'; import DeeplinkSchemaMatch from '../../class/deeplink-schema-match'; import { ExtendedTransaction, Transaction, TWallet } from '../../class/wallets/types'; import presentAlert from '../../components/Alert'; @@ -23,6 +21,7 @@ import ActionSheet from '../ActionSheet'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamList'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; +import { useStorage } from '../../hooks/context/useStorage'; const WalletsListSections = { CAROUSEL: 'CAROUSEL', TRANSACTIONS: 'TRANSACTIONS' }; diff --git a/screen/wallets/addMultisig.js b/screen/wallets/addMultisig.js index e4829b496..f7e2d8aad 100644 --- a/screen/wallets/addMultisig.js +++ b/screen/wallets/addMultisig.js @@ -8,11 +8,11 @@ import { BlueSpacing20 } from '../../BlueComponents'; import { MultisigHDWallet } from '../../class'; import BottomModal from '../../components/BottomModal'; import Button from '../../components/Button'; -import { useSettings } from '../../components/Context/SettingsContext'; import ListItem from '../../components/ListItem'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc from '../../loc'; +import { useSettings } from '../../hooks/context/useSettings'; const WalletsAddMultisig = () => { const { colors } = useTheme(); diff --git a/screen/wallets/addMultisigStep2.js b/screen/wallets/addMultisigStep2.js index d5c0759fa..8b1a98ae1 100644 --- a/screen/wallets/addMultisigStep2.js +++ b/screen/wallets/addMultisigStep2.js @@ -1,5 +1,5 @@ import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { ActivityIndicator, FlatList, @@ -19,14 +19,12 @@ import { Icon } from 'react-native-elements'; import A from '../../blue_modules/analytics'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { encodeUR } from '../../blue_modules/ur'; import { BlueButtonLink, BlueFormMultiInput, BlueSpacing10, BlueSpacing20, BlueText, BlueTextCentered } from '../../BlueComponents'; import { HDSegwitBech32Wallet, MultisigCosigner, MultisigHDWallet } from '../../class'; import presentAlert from '../../components/Alert'; import BottomModal from '../../components/BottomModal'; import Button from '../../components/Button'; -import { useSettings } from '../../components/Context/SettingsContext'; import MultipleStepsListItem, { MultipleStepsListItemButtohType, MultipleStepsListItemDashType, @@ -40,6 +38,8 @@ import prompt from '../../helpers/prompt'; import { scanQrHelper } from '../../helpers/scan-qr'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; +import { useSettings } from '../../hooks/context/useSettings'; const staticCache = {}; diff --git a/screen/wallets/addresses.js b/screen/wallets/addresses.js index 633e92388..8e189fed6 100644 --- a/screen/wallets/addresses.js +++ b/screen/wallets/addresses.js @@ -1,8 +1,6 @@ import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'; import { ActivityIndicator, FlatList, StyleSheet, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { WatchOnlyWallet } from '../../class'; import { AddressItem } from '../../components/addresses/AddressItem'; import { AddressTypeTabs, TABS } from '../../components/addresses/AddressTypeTabs'; @@ -10,6 +8,7 @@ import navigationStyle from '../../components/navigationStyle'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; export const totalBalance = ({ c, u } = { c: 0, u: 0 }) => c + u; diff --git a/screen/wallets/details.js b/screen/wallets/details.js index a8b236746..0036ecc59 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -37,7 +37,6 @@ import { AbstractHDElectrumWallet } from '../../class/wallets/abstract-hd-electr import { LightningCustodianWallet } from '../../class/wallets/lightning-custodian-wallet'; import presentAlert from '../../components/Alert'; import Button from '../../components/Button'; -import { useSettings } from '../../components/Context/SettingsContext'; import HeaderRightButton from '../../components/HeaderRightButton'; import ListItem from '../../components/ListItem'; import SaveFileButton from '../../components/SaveFileButton'; @@ -48,6 +47,7 @@ import { useBiometrics } from '../../hooks/useBiometrics'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import loc, { formatBalanceWithoutSuffix } from '../../loc'; import { BitcoinUnit, Chain } from '../../models/bitcoinUnits'; +import { useSettings } from '../../hooks/context/useSettings'; const styles = StyleSheet.create({ scrollViewContent: { diff --git a/screen/wallets/export.js b/screen/wallets/export.js index 18902bd78..e67ce9cb9 100644 --- a/screen/wallets/export.js +++ b/screen/wallets/export.js @@ -1,8 +1,6 @@ import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { ActivityIndicator, AppState, InteractionManager, ScrollView, StyleSheet, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueCard, BlueSpacing20, BlueText } from '../../BlueComponents'; import { LegacyWallet, LightningCustodianWallet, SegwitBech32Wallet, SegwitP2SHWallet, WatchOnlyWallet } from '../../class'; import CopyTextToClipboard from '../../components/CopyTextToClipboard'; @@ -12,6 +10,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const WalletExport = () => { const { wallets, saveToDisk } = useStorage(); diff --git a/screen/wallets/import.js b/screen/wallets/import.js index 972c80ace..a26022501 100644 --- a/screen/wallets/import.js +++ b/screen/wallets/import.js @@ -11,12 +11,12 @@ import { BlueText, } from '../../BlueComponents'; import Button from '../../components/Button'; -import { useSettings } from '../../components/Context/SettingsContext'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import { requestCameraAuthorization } from '../../helpers/scan-qr'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useSettings } from '../../hooks/context/useSettings'; const WalletsImport = () => { const navigation = useNavigation(); diff --git a/screen/wallets/importCustomDerivationPath.js b/screen/wallets/importCustomDerivationPath.js index f1f2d77d7..70120eddb 100644 --- a/screen/wallets/importCustomDerivationPath.js +++ b/screen/wallets/importCustomDerivationPath.js @@ -1,9 +1,7 @@ import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { FlatList, StyleSheet, TextInput, View } from 'react-native'; - import debounce from '../../blue_modules/debounce'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueFormLabel, BlueSpacing20, BlueTextCentered } from '../../BlueComponents'; import { HDLegacyP2PKHWallet, HDSegwitBech32Wallet, HDSegwitP2SHWallet } from '../../class'; import { validateBip32 } from '../../class/wallet-import'; @@ -13,6 +11,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import WalletToImport from '../../components/WalletToImport'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const WRONG_PATH = 'WRONG_PATH'; const WALLET_FOUND = 'WALLET_FOUND'; diff --git a/screen/wallets/importDiscovery.js b/screen/wallets/importDiscovery.js index 177f05780..b3cba6c72 100644 --- a/screen/wallets/importDiscovery.js +++ b/screen/wallets/importDiscovery.js @@ -1,10 +1,8 @@ -import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; +import { useRoute } from '@react-navigation/native'; import { ActivityIndicator, FlatList, LayoutAnimation, StyleSheet, View } from 'react-native'; import IdleTimerManager from 'react-native-idle-timer'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueButtonLink, BlueFormLabel, BlueSpacing10, BlueSpacing20 } from '../../BlueComponents'; import { HDSegwitBech32Wallet } from '../../class'; import startImport from '../../class/wallet-import'; @@ -15,9 +13,11 @@ import { useTheme } from '../../components/themes'; import WalletToImport from '../../components/WalletToImport'; import prompt from '../../helpers/prompt'; import loc from '../../loc'; +import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; +import { useStorage } from '../../hooks/context/useStorage'; const ImportWalletDiscovery = () => { - const navigation = useNavigation(); + const navigation = useExtendedNavigation(); const { colors } = useTheme(); const route = useRoute(); const { importText, askPassphrase, searchAccounts } = route.params; diff --git a/screen/wallets/importSpeed.js b/screen/wallets/importSpeed.js index 4304c98a0..cb054c51e 100644 --- a/screen/wallets/importSpeed.js +++ b/screen/wallets/importSpeed.js @@ -1,14 +1,13 @@ import { useNavigation } from '@react-navigation/native'; -import React, { useContext, useState } from 'react'; +import React, { useState } from 'react'; import { ActivityIndicator, StyleSheet, TextInput, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueFormLabel, BlueFormMultiInput, BlueSpacing20 } from '../../BlueComponents'; import { HDSegwitBech32Wallet, WatchOnlyWallet } from '../../class'; import presentAlert from '../../components/Alert'; import Button from '../../components/Button'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; +import { useStorage } from '../../hooks/context/useStorage'; const WalletsImportWallet = () => { const navigation = useNavigation(); diff --git a/screen/wallets/ldkViewLogs.js b/screen/wallets/ldkViewLogs.js index 038fd9128..f3f47452f 100644 --- a/screen/wallets/ldkViewLogs.js +++ b/screen/wallets/ldkViewLogs.js @@ -1,10 +1,8 @@ import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native'; import { Icon } from 'react-native-elements'; - import * as fs from '../../blue_modules/fs'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents'; import { LightningLdkWallet } from '../../class'; import presentAlert from '../../components/Alert'; @@ -12,6 +10,7 @@ import navigationStyle from '../../components/navigationStyle'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const LdkViewLogs = () => { const { colors } = useTheme(); diff --git a/screen/wallets/pleaseBackupLNDHub.js b/screen/wallets/pleaseBackupLNDHub.js index 0459209db..f20802ddb 100644 --- a/screen/wallets/pleaseBackupLNDHub.js +++ b/screen/wallets/pleaseBackupLNDHub.js @@ -1,8 +1,6 @@ import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { BackHandler, ScrollView, StyleSheet, View } from 'react-native'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueSpacing20, BlueTextCentered } from '../../BlueComponents'; import Button from '../../components/Button'; import CopyTextToClipboard from '../../components/CopyTextToClipboard'; @@ -11,6 +9,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const PleaseBackupLNDHub = () => { const { wallets } = useStorage(); diff --git a/screen/wallets/pleaseBackupLdk.js b/screen/wallets/pleaseBackupLdk.js index 88746be5b..336541bc9 100644 --- a/screen/wallets/pleaseBackupLdk.js +++ b/screen/wallets/pleaseBackupLdk.js @@ -1,9 +1,7 @@ +import React, { useCallback, useEffect } from 'react'; import { useNavigation, useRoute } from '@react-navigation/native'; -import React, { useCallback, useContext, useEffect } from 'react'; import { BackHandler, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native'; import QRCode from 'react-native-qrcode-svg'; - -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueSpacing20, BlueTextCentered } from '../../BlueComponents'; import Button from '../../components/Button'; import CopyTextToClipboard from '../../components/CopyTextToClipboard'; @@ -11,6 +9,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const PleaseBackupLdk = () => { const { wallets } = useStorage(); diff --git a/screen/wallets/reorderWallets.js b/screen/wallets/reorderWallets.js index 8e199e415..28cb29c87 100644 --- a/screen/wallets/reorderWallets.js +++ b/screen/wallets/reorderWallets.js @@ -1,14 +1,13 @@ -import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'; +import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'; import { Platform, StyleSheet, useColorScheme } from 'react-native'; import DraggableFlatList, { ScaleDecorator } from 'react-native-draggable-flatlist'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { useTheme } from '../../components/themes'; import { WalletCarouselItem } from '../../components/WalletsCarousel'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const styles = StyleSheet.create({ root: { diff --git a/screen/wallets/selectWallet.js b/screen/wallets/selectWallet.js index b47c30c11..78f67358a 100644 --- a/screen/wallets/selectWallet.js +++ b/screen/wallets/selectWallet.js @@ -1,10 +1,8 @@ import { useNavigation, useNavigationState, useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { ActivityIndicator, FlatList, I18nManager, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueSpacing20, BlueText } from '../../BlueComponents'; import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet } from '../../class'; import WalletGradient from '../../class/wallet-gradient'; @@ -13,6 +11,7 @@ import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc, { formatBalance, transactionTimeToReadable } from '../../loc'; import { Chain } from '../../models/bitcoinUnits'; +import { useStorage } from '../../hooks/context/useStorage'; const SelectWallet = () => { const { chainType, onWalletSelect, availableWallets, noWalletExplanationText, onChainRequireSend = false } = useRoute().params; diff --git a/screen/wallets/signVerify.js b/screen/wallets/signVerify.js index 37eedcc42..b25dee6f7 100644 --- a/screen/wallets/signVerify.js +++ b/screen/wallets/signVerify.js @@ -1,5 +1,5 @@ +import React, { useEffect, useState } from 'react'; import { useRoute } from '@react-navigation/native'; -import React, { useContext, useEffect, useState } from 'react'; import { ActivityIndicator, Keyboard, @@ -13,15 +13,14 @@ import { } from 'react-native'; import { Icon } from 'react-native-elements'; import Share from 'react-native-share'; - import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; -import { BlueStorageContext } from '../../blue_modules/storage-context'; import { BlueDoneAndDismissKeyboardInputAccessory, BlueFormLabel, BlueSpacing10, BlueSpacing20, BlueSpacing40 } from '../../BlueComponents'; import presentAlert from '../../components/Alert'; import { FButton, FContainer } from '../../components/FloatButtons'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import loc from '../../loc'; +import { useStorage } from '../../hooks/context/useStorage'; const SignVerify = () => { const { colors } = useTheme();