mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 06:52:41 +01:00
commit
826bea9de8
81 changed files with 231 additions and 276 deletions
9
App.tsx
9
App.tsx
|
@ -4,13 +4,12 @@ import { NavigationContainer } from '@react-navigation/native';
|
|||
import React from 'react';
|
||||
import { useColorScheme } from 'react-native';
|
||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||
|
||||
import { BlueStorageProvider } from './blue_modules/storage-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 { StorageProvider } from './components/Context/StorageProvider';
|
||||
|
||||
const App = () => {
|
||||
const colorScheme = useColorScheme();
|
||||
|
@ -19,11 +18,11 @@ const App = () => {
|
|||
<LargeScreenProvider>
|
||||
<NavigationContainer ref={navigationRef} theme={colorScheme === 'dark' ? BlueDarkTheme : BlueDefaultTheme}>
|
||||
<SafeAreaProvider>
|
||||
<BlueStorageProvider>
|
||||
<StorageProvider>
|
||||
<SettingsProvider>
|
||||
<MasterView />
|
||||
</SettingsProvider>
|
||||
</BlueStorageProvider>
|
||||
</StorageProvider>
|
||||
</SafeAreaProvider>
|
||||
</NavigationContainer>
|
||||
</LargeScreenProvider>
|
||||
|
|
|
@ -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 = () => {
|
||||
|
|
|
@ -9,13 +9,13 @@ import BlueClipboard from '../blue_modules/clipboard';
|
|||
import { updateExchangeRate } from '../blue_modules/currency';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
|
||||
import Notifications from '../blue_modules/notifications';
|
||||
import { useStorage } from '../blue_modules/storage-context';
|
||||
import { LightningCustodianWallet } from '../class';
|
||||
import DeeplinkSchemaMatch from '../class/deeplink-schema-match';
|
||||
import loc from '../loc';
|
||||
import { Chain } from '../models/bitcoinUnits';
|
||||
import { navigationRef } from '../NavigationService';
|
||||
import ActionSheet from '../screen/ActionSheet';
|
||||
import { useStorage } from '../hooks/context/useStorage';
|
||||
|
||||
const MenuElements = lazy(() => import('../components/MenuElements'));
|
||||
const DeviceQuickActions = lazy(() => import('../components/DeviceQuickActions'));
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { useAsyncStorage } from '@react-native-async-storage/async-storage';
|
||||
import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import React, { createContext, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import DefaultPreference from 'react-native-default-preference';
|
||||
|
||||
import BlueClipboard from '../../blue_modules/clipboard';
|
||||
import { getPreferredCurrency, GROUP_IO_BLUEWALLET, initCurrencyDaemon } from '../../blue_modules/currency';
|
||||
import { useStorage } from '../../blue_modules/storage-context';
|
||||
import { clearUseURv1, isURv1Enabled, setUseURv1 } from '../../blue_modules/ur';
|
||||
import { BlueApp } from '../../class';
|
||||
import { saveLanguage, STORAGE_KEY } from '../../loc';
|
||||
|
@ -13,6 +11,7 @@ import { getEnabled as getIsDeviceQuickActionsEnabled, setEnabled as setIsDevice
|
|||
import presentAlert from '../Alert';
|
||||
import { getIsHandOffUseEnabled, setIsHandOffUseEnabled } from '../HandOffComponent';
|
||||
import { isBalanceDisplayAllowed, setBalanceDisplayAllowed } from '../WidgetCommunication';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
|
||||
interface SettingsContextType {
|
||||
preferredFiatCurrency: TFiatUnit;
|
||||
|
@ -86,7 +85,6 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
|
|||
|
||||
const advancedModeStorage = useAsyncStorage(BlueApp.ADVANCED_MODE_ENABLED);
|
||||
const languageStorage = useAsyncStorage(STORAGE_KEY);
|
||||
|
||||
const { walletsInitialized } = useStorage();
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -283,5 +281,3 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
|
|||
|
||||
return <SettingsContext.Provider value={value}>{children}</SettingsContext.Provider>;
|
||||
};
|
||||
|
||||
export const useSettings = () => useContext(SettingsContext);
|
|
@ -1,22 +1,21 @@
|
|||
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import React, { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { InteractionManager } from 'react-native';
|
||||
|
||||
import A from '../blue_modules/analytics';
|
||||
import Notifications from '../blue_modules/notifications';
|
||||
import { BlueApp as BlueAppClass, LegacyWallet, TCounterpartyMetadata, TTXMetadata, WatchOnlyWallet } from '../class';
|
||||
import type { TWallet } from '../class/wallets/types';
|
||||
import presentAlert from '../components/Alert';
|
||||
import loc from '../loc';
|
||||
import * as BlueElectrum from './BlueElectrum';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from './hapticFeedback';
|
||||
import { startAndDecrypt } from './start-and-decrypt';
|
||||
import A from '../../blue_modules/analytics';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import { BlueApp as BlueAppClass, LegacyWallet, TCounterpartyMetadata, TTXMetadata, WatchOnlyWallet } from '../../class';
|
||||
import type { TWallet } from '../../class/wallets/types';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import loc from '../../loc';
|
||||
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { startAndDecrypt } from '../../blue_modules/start-and-decrypt';
|
||||
|
||||
const BlueApp = BlueAppClass.getInstance();
|
||||
|
||||
// hashmap of timestamps we _started_ refetching some wallet
|
||||
const _lastTimeTriedToRefetchWallet: { [walletID: string]: number } = {};
|
||||
|
||||
interface BlueStorageContextType {
|
||||
interface StorageContextType {
|
||||
wallets: TWallet[];
|
||||
setWalletsWithNewOrder: (wallets: TWallet[]) => void;
|
||||
txMetadata: TTXMetadata;
|
||||
|
@ -61,8 +60,8 @@ export enum WalletTransactionsStatus {
|
|||
ALL = 'ALL',
|
||||
}
|
||||
// @ts-ignore defaut value does not match the type
|
||||
export const BlueStorageContext = createContext<BlueStorageContextType>(undefined);
|
||||
export const BlueStorageProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
export const StorageContext = createContext<StorageContextType>(undefined);
|
||||
export const StorageProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const txMetadata = useRef<TTXMetadata>(BlueApp.tx_metadata);
|
||||
const counterpartyMetadata = useRef<TCounterpartyMetadata>(BlueApp.counterparty_metadata || {}); // init
|
||||
const getTransactions = BlueApp.getTransactions;
|
||||
|
@ -232,7 +231,7 @@ export const BlueStorageProvider = ({ children }: { children: React.ReactNode })
|
|||
[addWallet, saveToDisk, wallets],
|
||||
);
|
||||
|
||||
const value: BlueStorageContextType = useMemo(
|
||||
const value: StorageContextType = useMemo(
|
||||
() => ({
|
||||
wallets,
|
||||
setWalletsWithNewOrder,
|
||||
|
@ -303,7 +302,5 @@ export const BlueStorageProvider = ({ children }: { children: React.ReactNode })
|
|||
],
|
||||
);
|
||||
|
||||
return <BlueStorageContext.Provider value={value}>{children}</BlueStorageContext.Provider>;
|
||||
return <StorageContext.Provider value={value}>{children}</StorageContext.Provider>;
|
||||
};
|
||||
|
||||
export const useStorage = () => useContext(BlueStorageContext);
|
|
@ -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';
|
||||
|
||||
|
@ -32,7 +31,7 @@ export async function getEnabled(): Promise<boolean> {
|
|||
}
|
||||
|
||||
function DeviceQuickActions() {
|
||||
const { wallets, walletsInitialized, isStorageEncrypted, addWallet, saveToDisk, setSharedCosigner } = useContext(BlueStorageContext);
|
||||
const { wallets, walletsInitialized, isStorageEncrypted, addWallet, saveToDisk, setSharedCosigner } = useStorage();
|
||||
const { preferredFiatCurrency, isQuickActionsEnabled } = useSettings();
|
||||
|
||||
const { isViewAllWalletsEnabled, getSelectedDefaultWallet } = useOnAppLaunch();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,9 +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.
|
||||
|
@ -12,7 +11,7 @@ EventEmitter on the native side should receive a payload and rebuild menus.
|
|||
|
||||
const eventEmitter = Platform.OS === 'ios' || Platform.OS === 'macos' ? new NativeEventEmitter(NativeModules.EventEmitter) : undefined;
|
||||
const MenuElements = () => {
|
||||
const { walletsInitialized, reloadTransactionsMenuActionFunction } = useContext(BlueStorageContext);
|
||||
const { walletsInitialized, reloadTransactionsMenuActionFunction } = useStorage();
|
||||
|
||||
// BlueWallet -> Settings
|
||||
const openSettings = useCallback(() => {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import { Linking, StyleSheet, View } from 'react-native';
|
||||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||
import Lnurl from '../class/lnurl';
|
||||
import { LightningTransaction, Transaction } from '../class/wallets/types';
|
||||
import TransactionExpiredIcon from '../components/icons/TransactionExpiredIcon';
|
||||
|
@ -14,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';
|
||||
|
@ -22,6 +21,7 @@ import { Action, ToolTipMenuProps } from './types';
|
|||
import { useExtendedNavigation } from '../hooks/useExtendedNavigation';
|
||||
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
import { DetailViewStackParamList } from '../navigation/DetailViewStackParamList';
|
||||
import { useStorage } from '../hooks/context/useStorage';
|
||||
|
||||
interface TransactionListItemProps {
|
||||
itemPriceUnit: BitcoinUnit;
|
||||
|
@ -36,7 +36,7 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
|
|||
const { colors } = useTheme();
|
||||
const { navigate } = useExtendedNavigation<NavigationProps>();
|
||||
const menuRef = useRef<ToolTipMenuProps>();
|
||||
const { txMetadata, counterpartyMetadata, wallets } = useContext(BlueStorageContext);
|
||||
const { txMetadata, counterpartyMetadata, wallets } = useStorage();
|
||||
const { preferredFiatCurrency, language } = useSettings();
|
||||
const containerStyle = useMemo(
|
||||
() => ({
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
@ -157,7 +157,7 @@ const iStyles = StyleSheet.create({
|
|||
export const WalletCarouselItem = React.memo(({ item, _, onPress, handleLongPress, isSelectedWallet, customStyle }) => {
|
||||
const scaleValue = new Animated.Value(1.0);
|
||||
const { colors } = useTheme();
|
||||
const { walletTransactionUpdateStatus } = useContext(BlueStorageContext);
|
||||
const { walletTransactionUpdateStatus } = useStorage();
|
||||
const { width } = useWindowDimensions();
|
||||
const itemWidth = width * 0.82 > 375 ? 375 : width * 0.82;
|
||||
const isLargeScreen = useIsLargeScreen();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useContext, useEffect, useRef } from 'react';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import {
|
||||
transferCurrentComplicationUserInfo,
|
||||
transferUserInfo,
|
||||
|
@ -7,17 +7,16 @@ 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 } = useContext(BlueStorageContext);
|
||||
const { walletsInitialized, wallets, fetchWalletTransactions, saveToDisk, txMetadata } = useStorage();
|
||||
const { preferredFiatCurrency } = useSettings();
|
||||
const isReachable = useReachability();
|
||||
const isInstalled = useInstalled(); // true | false
|
||||
|
|
|
@ -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',
|
||||
|
@ -62,7 +61,7 @@ const allWalletsBalanceAndTransactionTime = async (
|
|||
};
|
||||
|
||||
const WidgetCommunication: React.FC = () => {
|
||||
const { wallets, walletsInitialized } = useContext(BlueStorageContext);
|
||||
const { wallets, walletsInitialized } = useStorage();
|
||||
const { isWidgetBalanceDisplayAllowed } = useSettings();
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -5,7 +5,6 @@ import { StyleSheet, Text, View } from 'react-native';
|
|||
import { ListItem } from 'react-native-elements';
|
||||
import Share from 'react-native-share';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { useStorage } from '../../blue_modules/storage-context';
|
||||
import confirm from '../../helpers/confirm';
|
||||
import { useBiometrics } from '../../hooks/useBiometrics';
|
||||
import loc, { formatBalance } from '../../loc';
|
||||
|
@ -18,6 +17,7 @@ import { Action, ToolTipMenuProps } from '../types';
|
|||
import { AddressTypeBadge } from './AddressTypeBadge';
|
||||
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamList';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
|
||||
interface AddressItemProps {
|
||||
// todo: fix `any` after addresses.js is converted to the church of holy typescript
|
||||
|
|
4
hooks/context/useSettings.ts
Normal file
4
hooks/context/useSettings.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { useContext } from 'react';
|
||||
import { SettingsContext } from '../../components/Context/SettingsProvider';
|
||||
|
||||
export const useSettings = () => useContext(SettingsContext);
|
4
hooks/context/useStorage.ts
Normal file
4
hooks/context/useStorage.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { useContext } from 'react';
|
||||
import { StorageContext } from '../../components/Context/StorageProvider';
|
||||
|
||||
export const useStorage = () => useContext(StorageContext);
|
|
@ -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 });
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
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';
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
|
||||
const getSelectedDefaultWallet = useCallback(async (): Promise<string | undefined> => {
|
||||
let selectedWallet: TWallet | undefined;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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 = () => {
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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';
|
||||
|
@ -38,7 +37,7 @@ function reducer(state: State, action: Action): State {
|
|||
|
||||
// Component
|
||||
const PlausibleDeniability: React.FC = () => {
|
||||
const { cachedPassword, isPasswordInUse, createFakeStorage, resetWallets } = useContext(BlueStorageContext);
|
||||
const { cachedPassword, isPasswordInUse, createFakeStorage, resetWallets } = useStorage();
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
const navigation = useNavigation<NativeStackNavigationProp<Record<string, object | undefined>>>();
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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' };
|
||||
|
||||
|
@ -34,7 +33,7 @@ type LdkInfoRouteProps = RouteProp<
|
|||
|
||||
const LdkInfo = () => {
|
||||
const { walletID } = useRoute<LdkInfoRouteProps>().params;
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const refreshDataInterval = useRef<NodeJS.Timer>();
|
||||
const sectionList = useRef<SectionList | null>();
|
||||
const wallet = wallets.find(w => w.getID() === walletID) as LightningLdkWallet;
|
||||
|
|
|
@ -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<
|
||||
{
|
||||
|
|
|
@ -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,9 +30,10 @@ 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 } = useContext(BlueStorageContext);
|
||||
const { wallets, saveToDisk, setSelectedWalletID } = useStorage();
|
||||
const { walletID, uri } = useRoute().params;
|
||||
const wallet = useRef(wallets.find(item => item.getID() === walletID) || wallets.find(item => item.chain === Chain.OFFCHAIN));
|
||||
const createInvoiceRef = useRef();
|
||||
|
|
|
@ -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,10 +9,11 @@ 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;
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
const [walletInfo, setWalletInfo] = useState();
|
||||
const { colors } = useTheme();
|
||||
|
|
|
@ -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 } = useContext(BlueStorageContext);
|
||||
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);
|
||||
|
|
|
@ -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,
|
||||
|
@ -24,7 +23,7 @@ const AuthState = {
|
|||
};
|
||||
|
||||
const LnurlAuth = () => {
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const { name } = useRoute();
|
||||
const { walletID, lnurl } = useRoute().params;
|
||||
const wallet = useMemo(() => wallets.find(w => w.getID() === walletID), [wallets, walletID]);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import { useRoute } from '@react-navigation/native';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { I18nManager, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { Icon } from 'react-native-elements';
|
||||
|
||||
import { btcToSatoshi, fiatToBTC, satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { useStorage } from '../../blue_modules/storage-context';
|
||||
import { BlueCard, BlueDismissKeyboardInputAccessory, BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import Lnurl from '../../class/lnurl';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
@ -18,6 +16,8 @@ import prompt from '../../helpers/prompt';
|
|||
import { useBiometrics } from '../../hooks/useBiometrics';
|
||||
import loc, { formatBalance, formatBalanceWithoutSuffix } from '../../loc';
|
||||
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||
|
||||
/**
|
||||
* if user has default currency - fiat, attempting to pay will trigger conversion from entered in input field fiat value
|
||||
|
@ -37,7 +37,7 @@ const LnurlPay = () => {
|
|||
const [_LN, setLN] = useState();
|
||||
const [payButtonDisabled, setPayButtonDisabled] = useState(true);
|
||||
const [payload, setPayload] = useState();
|
||||
const { setParams, pop, navigate } = useNavigation();
|
||||
const { setParams, pop, navigate } = useExtendedNavigation();
|
||||
const [amount, setAmount] = useState();
|
||||
const { colors } = useTheme();
|
||||
const stylesHook = StyleSheet.create({
|
||||
|
|
|
@ -15,7 +15,6 @@ import { Icon } from 'react-native-elements';
|
|||
|
||||
import { btcToSatoshi, fiatToBTC } from '../../blue_modules/currency';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { useStorage } from '../../blue_modules/storage-context';
|
||||
import { BlueCard, BlueDismissKeyboardInputAccessory, BlueLoading } from '../../BlueComponents';
|
||||
import Lnurl from '../../class/lnurl';
|
||||
import AddressInput from '../../components/AddressInput';
|
||||
|
@ -27,6 +26,7 @@ import { useTheme } from '../../components/themes';
|
|||
import { useBiometrics } from '../../hooks/useBiometrics';
|
||||
import loc, { formatBalanceWithoutSuffix } from '../../loc';
|
||||
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
|
||||
const ScanLndInvoice = () => {
|
||||
const { wallets, fetchAndSaveWalletTransactions } = useStorage();
|
||||
|
|
|
@ -2,13 +2,12 @@ import PropTypes from 'prop-types';
|
|||
import React, { Component } from 'react';
|
||||
import { I18nManager, Keyboard, StyleSheet, Text, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
|
||||
import { Icon } from 'react-native-elements';
|
||||
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { BlueLoading, BlueSpacing, BlueText } from '../../BlueComponents';
|
||||
import Azteco from '../../class/azteco';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import Button from '../../components/Button';
|
||||
import loc from '../../loc';
|
||||
import { StorageContext } from '../../components/Context/StorageProvider';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
loading: {
|
||||
|
@ -51,7 +50,7 @@ const styles = StyleSheet.create({
|
|||
});
|
||||
|
||||
export default class AztecoRedeem extends Component {
|
||||
static contextType = BlueStorageContext;
|
||||
static contextType = StorageContext;
|
||||
state = { isLoading: true };
|
||||
|
||||
constructor(props, context) {
|
||||
|
|
|
@ -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,10 +31,11 @@ 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;
|
||||
const { wallets, saveToDisk, sleep, isElectrumDisabled, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext);
|
||||
const { wallets, saveToDisk, sleep, isElectrumDisabled, fetchAndSaveWalletTransactions } = useStorage();
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
const [customLabel, setCustomLabel] = useState();
|
||||
const [customAmount, setCustomAmount] = useState();
|
||||
|
|
|
@ -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',
|
||||
|
@ -65,7 +65,7 @@ type ConfirmRouteProp = RouteProp<SendDetailsStackParamList, 'Confirm'>;
|
|||
type ConfirmNavigationProp = NativeStackNavigationProp<SendDetailsStackParamList, 'Confirm'>;
|
||||
|
||||
const Confirm: React.FC = () => {
|
||||
const { wallets, fetchAndSaveWalletTransactions, counterpartyMetadata, isElectrumDisabled } = useContext(BlueStorageContext);
|
||||
const { wallets, fetchAndSaveWalletTransactions, counterpartyMetadata, isElectrumDisabled } = useStorage();
|
||||
const { isBiometricUseCapableAndEnabled, unlockWithBiometrics } = useBiometrics();
|
||||
const navigation = useExtendedNavigation<ConfirmNavigationProp>();
|
||||
const route = useRoute<ConfirmRouteProp>(); // Get the route and its params
|
||||
|
|
|
@ -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
|
||||
|
@ -75,7 +75,7 @@ type NavigationProps = NativeStackNavigationProp<SendDetailsStackParamList, 'Sen
|
|||
type RouteProps = RouteProp<SendDetailsStackParamList, 'SendDetails'>;
|
||||
|
||||
const SendDetails = () => {
|
||||
const { wallets, setSelectedWalletID, sleep, txMetadata, saveToDisk } = useContext(BlueStorageContext);
|
||||
const { wallets, setSelectedWalletID, sleep, txMetadata, saveToDisk } = useStorage();
|
||||
const navigation = useExtendedNavigation<NavigationProps>();
|
||||
const route = useRoute<RouteProps>();
|
||||
const name = route.name;
|
|
@ -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();
|
||||
|
@ -62,7 +61,7 @@ const OutputList = ({
|
|||
onDeSelect,
|
||||
}) => {
|
||||
const { colors } = useTheme();
|
||||
const { txMetadata } = useContext(BlueStorageContext);
|
||||
const { txMetadata } = useStorage();
|
||||
const memo = oMemo || txMetadata[txid]?.memo || '';
|
||||
const color = `#${txid.substring(0, 6)}`;
|
||||
const amount = formatBalance(value, balanceUnit, true);
|
||||
|
@ -124,7 +123,7 @@ OutputList.propTypes = {
|
|||
|
||||
const OutputModal = ({ item: { address, txid, value, vout, confirmations = 0 }, balanceUnit = BitcoinUnit.BTC, oMemo }) => {
|
||||
const { colors } = useTheme();
|
||||
const { txMetadata } = useContext(BlueStorageContext);
|
||||
const { txMetadata } = useStorage();
|
||||
const memo = oMemo || txMetadata[txid]?.memo || '';
|
||||
const fullId = `${txid}:${vout}`;
|
||||
const color = `#${txid.substring(0, 6)}`;
|
||||
|
@ -198,7 +197,7 @@ const mStyles = StyleSheet.create({
|
|||
|
||||
const OutputModalContent = ({ output, wallet, onUseCoin, frozen, setFrozen }) => {
|
||||
const { colors } = useTheme();
|
||||
const { txMetadata, saveToDisk } = useContext(BlueStorageContext);
|
||||
const { txMetadata, saveToDisk } = useStorage();
|
||||
const [memo, setMemo] = useState(wallet.getUTXOMetadata(output.txid, output.vout).memo || txMetadata[output.txid]?.memo || '');
|
||||
const onMemoChange = value => setMemo(value);
|
||||
const switchValue = useMemo(() => ({ value: frozen, onValueChange: value => setFrozen(value) }), [frozen, setFrozen]);
|
||||
|
@ -256,7 +255,7 @@ const CoinControl = () => {
|
|||
const navigation = useNavigation();
|
||||
const { width } = useWindowDimensions();
|
||||
const { walletID, onUTXOChoose } = useRoute().params;
|
||||
const { wallets, saveToDisk, sleep } = useContext(BlueStorageContext);
|
||||
const { wallets, saveToDisk, sleep } = useStorage();
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
// sort by height ascending, txid , vout ascending
|
||||
const utxo = wallet.getUtxo(true).sort((a, b) => a.height - b.height || a.txid.localeCompare(b.txid) || a.vout - b.vout);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import React, { useContext, useRef, useState } from 'react';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { useRoute } from '@react-navigation/native';
|
||||
import { Keyboard, KeyboardAvoidingView, Platform, StyleSheet, TextInput, View } from 'react-native';
|
||||
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { BlueButtonLink, BlueCard, BlueSpacing10, BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import Button from '../../components/Button';
|
||||
import navigationStyle from '../../components/navigationStyle';
|
||||
|
@ -10,11 +8,13 @@ import SafeArea from '../../components/SafeArea';
|
|||
import { useTheme } from '../../components/themes';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import loc from '../../loc';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||
|
||||
const IsItMyAddress = () => {
|
||||
/** @type {AbstractWallet[]} */
|
||||
const wallets = useContext(BlueStorageContext).wallets;
|
||||
const { navigate } = useNavigation();
|
||||
const { wallets } = useStorage();
|
||||
const { navigate } = useExtendedNavigation();
|
||||
const { name } = useRoute();
|
||||
const { colors } = useTheme();
|
||||
const scanButtonRef = useRef();
|
||||
|
|
|
@ -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,14 +13,16 @@ 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);
|
||||
};
|
||||
|
||||
const PsbtMultisig = () => {
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { navigate, setParams } = useNavigation();
|
||||
const { wallets } = useStorage();
|
||||
const { navigate, setParams } = useExtendedNavigation();
|
||||
const { colors } = useTheme();
|
||||
const [flatListHeight, setFlatListHeight] = useState(0);
|
||||
const { walletID, psbtBase64, memo, receivedPSBTBase64, launchedBy } = useRoute().params;
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import { useIsFocused, useNavigation, useRoute } from '@react-navigation/native';
|
||||
import { useIsFocused, useRoute } from '@react-navigation/native';
|
||||
import * as bitcoin from 'bitcoinjs-lib';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { ActivityIndicator, Linking, Platform, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import DocumentPicker from 'react-native-document-picker';
|
||||
import RNFS from 'react-native-fs';
|
||||
|
||||
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import { useStorage } from '../../blue_modules/storage-context';
|
||||
import { BlueCard, BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import CopyToClipboardButton from '../../components/CopyToClipboardButton';
|
||||
|
@ -20,12 +18,13 @@ import { useTheme } from '../../components/themes';
|
|||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { useBiometrics } from '../../hooks/useBiometrics';
|
||||
import loc from '../../loc';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||
|
||||
const PsbtWithHardwareWallet = () => {
|
||||
const { txMetadata, fetchAndSaveWalletTransactions, isElectrumDisabled } = useStorage();
|
||||
const { isBiometricUseCapableAndEnabled, unlockWithBiometrics } = useBiometrics();
|
||||
|
||||
const navigation = useNavigation();
|
||||
const navigation = useExtendedNavigation();
|
||||
const route = useRoute();
|
||||
const { fromWallet, memo, psbt, deepLinkPSBT, launchedBy } = route.params;
|
||||
const routeParamsPSBT = useRef(route.params.psbt);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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,
|
||||
|
@ -22,7 +21,7 @@ enum SettingsPrivacySection {
|
|||
|
||||
const SettingsPrivacy: React.FC = () => {
|
||||
const { colors } = useTheme();
|
||||
const { isStorageEncrypted } = useContext(BlueStorageContext);
|
||||
const { isStorageEncrypted } = useStorage();
|
||||
const {
|
||||
isDoNotTrackEnabled,
|
||||
setDoNotTrackStorage,
|
||||
|
|
|
@ -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,14 +12,16 @@ 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 } = useContext(BlueStorageContext);
|
||||
const { isElectrumDisabled } = useStorage();
|
||||
const styles = StyleSheet.create({
|
||||
copyToClipboard: {
|
||||
justifyContent: 'center',
|
||||
|
|
|
@ -16,10 +16,8 @@ import {
|
|||
View,
|
||||
} from 'react-native';
|
||||
import DefaultPreference from 'react-native-default-preference';
|
||||
|
||||
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import {
|
||||
BlueButtonLink,
|
||||
BlueCard,
|
||||
|
@ -36,9 +34,10 @@ import ListItem from '../../components/ListItem';
|
|||
import { BlueCurrentTheme } from '../../components/themes';
|
||||
import { scanQrHelper } from '../../helpers/scan-qr';
|
||||
import loc from '../../loc';
|
||||
import { StorageContext } from '../../components/Context/StorageProvider';
|
||||
|
||||
export default class ElectrumSettings extends Component {
|
||||
static contextType = BlueStorageContext;
|
||||
static contextType = StorageContext;
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const server = props?.route?.params?.server;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
|
@ -12,12 +10,12 @@ import {
|
|||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Text } from 'react-native-elements';
|
||||
|
||||
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { BlueCard, BlueReplaceFeeSuggestions, BlueSpacing, BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
@ -26,6 +24,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import SafeArea from '../../components/SafeArea';
|
||||
import { BlueCurrentTheme } from '../../components/themes';
|
||||
import loc from '../../loc';
|
||||
import { StorageContext } from '../../components/Context/StorageProvider';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
|
@ -67,7 +66,7 @@ const styles = StyleSheet.create({
|
|||
});
|
||||
|
||||
export default class CPFP extends Component {
|
||||
static contextType = BlueStorageContext;
|
||||
static contextType = StorageContext;
|
||||
constructor(props) {
|
||||
super(props);
|
||||
let txid;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ActivityIndicator, ScrollView, StyleSheet, View } from 'react-native';
|
||||
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
@ -10,6 +8,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import SafeArea from '../../components/SafeArea';
|
||||
import loc from '../../loc';
|
||||
import CPFP from './CPFP';
|
||||
import { StorageContext } from '../../components/Context/StorageProvider';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
|
@ -19,7 +18,7 @@ const styles = StyleSheet.create({
|
|||
});
|
||||
|
||||
export default class RBFBumpFee extends CPFP {
|
||||
static contextType = BlueStorageContext;
|
||||
static contextType = StorageContext;
|
||||
|
||||
async componentDidMount() {
|
||||
console.log('transactions/RBFBumpFee - componentDidMount');
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ActivityIndicator, ScrollView, View } from 'react-native';
|
||||
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
@ -10,9 +8,10 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import SafeArea from '../../components/SafeArea';
|
||||
import loc from '../../loc';
|
||||
import CPFP from './CPFP';
|
||||
import { StorageContext } from '../../components/Context/StorageProvider';
|
||||
|
||||
export default class RBFCancel extends CPFP {
|
||||
static contextType = BlueStorageContext;
|
||||
static contextType = StorageContext;
|
||||
async componentDidMount() {
|
||||
console.log('transactions/RBFCancel - componentDidMount');
|
||||
this.setState({
|
||||
|
|
|
@ -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'>;
|
||||
|
@ -69,7 +68,7 @@ type NavigationProps = NativeStackNavigationProp<DetailViewStackParamList, 'Tran
|
|||
const TransactionDetails = () => {
|
||||
const { setOptions, navigate } = useExtendedNavigation<NavigationProps>();
|
||||
const { hash, walletID } = useRoute<TransactionDetailsProps['route']>().params;
|
||||
const { saveToDisk, txMetadata, counterpartyMetadata, wallets, getTransactions } = useContext(BlueStorageContext);
|
||||
const { saveToDisk, txMetadata, counterpartyMetadata, wallets, getTransactions } = useStorage();
|
||||
const [from, setFrom] = useState<string[]>([]);
|
||||
const [to, setTo] = useState<string[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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',
|
||||
|
@ -84,7 +84,7 @@ const DrawerList: React.FC<DrawerListProps> = memo(({ navigation }) => {
|
|||
|
||||
const [state, dispatch] = useReducer(walletReducer, initialState);
|
||||
const walletsCarousel = useRef<FlatList<TWallet>>(null);
|
||||
const { wallets, selectedWalletID } = useContext(BlueStorageContext);
|
||||
const { wallets, selectedWalletID } = useStorage();
|
||||
const { colors } = useTheme();
|
||||
const isFocused = useIsFocused();
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
@ -65,7 +64,7 @@ const ExportMultisigCoordinationSetup: React.FC = () => {
|
|||
const { isLoading, isShareButtonTapped, qrCodeContents } = state;
|
||||
const { params } = useRoute<RouteProp<RootStackParamList, 'ExportMultisigCoordinationSetup'>>();
|
||||
const walletID = params.walletID;
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const wallet: TWallet | undefined = wallets.find(w => w.getID() === walletID);
|
||||
const dynamicQRCode = useRef<any>();
|
||||
const { colors } = useTheme();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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' };
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,11 +38,13 @@ 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 = {};
|
||||
|
||||
const WalletsAddMultisigStep2 = () => {
|
||||
const { addWallet, saveToDisk, isElectrumDisabled, sleep, currentSharedCosigner, setSharedCosigner } = useContext(BlueStorageContext);
|
||||
const { addWallet, saveToDisk, isElectrumDisabled, sleep, currentSharedCosigner, setSharedCosigner } = useStorage();
|
||||
const { isAdvancedModeEnabled } = useSettings();
|
||||
const { colors } = useTheme();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -59,7 +58,7 @@ const WalletAddresses = () => {
|
|||
|
||||
const [currentTab, setCurrentTab] = useState(TABS.EXTERNAL);
|
||||
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
|
||||
const { walletID } = useRoute().params;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useRoute } from '@react-navigation/native';
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useRoute } from '@react-navigation/native';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
|
@ -17,11 +17,9 @@ import {
|
|||
TouchableWithoutFeedback,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
import { writeFileAndExport } from '../../blue_modules/fs';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import { useStorage } from '../../blue_modules/storage-context';
|
||||
import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import {
|
||||
HDAezeedWallet,
|
||||
|
@ -37,7 +35,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 +45,8 @@ 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';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
scrollViewContent: {
|
||||
|
|
|
@ -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,9 +10,10 @@ 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 } = useContext(BlueStorageContext);
|
||||
const { wallets, saveToDisk } = useStorage();
|
||||
const { walletID } = useRoute().params;
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const { goBack } = useNavigation();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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';
|
||||
|
@ -27,7 +26,7 @@ const ImportCustomDerivationPath = () => {
|
|||
const route = useRoute();
|
||||
const importText = route.params.importText;
|
||||
const password = route.params.password;
|
||||
const { addAndSaveWallet } = useContext(BlueStorageContext);
|
||||
const { addAndSaveWallet } = useStorage();
|
||||
const [path, setPath] = useState("m/84'/0'/0'");
|
||||
const [wallets, setWallets] = useState({});
|
||||
const [used, setUsed] = useState({});
|
||||
|
|
|
@ -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,14 +13,16 @@ 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;
|
||||
const task = useRef();
|
||||
const { addAndSaveWallet } = useContext(BlueStorageContext);
|
||||
const { addAndSaveWallet } = useStorage();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [wallets, setWallets] = useState([]);
|
||||
const [password, setPassword] = useState();
|
||||
|
|
|
@ -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();
|
||||
|
@ -17,7 +16,7 @@ const WalletsImportWallet = () => {
|
|||
const [importText, setImportText] = useState();
|
||||
const [walletType, setWalletType] = useState();
|
||||
const [passphrase, setPassphrase] = useState();
|
||||
const { addAndSaveWallet } = useContext(BlueStorageContext);
|
||||
const { addAndSaveWallet } = useStorage();
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
|
|
|
@ -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,10 +10,11 @@ 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();
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const { walletID } = useRoute().params;
|
||||
/** @type {LightningLdkWallet} */
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
|
|
|
@ -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,9 +9,10 @@ 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 } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const { walletID } = useRoute().params;
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
const navigation = useNavigation();
|
||||
|
|
|
@ -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,9 +9,10 @@ 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 } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const { walletID } = useRoute().params;
|
||||
/** @type {LightningLdkWallet} */
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
|
|
|
@ -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: {
|
||||
|
@ -22,7 +21,7 @@ const styles = StyleSheet.create({
|
|||
const ReorderWallets = () => {
|
||||
const sortableList = useRef();
|
||||
const { colors } = useTheme();
|
||||
const { wallets, setWalletsWithNewOrder } = useContext(BlueStorageContext);
|
||||
const { wallets, setWalletsWithNewOrder } = useStorage();
|
||||
const colorScheme = useColorScheme();
|
||||
const { navigate, setOptions } = useExtendedNavigation();
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
|
|
|
@ -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,12 +11,13 @@ 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;
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const { pop, navigate, setOptions, getParent } = useNavigation();
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const { colors, closeImage } = useTheme();
|
||||
const isModal = useNavigationState(state => state.routes.length) === 1;
|
||||
let data = !onChainRequireSend
|
||||
|
|
|
@ -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,19 +13,18 @@ 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();
|
||||
const { wallets, sleep } = useContext(BlueStorageContext);
|
||||
const { wallets, sleep } = useStorage();
|
||||
const { params } = useRoute();
|
||||
const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
|
||||
const [address, setAddress] = useState(params.address ?? '');
|
||||
|
|
|
@ -24,7 +24,6 @@ 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, WalletTransactionsStatus } from '../../blue_modules/storage-context';
|
||||
import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
|
||||
import WalletGradient from '../../class/wallet-gradient';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
@ -41,6 +40,8 @@ import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
|||
import loc from '../../loc';
|
||||
import { Chain } from '../../models/bitcoinUnits';
|
||||
import ActionSheet from '../ActionSheet';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
import { WalletTransactionsStatus } from '../../components/Context/StorageProvider';
|
||||
|
||||
const buttonFontSize =
|
||||
PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26) > 22
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { NavigationProp, RouteProp, 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, InteractionManager, View } from 'react-native';
|
||||
import Share from 'react-native-share';
|
||||
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||
import Button from '../../components/Button';
|
||||
import CopyTextToClipboard from '../../components/CopyTextToClipboard';
|
||||
|
@ -13,6 +11,7 @@ import SafeArea from '../../components/SafeArea';
|
|||
import usePrivacy from '../../hooks/usePrivacy';
|
||||
import loc from '../../loc';
|
||||
import { styles, useDynamicStyles } from './xpub.styles';
|
||||
import { useStorage } from '../../hooks/context/useStorage';
|
||||
|
||||
type WalletXpubRouteProp = RouteProp<{ params: { walletID: string; xpub: string } }, 'params'>;
|
||||
export type RootStackParamList = {
|
||||
|
@ -23,7 +22,7 @@ export type RootStackParamList = {
|
|||
};
|
||||
|
||||
const WalletXpub: React.FC = () => {
|
||||
const { wallets } = useContext(BlueStorageContext);
|
||||
const { wallets } = useStorage();
|
||||
const route = useRoute<WalletXpubRouteProp>();
|
||||
const { walletID, xpub } = route.params;
|
||||
const wallet = wallets.find(w => w.getID() === walletID);
|
||||
|
|
Loading…
Add table
Reference in a new issue