2019-03-05 02:14:28 +01:00
|
|
|
/* global alert */
|
2020-10-24 19:20:59 +02:00
|
|
|
import React, { useEffect, useState, useCallback, useContext, useRef } from 'react';
|
2019-09-19 01:26:28 +02:00
|
|
|
import {
|
|
|
|
ActivityIndicator,
|
2020-01-01 04:31:04 +01:00
|
|
|
Alert,
|
2020-11-17 09:43:38 +01:00
|
|
|
Dimensions,
|
|
|
|
FlatList,
|
2020-09-08 18:06:41 +02:00
|
|
|
InteractionManager,
|
2020-11-17 09:43:38 +01:00
|
|
|
Keyboard,
|
|
|
|
KeyboardAvoidingView,
|
|
|
|
Linking,
|
2020-09-09 19:51:49 +02:00
|
|
|
PixelRatio,
|
2020-11-17 09:43:38 +01:00
|
|
|
Platform,
|
|
|
|
ScrollView,
|
|
|
|
StatusBar,
|
|
|
|
StyleSheet,
|
|
|
|
Text,
|
|
|
|
TouchableOpacity,
|
|
|
|
View,
|
2019-09-19 01:26:28 +02:00
|
|
|
} from 'react-native';
|
2020-12-10 18:40:14 +01:00
|
|
|
import { launchImageLibrary } from 'react-native-image-picker';
|
2020-08-21 00:50:38 +02:00
|
|
|
import Clipboard from '@react-native-community/clipboard';
|
2020-11-17 09:43:38 +01:00
|
|
|
import { Icon } from 'react-native-elements';
|
|
|
|
import Handoff from 'react-native-handoff';
|
|
|
|
import { useRoute, useNavigation, useTheme, useFocusEffect } from '@react-navigation/native';
|
|
|
|
import { Chain } from '../../models/bitcoinUnits';
|
2020-10-02 11:57:25 +02:00
|
|
|
import { BlueTransactionListItem, BlueWalletNavigationHeader, BlueAlertWalletExportReminder, BlueListItem } from '../../BlueComponents';
|
2020-05-24 12:27:08 +02:00
|
|
|
import WalletGradient from '../../class/wallet-gradient';
|
2020-12-11 18:18:10 +01:00
|
|
|
import { LightningCustodianWallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
|
2020-03-29 04:06:45 +02:00
|
|
|
import HandoffSettings from '../../class/handoff';
|
2020-04-03 05:53:53 +02:00
|
|
|
import ActionSheet from '../ActionSheet';
|
2020-07-20 15:38:46 +02:00
|
|
|
import loc from '../../loc';
|
2020-09-09 19:51:49 +02:00
|
|
|
import { FContainer, FButton } from '../../components/FloatButtons';
|
2020-12-04 14:39:47 +01:00
|
|
|
import isCatalyst from 'react-native-is-catalyst';
|
2020-11-17 09:43:38 +01:00
|
|
|
import BottomModal from '../../components/BottomModal';
|
2020-09-05 02:47:34 +02:00
|
|
|
import BuyBitcoin from './buyBitcoin';
|
2020-10-24 19:20:59 +02:00
|
|
|
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
2020-07-01 13:56:52 +02:00
|
|
|
const BlueElectrum = require('../../blue_modules/BlueElectrum');
|
2020-04-03 05:53:53 +02:00
|
|
|
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
|
2018-10-09 06:25:36 +02:00
|
|
|
|
2020-09-07 19:46:37 +02:00
|
|
|
const buttonFontSize =
|
|
|
|
PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26) > 22
|
|
|
|
? 22
|
|
|
|
: PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26);
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const WalletTransactions = () => {
|
2020-10-24 19:20:59 +02:00
|
|
|
const { wallets, saveToDisk, setSelectedWallet } = useContext(BlueStorageContext);
|
2020-09-08 18:06:41 +02:00
|
|
|
const [isHandOffUseEnabled, setIsHandOffUseEnabled] = useState(false);
|
|
|
|
const [isLoading, setIsLoading] = useState(false);
|
|
|
|
const [isManageFundsModalVisible, setIsManageFundsModalVisible] = useState(false);
|
2020-10-24 19:20:59 +02:00
|
|
|
const { walletID } = useRoute().params;
|
|
|
|
const wallet = useRef(wallets.find(w => w.getID() === walletID));
|
2020-09-08 18:06:41 +02:00
|
|
|
const name = useRoute().name;
|
2020-10-24 19:20:59 +02:00
|
|
|
const [itemPriceUnit, setItemPriceUnit] = useState(wallet.current.getPreferredBalanceUnit());
|
|
|
|
const [dataSource, setDataSource] = useState(wallet.current.getTransactions(15));
|
2020-09-08 18:06:41 +02:00
|
|
|
const [timeElapsed, setTimeElapsed] = useState(0);
|
|
|
|
const [limit, setLimit] = useState(15);
|
|
|
|
const [pageSize, setPageSize] = useState(20);
|
2020-10-24 19:20:59 +02:00
|
|
|
const { setParams, setOptions, navigate } = useNavigation();
|
2020-09-08 18:06:41 +02:00
|
|
|
const { colors } = useTheme();
|
|
|
|
|
|
|
|
const stylesHook = StyleSheet.create({
|
|
|
|
advancedTransactionOptionsModalContent: {
|
|
|
|
backgroundColor: colors.elevated,
|
|
|
|
},
|
|
|
|
listHeaderText: {
|
|
|
|
color: colors.foregroundColor,
|
|
|
|
},
|
|
|
|
marketplaceButton1: {
|
|
|
|
backgroundColor: colors.lightButton,
|
|
|
|
},
|
|
|
|
marketplaceButton2: {
|
|
|
|
backgroundColor: colors.lightButton,
|
|
|
|
},
|
|
|
|
marketpalceText1: {
|
|
|
|
color: colors.cta2,
|
|
|
|
},
|
|
|
|
marketpalceText2: {
|
|
|
|
color: colors.cta2,
|
|
|
|
},
|
|
|
|
list: {
|
|
|
|
backgroundColor: colors.background,
|
|
|
|
},
|
|
|
|
});
|
2018-10-09 06:25:36 +02:00
|
|
|
|
2019-02-19 00:37:53 +01:00
|
|
|
/**
|
2020-10-24 19:20:59 +02:00
|
|
|
* Simple wrapper for `wallet.current.getTransactions()`, where `wallet` is current wallet.current.
|
2019-02-19 00:37:53 +01:00
|
|
|
* Sorts. Provides limiting.
|
|
|
|
*
|
|
|
|
* @param limit {Integer} How many txs return, starting from the earliest. Default: all of them.
|
|
|
|
* @returns {Array}
|
|
|
|
*/
|
2020-10-24 19:20:59 +02:00
|
|
|
const getTransactionsSliced = (limit = Infinity) => {
|
|
|
|
let txs = wallet.current.getTransactions();
|
2020-06-01 14:54:23 +02:00
|
|
|
for (const tx of txs) {
|
2019-02-19 00:37:53 +01:00
|
|
|
tx.sort_ts = +new Date(tx.received);
|
|
|
|
}
|
2020-06-01 14:54:23 +02:00
|
|
|
txs = txs.sort(function (a, b) {
|
2019-02-19 00:37:53 +01:00
|
|
|
return b.sort_ts - a.sort_ts;
|
|
|
|
});
|
|
|
|
return txs.slice(0, limit);
|
2020-09-08 18:06:41 +02:00
|
|
|
};
|
2019-02-19 00:37:53 +01:00
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
useEffect(() => {
|
|
|
|
HandoffSettings.isHandoffUseEnabled().then(setIsHandOffUseEnabled);
|
2020-09-14 12:49:08 +02:00
|
|
|
const interval = setInterval(() => setTimeElapsed(prev => prev + 1), 60000);
|
2020-09-08 18:06:41 +02:00
|
|
|
return () => {
|
|
|
|
clearInterval(interval);
|
|
|
|
};
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
setIsLoading(true);
|
|
|
|
setLimit(15);
|
|
|
|
setPageSize(20);
|
|
|
|
setTimeElapsed(0);
|
2020-10-24 19:20:59 +02:00
|
|
|
setItemPriceUnit(wallet.current.getPreferredBalanceUnit());
|
2020-09-08 18:06:41 +02:00
|
|
|
setIsLoading(false);
|
2020-10-24 19:20:59 +02:00
|
|
|
setSelectedWallet(wallet.current.getID());
|
|
|
|
setDataSource(wallet.current.getTransactions(15));
|
|
|
|
setOptions({
|
|
|
|
headerStyle: {
|
|
|
|
backgroundColor: WalletGradient.headerColorFor(wallet.current.type),
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
elevation: 0,
|
|
|
|
// shadowRadius: 0,
|
|
|
|
shadowOffset: { height: 0, width: 0 },
|
|
|
|
},
|
|
|
|
});
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, [wallets, wallet.current, walletID]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const newwallet = wallets.find(w => w.getID() === walletID);
|
|
|
|
if (newwallet) {
|
|
|
|
wallet.current = newwallet;
|
|
|
|
setParams({ walletID, isLoading: false });
|
|
|
|
}
|
2020-09-08 18:06:41 +02:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2020-10-24 19:20:59 +02:00
|
|
|
}, [walletID]);
|
2018-10-09 06:25:36 +02:00
|
|
|
|
2020-11-30 11:37:04 +01:00
|
|
|
// if balance of the wallet positive and there are no transactions, then
|
|
|
|
// it'a freshly impoted wallet and we need to refresh transactions
|
|
|
|
useEffect(() => {
|
|
|
|
if (dataSource.length === 0 && wallet.current.getBalance() > 0) {
|
|
|
|
refreshTransactions();
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, []);
|
|
|
|
|
2020-09-23 08:30:14 +02:00
|
|
|
// if description of transaction has been changed we want to show new one
|
|
|
|
useFocusEffect(
|
|
|
|
useCallback(() => {
|
|
|
|
setTimeElapsed(prev => prev + 1);
|
|
|
|
}, []),
|
|
|
|
);
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const isLightning = () => {
|
|
|
|
const w = wallet;
|
2019-12-25 21:53:53 +01:00
|
|
|
if (w && w.chain === Chain.OFFCHAIN) {
|
2018-10-09 06:25:36 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2020-09-08 18:06:41 +02:00
|
|
|
};
|
2018-10-09 06:25:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Forcefully fetches TXs and balance for wallet
|
|
|
|
*/
|
2020-09-08 18:06:41 +02:00
|
|
|
const refreshTransactions = async () => {
|
|
|
|
if (isLoading) return;
|
|
|
|
setIsLoading(true);
|
|
|
|
let noErr = true;
|
|
|
|
let smthChanged = false;
|
|
|
|
try {
|
|
|
|
// await BlueElectrum.ping();
|
|
|
|
await BlueElectrum.waitTillConnected();
|
|
|
|
/** @type {LegacyWallet} */
|
|
|
|
const balanceStart = +new Date();
|
2020-10-24 19:20:59 +02:00
|
|
|
const oldBalance = wallet.current.getBalance();
|
|
|
|
await wallet.current.fetchBalance();
|
|
|
|
if (oldBalance !== wallet.current.getBalance()) smthChanged = true;
|
2020-09-08 18:06:41 +02:00
|
|
|
const balanceEnd = +new Date();
|
2020-10-24 19:20:59 +02:00
|
|
|
console.log(wallet.current.getLabel(), 'fetch balance took', (balanceEnd - balanceStart) / 1000, 'sec');
|
2020-09-08 18:06:41 +02:00
|
|
|
const start = +new Date();
|
2020-10-24 19:20:59 +02:00
|
|
|
const oldTxLen = wallet.current.getTransactions().length;
|
|
|
|
await wallet.current.fetchTransactions();
|
|
|
|
if (wallet.current.fetchPendingTransactions) {
|
|
|
|
await wallet.current.fetchPendingTransactions();
|
2020-09-08 18:06:41 +02:00
|
|
|
}
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.fetchUserInvoices) {
|
|
|
|
await wallet.current.fetchUserInvoices();
|
2020-09-08 18:06:41 +02:00
|
|
|
}
|
2020-10-24 19:20:59 +02:00
|
|
|
if (oldTxLen !== wallet.current.getTransactions().length) smthChanged = true;
|
2020-09-08 18:06:41 +02:00
|
|
|
const end = +new Date();
|
2020-10-24 19:20:59 +02:00
|
|
|
console.log(wallet.current.getLabel(), 'fetch tx took', (end - start) / 1000, 'sec');
|
2020-09-08 18:06:41 +02:00
|
|
|
} catch (err) {
|
|
|
|
noErr = false;
|
|
|
|
alert(err.message);
|
|
|
|
setIsLoading(false);
|
2020-09-21 12:55:03 +02:00
|
|
|
setTimeElapsed(prev => prev + 1);
|
2020-09-08 18:06:41 +02:00
|
|
|
}
|
|
|
|
if (noErr && smthChanged) {
|
|
|
|
console.log('saving to disk');
|
2020-10-24 19:20:59 +02:00
|
|
|
await saveToDisk(); // caching
|
|
|
|
// setDataSource([...getTransactionsSliced(limit)]);
|
2020-09-08 18:06:41 +02:00
|
|
|
}
|
|
|
|
setIsLoading(false);
|
2020-09-21 12:55:03 +02:00
|
|
|
setTimeElapsed(prev => prev + 1);
|
2020-09-08 18:06:41 +02:00
|
|
|
};
|
2018-10-09 06:25:36 +02:00
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const _keyExtractor = (_item, index) => index.toString();
|
2018-10-09 06:25:36 +02:00
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const renderListFooterComponent = () => {
|
2019-02-19 21:32:45 +01:00
|
|
|
// if not all txs rendered - display indicator
|
2020-10-24 19:20:59 +02:00
|
|
|
return (getTransactionsSliced(Infinity).length > limit && <ActivityIndicator style={styles.activityIndicator} />) || <View />;
|
2019-02-19 21:32:45 +01:00
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const renderListHeaderComponent = () => {
|
2020-11-22 09:36:28 +01:00
|
|
|
const style = {};
|
|
|
|
if (!isCatalyst) {
|
|
|
|
// we need this button for testing
|
|
|
|
style.opacity = 0;
|
|
|
|
style.height = 1;
|
|
|
|
style.width = 1;
|
|
|
|
} else if (isLoading) {
|
|
|
|
style.opacity = 0.5;
|
|
|
|
} else {
|
|
|
|
style.opacity = 1.0;
|
|
|
|
}
|
|
|
|
|
2018-10-09 06:25:36 +02:00
|
|
|
return (
|
2020-05-24 11:17:26 +02:00
|
|
|
<View style={styles.flex}>
|
|
|
|
<View style={styles.listHeader}>
|
2020-04-29 15:59:47 +02:00
|
|
|
{/*
|
2020-04-29 17:40:55 +02:00
|
|
|
Current logic - Onchain:
|
|
|
|
- Shows buy button on middle when empty
|
|
|
|
- Show buy button on top when not empty
|
|
|
|
- Shows Marketplace button on details screen, open in browser (iOS)
|
|
|
|
- Shows Marketplace button on details screen, open in in-app (android)
|
|
|
|
Current logic - Offchain:
|
|
|
|
- Shows Lapp Browser empty (iOS)
|
|
|
|
- Shows Lapp Browser with marketplace (android)
|
|
|
|
- Shows Marketplace button to open in browser (iOS)
|
|
|
|
|
|
|
|
The idea is to avoid showing on iOS an appstore/market style app that goes against the TOS.
|
2020-05-27 13:12:17 +02:00
|
|
|
|
2020-04-29 15:59:47 +02:00
|
|
|
*/}
|
2020-10-24 19:20:59 +02:00
|
|
|
{wallet.current.getTransactions().length > 0 && wallet.current.type !== LightningCustodianWallet.type && renderSellFiat()}
|
|
|
|
{wallet.current.type === LightningCustodianWallet.type && renderMarketplaceButton()}
|
|
|
|
{wallet.current.type === LightningCustodianWallet.type && Platform.OS === 'ios' && renderLappBrowserButton()}
|
2019-12-25 21:53:53 +01:00
|
|
|
</View>
|
2020-09-08 18:06:41 +02:00
|
|
|
<View style={[styles.listHeaderTextRow, stylesHook.listHeaderTextRow]}>
|
|
|
|
<Text style={[styles.listHeaderText, stylesHook.listHeaderText]}>{loc.transactions.list_title}</Text>
|
2020-11-22 09:36:28 +01:00
|
|
|
<TouchableOpacity testID="refreshTransactions" style={style} onPress={refreshTransactions} disabled={isLoading}>
|
|
|
|
<Icon name="refresh" type="font-awesome" color={colors.feeText} />
|
|
|
|
</TouchableOpacity>
|
2020-08-21 00:50:38 +02:00
|
|
|
</View>
|
2018-10-09 06:25:36 +02:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
2019-09-29 22:01:27 +02:00
|
|
|
|
2020-11-11 17:59:03 +01:00
|
|
|
const hideManageFundsModal = () => {
|
|
|
|
Keyboard.dismiss();
|
|
|
|
setIsManageFundsModalVisible(false);
|
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const renderManageFundsModal = () => {
|
2019-09-29 22:01:27 +02:00
|
|
|
return (
|
2020-11-17 09:43:38 +01:00
|
|
|
<BottomModal isVisible={isManageFundsModalVisible} onClose={hideManageFundsModal}>
|
2019-09-29 22:01:27 +02:00
|
|
|
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'position' : null}>
|
2020-09-08 18:06:41 +02:00
|
|
|
<View style={[styles.advancedTransactionOptionsModalContent, stylesHook.advancedTransactionOptionsModalContent]}>
|
2020-09-22 03:53:28 +02:00
|
|
|
<BlueListItem
|
2019-09-29 22:01:27 +02:00
|
|
|
hideChevron
|
|
|
|
component={TouchableOpacity}
|
2020-09-05 02:49:32 +02:00
|
|
|
onPress={() => {
|
2020-10-24 19:20:59 +02:00
|
|
|
const availableWallets = [...wallets.filter(item => item.chain === Chain.ONCHAIN && item.allowSend())];
|
|
|
|
if (availableWallets.length === 0) {
|
2020-07-20 15:38:46 +02:00
|
|
|
alert(loc.lnd.refill_create);
|
2019-09-29 22:01:27 +02:00
|
|
|
} else {
|
2020-09-08 18:06:41 +02:00
|
|
|
setIsManageFundsModalVisible(false);
|
|
|
|
navigate('SelectWallet', { onWalletSelect, chainType: Chain.ONCHAIN });
|
2019-09-29 22:01:27 +02:00
|
|
|
}
|
|
|
|
}}
|
2019-10-01 00:13:22 +02:00
|
|
|
title={loc.lnd.refill}
|
2019-09-29 22:01:27 +02:00
|
|
|
/>
|
2020-09-22 03:53:28 +02:00
|
|
|
<BlueListItem
|
2019-09-29 22:01:27 +02:00
|
|
|
hideChevron
|
|
|
|
component={TouchableOpacity}
|
2020-09-05 02:49:32 +02:00
|
|
|
onPress={() => {
|
2020-09-08 18:06:41 +02:00
|
|
|
setIsManageFundsModalVisible(false);
|
|
|
|
|
2020-11-24 04:15:33 +01:00
|
|
|
navigate('ReceiveDetailsRoot', {
|
|
|
|
screen: 'ReceiveDetails',
|
|
|
|
params: {
|
|
|
|
walletID: wallet.current.getID(),
|
|
|
|
},
|
2020-09-08 18:06:41 +02:00
|
|
|
});
|
2019-09-29 22:01:27 +02:00
|
|
|
}}
|
2020-07-20 15:38:46 +02:00
|
|
|
title={loc.lnd.refill_external}
|
2019-09-29 22:01:27 +02:00
|
|
|
/>
|
|
|
|
|
2020-09-22 03:53:28 +02:00
|
|
|
<BlueListItem
|
2020-04-17 16:41:35 +02:00
|
|
|
hideChevron
|
|
|
|
component={TouchableOpacity}
|
2020-09-05 02:49:32 +02:00
|
|
|
onPress={() => {
|
2020-09-08 18:06:41 +02:00
|
|
|
setIsManageFundsModalVisible(false);
|
2020-10-24 19:20:59 +02:00
|
|
|
setTimeout(() => navigateToBuyBitcoin(), 500);
|
2020-04-17 16:41:35 +02:00
|
|
|
}}
|
2020-07-20 15:38:46 +02:00
|
|
|
title={loc.lnd.refill_card}
|
2020-04-17 16:41:35 +02:00
|
|
|
/>
|
|
|
|
|
2020-09-22 03:53:28 +02:00
|
|
|
<BlueListItem
|
2020-06-16 17:08:25 +02:00
|
|
|
title={loc.lnd.exchange}
|
2019-09-29 22:01:27 +02:00
|
|
|
hideChevron
|
|
|
|
component={TouchableOpacity}
|
2020-09-05 02:49:32 +02:00
|
|
|
onPress={() => {
|
2020-09-08 18:06:41 +02:00
|
|
|
setIsManageFundsModalVisible(false);
|
2019-09-29 22:01:27 +02:00
|
|
|
Linking.openURL('https://zigzag.io/?utm_source=integration&utm_medium=bluewallet&utm_campaign=withdrawLink');
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</KeyboardAvoidingView>
|
2020-11-17 09:43:38 +01:00
|
|
|
</BottomModal>
|
2019-09-29 22:01:27 +02:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const navigateToBuyBitcoin = () => {
|
2020-10-24 19:20:59 +02:00
|
|
|
BuyBitcoin.navigate(wallet.current);
|
2020-09-08 18:06:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const renderMarketplaceButton = () => {
|
2019-10-17 03:51:22 +02:00
|
|
|
return Platform.select({
|
|
|
|
android: (
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => {
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.type === LightningCustodianWallet.type) {
|
2020-11-24 04:15:33 +01:00
|
|
|
navigate('LappBrowserRoot', {
|
|
|
|
screen: 'LappBrowser',
|
|
|
|
params: { fromSecret: wallet.current.getSecret(), fromWallet: wallet.current },
|
|
|
|
});
|
2020-04-29 17:40:55 +02:00
|
|
|
} else {
|
2020-10-24 19:20:59 +02:00
|
|
|
navigate('Marketplace', { fromWallet: wallet.current });
|
2020-04-29 17:40:55 +02:00
|
|
|
}
|
2019-10-17 03:51:22 +02:00
|
|
|
}}
|
2020-09-08 18:06:41 +02:00
|
|
|
style={[styles.marketplaceButton1, stylesHook.marketplaceButton1]}
|
2019-10-17 03:51:22 +02:00
|
|
|
>
|
2020-09-08 18:06:41 +02:00
|
|
|
<Text style={[styles.marketpalceText1, stylesHook.marketpalceText1]}>marketplace</Text>
|
2019-10-17 03:51:22 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
),
|
|
|
|
ios:
|
2020-10-24 19:20:59 +02:00
|
|
|
wallet.current.getBalance() > 0 ? (
|
2019-10-17 03:51:22 +02:00
|
|
|
<TouchableOpacity
|
|
|
|
onPress={async () => {
|
2020-10-26 00:22:45 +01:00
|
|
|
Linking.openURL('https://bluewallet.io/marketplace/');
|
2019-10-17 03:51:22 +02:00
|
|
|
}}
|
2020-09-08 18:06:41 +02:00
|
|
|
style={[styles.marketplaceButton1, stylesHook.marketplaceButton1]}
|
2019-10-17 03:51:22 +02:00
|
|
|
>
|
2019-10-17 04:08:09 +02:00
|
|
|
<Icon name="external-link" size={18} type="font-awesome" color="#9aa0aa" />
|
2020-09-08 18:06:41 +02:00
|
|
|
<Text style={[styles.marketpalceText2, stylesHook.marketpalceText2]}>marketplace</Text>
|
2019-10-17 03:51:22 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
) : null,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const renderLappBrowserButton = () => {
|
2019-10-21 13:52:38 +02:00
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => {
|
2020-11-24 04:15:33 +01:00
|
|
|
navigate('LappBrowserRoot', {
|
|
|
|
screen: 'LappBrowser',
|
|
|
|
params: {
|
|
|
|
fromSecret: wallet.current.getSecret(),
|
|
|
|
fromWallet: wallet,
|
|
|
|
url: 'https://duckduckgo.com',
|
|
|
|
},
|
2019-10-21 13:52:38 +02:00
|
|
|
});
|
|
|
|
}}
|
2020-09-08 18:06:41 +02:00
|
|
|
style={[styles.marketplaceButton2, stylesHook.marketplaceButton2]}
|
2019-10-21 13:52:38 +02:00
|
|
|
>
|
2020-09-08 18:06:41 +02:00
|
|
|
<Text style={[styles.marketpalceText1, stylesHook.marketpalceText1]}>LApp Browser</Text>
|
2019-10-21 13:52:38 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
};
|
2020-06-01 14:54:23 +02:00
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const renderSellFiat = () => {
|
2020-04-16 15:43:53 +02:00
|
|
|
return (
|
2020-09-08 18:06:41 +02:00
|
|
|
<TouchableOpacity onPress={navigateToBuyBitcoin} style={[styles.marketplaceButton2, stylesHook.marketplaceButton2]}>
|
|
|
|
<Text style={[styles.marketpalceText1, stylesHook.marketpalceText1]}>{loc.wallets.list_tap_here_to_buy}</Text>
|
2020-04-16 15:43:53 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
};
|
2020-03-23 17:32:51 +01:00
|
|
|
|
2020-09-14 20:01:18 +02:00
|
|
|
const onWalletSelect = async selectedWallet => {
|
|
|
|
if (selectedWallet) {
|
2020-09-08 18:06:41 +02:00
|
|
|
navigate('WalletTransactions', {
|
2020-10-31 18:13:47 +01:00
|
|
|
walletType: wallet.current.type,
|
|
|
|
walletID: wallet.current.getID(),
|
2020-10-24 19:20:59 +02:00
|
|
|
key: `WalletTransactions-${wallet.current.getID()}`,
|
2019-11-03 01:25:55 +01:00
|
|
|
});
|
|
|
|
/** @type {LightningCustodianWallet} */
|
|
|
|
let toAddress = false;
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.refill_addressess.length > 0) {
|
|
|
|
toAddress = wallet.current.refill_addressess[0];
|
2019-11-03 01:25:55 +01:00
|
|
|
} else {
|
|
|
|
try {
|
2020-10-24 19:20:59 +02:00
|
|
|
await wallet.current.fetchBtcAddress();
|
|
|
|
toAddress = wallet.current.refill_addressess[0];
|
2019-11-03 01:25:55 +01:00
|
|
|
} catch (Err) {
|
|
|
|
return alert(Err.message);
|
|
|
|
}
|
2019-09-29 22:01:27 +02:00
|
|
|
}
|
2020-09-08 18:06:41 +02:00
|
|
|
navigate('SendDetailsRoot', {
|
2020-05-27 13:12:17 +02:00
|
|
|
screen: 'SendDetails',
|
|
|
|
params: {
|
|
|
|
memo: loc.lnd.refill_lnd_balance,
|
|
|
|
address: toAddress,
|
2020-09-14 20:01:18 +02:00
|
|
|
fromWallet: selectedWallet,
|
2020-05-27 13:12:17 +02:00
|
|
|
},
|
2019-09-29 22:01:27 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2020-09-08 18:06:41 +02:00
|
|
|
const navigateToSendScreen = () => {
|
|
|
|
navigate('SendDetailsRoot', {
|
2020-05-27 13:12:17 +02:00
|
|
|
screen: 'SendDetails',
|
|
|
|
params: {
|
2020-10-24 19:20:59 +02:00
|
|
|
fromWallet: wallet.current,
|
2020-05-27 13:12:17 +02:00
|
|
|
},
|
2020-01-01 04:31:04 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const renderItem = item => <BlueTransactionListItem item={item.item} itemPriceUnit={itemPriceUnit} timeElapsed={timeElapsed} />;
|
|
|
|
|
|
|
|
const onBarCodeRead = ret => {
|
|
|
|
if (!isLoading) {
|
|
|
|
setIsLoading(true);
|
|
|
|
const params = {
|
2020-12-05 06:21:08 +01:00
|
|
|
walletID: wallet.current.getID(),
|
2020-09-08 18:06:41 +02:00
|
|
|
uri: ret.data ? ret.data : ret,
|
2020-11-24 14:46:55 +01:00
|
|
|
fromWallet: wallet.current,
|
2020-09-08 18:06:41 +02:00
|
|
|
};
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.chain === Chain.ONCHAIN) {
|
2020-09-08 18:06:41 +02:00
|
|
|
navigate('SendDetailsRoot', { screen: 'SendDetails', params });
|
|
|
|
} else {
|
|
|
|
navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params });
|
|
|
|
}
|
2020-04-03 05:53:53 +02:00
|
|
|
}
|
2020-09-08 18:06:41 +02:00
|
|
|
setIsLoading(false);
|
2020-04-03 05:53:53 +02:00
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const choosePhoto = () => {
|
2020-12-10 18:40:14 +01:00
|
|
|
launchImageLibrary(
|
2020-04-03 05:53:53 +02:00
|
|
|
{
|
|
|
|
title: null,
|
|
|
|
mediaType: 'photo',
|
|
|
|
takePhotoButtonTitle: null,
|
|
|
|
},
|
|
|
|
response => {
|
|
|
|
if (response.uri) {
|
2020-12-11 00:26:45 +01:00
|
|
|
const uri = Platform.OS === 'ios' ? response.uri.toString().replace('file://', '') : response.uri;
|
2020-04-03 05:53:53 +02:00
|
|
|
LocalQRCode.decode(uri, (error, result) => {
|
|
|
|
if (!error) {
|
2020-09-08 18:06:41 +02:00
|
|
|
onBarCodeRead({ data: result });
|
2020-04-03 05:53:53 +02:00
|
|
|
} else {
|
2020-07-20 15:38:46 +02:00
|
|
|
alert(loc.send.qr_error_no_qrcode);
|
2020-04-03 05:53:53 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2020-11-17 02:50:55 +01:00
|
|
|
const copyFromClipboard = async () => {
|
2020-09-08 18:06:41 +02:00
|
|
|
onBarCodeRead({ data: await Clipboard.getString() });
|
2020-04-05 22:09:53 +02:00
|
|
|
};
|
|
|
|
|
2020-09-09 19:51:49 +02:00
|
|
|
const sendButtonPress = () => {
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.chain === Chain.OFFCHAIN) {
|
2020-12-05 06:21:08 +01:00
|
|
|
navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params: { walletID: wallet.current.getID() } });
|
2020-09-07 19:46:37 +02:00
|
|
|
} else {
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.type === WatchOnlyWallet.type && wallet.current.isHd() && wallet.current.getSecret().startsWith('zpub')) {
|
|
|
|
if (wallet.current.useWithHardwareWalletEnabled()) {
|
2020-09-09 19:51:49 +02:00
|
|
|
navigateToSendScreen();
|
2020-09-07 19:46:37 +02:00
|
|
|
} else {
|
|
|
|
Alert.alert(
|
|
|
|
loc.wallets.details_title,
|
|
|
|
loc.transactions.enable_hw,
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: loc._.ok,
|
2020-09-09 19:51:49 +02:00
|
|
|
onPress: async () => {
|
2020-10-24 19:20:59 +02:00
|
|
|
wallet.current.setUseWithHardwareWalletEnabled(true);
|
|
|
|
await saveToDisk();
|
2020-09-09 19:51:49 +02:00
|
|
|
navigateToSendScreen();
|
2020-09-07 19:46:37 +02:00
|
|
|
},
|
|
|
|
style: 'default',
|
|
|
|
},
|
2020-09-09 19:51:49 +02:00
|
|
|
|
2020-09-07 19:46:37 +02:00
|
|
|
{ text: loc._.cancel, onPress: () => {}, style: 'cancel' },
|
|
|
|
],
|
|
|
|
{ cancelable: false },
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
2020-09-09 19:51:49 +02:00
|
|
|
navigateToSendScreen();
|
2020-09-07 19:46:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
const sendButtonLongPress = async () => {
|
2020-05-28 10:44:15 +02:00
|
|
|
const isClipboardEmpty = (await Clipboard.getString()).replace(' ', '').length === 0;
|
2020-04-03 05:53:53 +02:00
|
|
|
if (Platform.OS === 'ios') {
|
2020-07-20 15:38:46 +02:00
|
|
|
const options = [loc._.cancel, loc.wallets.list_long_choose, loc.wallets.list_long_scan];
|
2020-05-28 10:44:15 +02:00
|
|
|
if (!isClipboardEmpty) {
|
2020-07-20 15:38:46 +02:00
|
|
|
options.push(loc.wallets.list_long_clipboard);
|
2020-05-28 10:44:15 +02:00
|
|
|
}
|
|
|
|
ActionSheet.showActionSheetWithOptions({ options, cancelButtonIndex: 0 }, buttonIndex => {
|
|
|
|
if (buttonIndex === 1) {
|
2020-09-08 18:06:41 +02:00
|
|
|
choosePhoto();
|
2020-05-28 10:44:15 +02:00
|
|
|
} else if (buttonIndex === 2) {
|
2020-09-08 18:06:41 +02:00
|
|
|
navigate('ScanQRCodeRoot', {
|
2020-08-11 02:11:11 +02:00
|
|
|
screen: 'ScanQRCode',
|
|
|
|
params: {
|
2020-09-08 18:06:41 +02:00
|
|
|
launchedBy: name,
|
|
|
|
onBarScanned: onBarCodeRead,
|
2020-08-11 02:11:11 +02:00
|
|
|
showFileImportButton: false,
|
|
|
|
},
|
2020-05-28 10:44:15 +02:00
|
|
|
});
|
|
|
|
} else if (buttonIndex === 3) {
|
2020-11-17 02:50:55 +01:00
|
|
|
copyFromClipboard();
|
2020-05-28 10:44:15 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (Platform.OS === 'android') {
|
2020-06-01 14:54:23 +02:00
|
|
|
const buttons = [
|
2020-05-28 10:44:15 +02:00
|
|
|
{
|
2020-07-20 15:38:46 +02:00
|
|
|
text: loc._.cancel,
|
2020-05-28 10:44:15 +02:00
|
|
|
onPress: () => {},
|
|
|
|
style: 'cancel',
|
|
|
|
},
|
|
|
|
{
|
2020-07-20 15:38:46 +02:00
|
|
|
text: loc.wallets.list_long_choose,
|
2020-09-08 18:06:41 +02:00
|
|
|
onPress: choosePhoto,
|
2020-05-28 10:44:15 +02:00
|
|
|
},
|
|
|
|
{
|
2020-07-20 15:38:46 +02:00
|
|
|
text: loc.wallets.list_long_scan,
|
2020-05-28 10:44:15 +02:00
|
|
|
onPress: () =>
|
2020-09-08 18:06:41 +02:00
|
|
|
navigate('ScanQRCodeRoot', {
|
2020-08-11 02:11:11 +02:00
|
|
|
screen: 'ScanQRCode',
|
|
|
|
params: {
|
2020-09-08 18:06:41 +02:00
|
|
|
launchedBy: name,
|
|
|
|
onBarScanned: onBarCodeRead,
|
2020-08-11 02:11:11 +02:00
|
|
|
showFileImportButton: false,
|
|
|
|
},
|
2020-05-28 10:44:15 +02:00
|
|
|
}),
|
2020-04-03 05:53:53 +02:00
|
|
|
},
|
2020-05-28 10:44:15 +02:00
|
|
|
];
|
|
|
|
if (!isClipboardEmpty) {
|
|
|
|
buttons.push({
|
2020-07-20 15:38:46 +02:00
|
|
|
text: loc.wallets.list_long_clipboard,
|
2020-11-17 02:50:55 +01:00
|
|
|
onPress: copyFromClipboard,
|
2020-05-28 10:44:15 +02:00
|
|
|
});
|
|
|
|
}
|
2020-04-03 05:53:53 +02:00
|
|
|
ActionSheet.showActionSheetWithOptions({
|
|
|
|
title: '',
|
|
|
|
message: '',
|
2020-05-28 10:44:15 +02:00
|
|
|
buttons,
|
2020-04-03 05:53:53 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-12-11 18:18:10 +01:00
|
|
|
const navigateToViewEditCosigners = () => {
|
|
|
|
navigate('ViewEditMultisigCosigners', {
|
|
|
|
walletId: wallet.current.getID(),
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
return (
|
|
|
|
<View style={styles.flex}>
|
2020-10-24 19:20:59 +02:00
|
|
|
<StatusBar barStyle="light-content" backgroundColor={WalletGradient.headerColorFor(wallet.current.type)} />
|
|
|
|
{wallet.current.chain === Chain.ONCHAIN && isHandOffUseEnabled && (
|
2020-09-08 18:06:41 +02:00
|
|
|
<Handoff
|
2020-10-24 19:20:59 +02:00
|
|
|
title={`Bitcoin Wallet ${wallet.current.getLabel()}`}
|
2020-11-17 02:50:16 +01:00
|
|
|
type="io.bluewallet.bluewallet"
|
2020-10-24 19:20:59 +02:00
|
|
|
url={`https://blockpath.com/search/addr?q=${wallet.current.getXpub()}`}
|
2020-09-08 18:06:41 +02:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<BlueWalletNavigationHeader
|
2020-10-24 19:20:59 +02:00
|
|
|
wallet={wallet.current}
|
|
|
|
onWalletUnitChange={passedWallet =>
|
2020-09-08 18:06:41 +02:00
|
|
|
InteractionManager.runAfterInteractions(async () => {
|
2020-10-24 19:20:59 +02:00
|
|
|
setItemPriceUnit(passedWallet.getPreferredBalanceUnit());
|
|
|
|
saveToDisk();
|
2020-09-08 18:06:41 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
onManageFundsPressed={() => {
|
2020-12-11 18:18:10 +01:00
|
|
|
if (wallet.current.type === MultisigHDWallet.type) {
|
|
|
|
navigateToViewEditCosigners();
|
|
|
|
} else if (wallet.current.type === LightningCustodianWallet.type) {
|
|
|
|
if (wallet.current.getUserHasSavedExport()) {
|
|
|
|
setIsManageFundsModalVisible(true);
|
|
|
|
} else {
|
|
|
|
BlueAlertWalletExportReminder({
|
|
|
|
onSuccess: async () => {
|
|
|
|
wallet.current.setUserHasSavedExport(true);
|
|
|
|
await saveToDisk();
|
|
|
|
setIsManageFundsModalVisible(true);
|
|
|
|
},
|
|
|
|
onFailure: () =>
|
|
|
|
navigate('WalletExportRoot', {
|
|
|
|
screen: 'WalletExport',
|
|
|
|
params: {
|
|
|
|
walletID: wallet.current.getID(),
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
2019-08-04 08:42:05 +02:00
|
|
|
}
|
2020-09-08 18:06:41 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<View style={[styles.list, stylesHook.list]}>
|
|
|
|
<FlatList
|
|
|
|
ListHeaderComponent={renderListHeaderComponent}
|
|
|
|
onEndReachedThreshold={0.3}
|
|
|
|
onEndReached={async () => {
|
2020-11-17 02:50:55 +01:00
|
|
|
// pagination in works. in this block we will add more txs to FlatList
|
2020-09-08 18:06:41 +02:00
|
|
|
// so as user scrolls closer to bottom it will render mode transactions
|
|
|
|
|
2020-10-24 19:20:59 +02:00
|
|
|
if (getTransactionsSliced(Infinity).length < limit) {
|
2020-09-08 18:06:41 +02:00
|
|
|
// all list rendered. nop
|
|
|
|
return;
|
2019-12-25 04:35:47 +01:00
|
|
|
}
|
2020-09-08 18:06:41 +02:00
|
|
|
|
2020-10-24 19:20:59 +02:00
|
|
|
setDataSource(getTransactionsSliced(limit + pageSize));
|
2020-09-08 18:06:41 +02:00
|
|
|
setLimit(prev => prev + pageSize);
|
|
|
|
setPageSize(prev => prev * 2);
|
2019-12-25 04:35:47 +01:00
|
|
|
}}
|
2020-09-08 18:06:41 +02:00
|
|
|
ListFooterComponent={renderListFooterComponent}
|
|
|
|
ListEmptyComponent={
|
|
|
|
<ScrollView style={styles.flex} contentContainerStyle={styles.scrollViewContent}>
|
|
|
|
<Text numberOfLines={0} style={styles.emptyTxs}>
|
|
|
|
{(isLightning() && loc.wallets.list_empty_txs1_lightning) || loc.wallets.list_empty_txs1}
|
|
|
|
</Text>
|
|
|
|
{isLightning() && <Text style={styles.emptyTxsLightning}>{loc.wallets.list_empty_txs2_lightning}</Text>}
|
|
|
|
|
|
|
|
{!isLightning() && (
|
|
|
|
<TouchableOpacity onPress={navigateToBuyBitcoin} style={styles.buyBitcoin}>
|
2020-11-03 14:18:46 +01:00
|
|
|
<Text testID="NoTxBuyBitcoin" style={styles.buyBitcoinText}>
|
|
|
|
{loc.wallets.list_tap_here_to_buy}
|
|
|
|
</Text>
|
2020-09-08 18:06:41 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
)}
|
|
|
|
</ScrollView>
|
|
|
|
}
|
|
|
|
onRefresh={refreshTransactions}
|
|
|
|
refreshing={isLoading}
|
|
|
|
data={dataSource}
|
2020-09-16 02:58:31 +02:00
|
|
|
extraData={[timeElapsed, dataSource]}
|
2020-09-08 18:06:41 +02:00
|
|
|
keyExtractor={_keyExtractor}
|
|
|
|
renderItem={renderItem}
|
|
|
|
contentInset={{ top: 0, left: 0, bottom: 90, right: 0 }}
|
2019-08-04 08:42:05 +02:00
|
|
|
/>
|
2020-09-08 18:06:41 +02:00
|
|
|
{renderManageFundsModal()}
|
|
|
|
</View>
|
2019-02-19 00:37:53 +01:00
|
|
|
|
2020-09-09 19:51:49 +02:00
|
|
|
<FContainer>
|
2020-10-24 19:20:59 +02:00
|
|
|
{wallet.current.allowReceive() && (
|
2020-09-09 19:51:49 +02:00
|
|
|
<FButton
|
|
|
|
text={loc.receive.header}
|
|
|
|
onPress={() => {
|
2020-10-24 19:20:59 +02:00
|
|
|
if (wallet.current.chain === Chain.OFFCHAIN) {
|
2020-12-03 02:36:48 +01:00
|
|
|
navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { walletID: wallet.current.getID() } });
|
2020-09-09 19:51:49 +02:00
|
|
|
} else {
|
2020-11-24 04:15:33 +01:00
|
|
|
navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID: wallet.current.getID() } });
|
2020-09-09 19:51:49 +02:00
|
|
|
}
|
2019-02-19 00:37:53 +01:00
|
|
|
}}
|
2020-09-09 19:51:49 +02:00
|
|
|
icon={
|
|
|
|
<View style={styles.receiveIcon}>
|
2020-11-11 04:50:24 +01:00
|
|
|
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
|
2020-09-09 19:51:49 +02:00
|
|
|
</View>
|
2018-11-01 20:44:39 +01:00
|
|
|
}
|
|
|
|
/>
|
2020-09-09 19:51:49 +02:00
|
|
|
)}
|
2020-10-24 19:20:59 +02:00
|
|
|
{(wallet.current.allowSend() ||
|
|
|
|
(wallet.current.type === WatchOnlyWallet.type && wallet.current.isHd() && wallet.current.getSecret().startsWith('zpub'))) && (
|
2020-09-09 19:51:49 +02:00
|
|
|
<FButton
|
|
|
|
onLongPress={sendButtonLongPress}
|
|
|
|
onPress={sendButtonPress}
|
|
|
|
text={loc.send.header}
|
|
|
|
testID="SendButton"
|
|
|
|
icon={
|
|
|
|
<View style={styles.sendIcon}>
|
2020-11-11 04:50:24 +01:00
|
|
|
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
|
2020-09-09 19:51:49 +02:00
|
|
|
</View>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</FContainer>
|
2020-09-08 18:06:41 +02:00
|
|
|
</View>
|
|
|
|
);
|
2019-08-14 05:12:42 +02:00
|
|
|
};
|
2020-07-15 19:32:59 +02:00
|
|
|
|
2020-09-08 18:06:41 +02:00
|
|
|
export default WalletTransactions;
|
|
|
|
|
2020-12-04 14:39:47 +01:00
|
|
|
WalletTransactions.navigationOptions = ({ navigation, route }) => {
|
2020-07-15 19:32:59 +02:00
|
|
|
return {
|
|
|
|
headerRight: () => (
|
|
|
|
<TouchableOpacity
|
|
|
|
disabled={route.params.isLoading === true}
|
|
|
|
style={styles.walletDetails}
|
|
|
|
onPress={() =>
|
|
|
|
navigation.navigate('WalletDetails', {
|
2020-10-24 19:20:59 +02:00
|
|
|
walletID: route.params.walletID,
|
2020-07-15 19:32:59 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Icon name="kebab-horizontal" type="octicon" size={22} color="#FFFFFF" />
|
|
|
|
</TouchableOpacity>
|
|
|
|
),
|
2020-12-04 14:39:47 +01:00
|
|
|
headerTitle: '',
|
2020-07-15 19:32:59 +02:00
|
|
|
headerStyle: {
|
2020-10-24 19:20:59 +02:00
|
|
|
backgroundColor: WalletGradient.headerColorFor(route.params.walletType),
|
2020-07-15 19:32:59 +02:00
|
|
|
borderBottomWidth: 0,
|
|
|
|
elevation: 0,
|
|
|
|
// shadowRadius: 0,
|
|
|
|
shadowOffset: { height: 0, width: 0 },
|
|
|
|
},
|
|
|
|
headerTintColor: '#FFFFFF',
|
|
|
|
headerBackTitleVisible: false,
|
|
|
|
};
|
2020-12-04 14:39:47 +01:00
|
|
|
};
|
2020-10-24 19:20:59 +02:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
flex: {
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
scrollViewContent: {
|
|
|
|
flex: 1,
|
|
|
|
justifyContent: 'center',
|
|
|
|
paddingHorizontal: 16,
|
|
|
|
paddingBottom: 40,
|
|
|
|
},
|
|
|
|
modalContent: {
|
|
|
|
backgroundColor: '#FFFFFF',
|
|
|
|
padding: 22,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
borderTopLeftRadius: 16,
|
|
|
|
borderTopRightRadius: 16,
|
|
|
|
borderColor: 'rgba(0, 0, 0, 0.1)',
|
|
|
|
minHeight: 200,
|
|
|
|
height: 200,
|
|
|
|
},
|
|
|
|
advancedTransactionOptionsModalContent: {
|
|
|
|
padding: 22,
|
|
|
|
borderTopLeftRadius: 16,
|
|
|
|
borderTopRightRadius: 16,
|
|
|
|
borderColor: 'rgba(0, 0, 0, 0.1)',
|
|
|
|
minHeight: 130,
|
|
|
|
},
|
|
|
|
walletDetails: {
|
|
|
|
marginHorizontal: 16,
|
|
|
|
minWidth: 150,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'flex-end',
|
|
|
|
},
|
|
|
|
activityIndicator: {
|
|
|
|
marginVertical: 20,
|
|
|
|
},
|
|
|
|
listHeader: {
|
|
|
|
marginLeft: 16,
|
|
|
|
marginRight: 16,
|
|
|
|
marginVertical: 16,
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-around',
|
|
|
|
},
|
|
|
|
listHeaderTextRow: {
|
|
|
|
flex: 1,
|
|
|
|
marginHorizontal: 16,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
},
|
|
|
|
listHeaderText: {
|
|
|
|
marginTop: 8,
|
|
|
|
marginBottom: 8,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 24,
|
|
|
|
},
|
|
|
|
marketplaceButton1: {
|
|
|
|
borderRadius: 9,
|
|
|
|
minHeight: 49,
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignSelf: 'auto',
|
|
|
|
flexGrow: 1,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
},
|
|
|
|
marketplaceButton2: {
|
|
|
|
borderRadius: 9,
|
|
|
|
minHeight: 49,
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignSelf: 'auto',
|
|
|
|
flexGrow: 1,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
},
|
|
|
|
marketpalceText1: {
|
|
|
|
fontSize: 18,
|
|
|
|
},
|
|
|
|
marketpalceText2: {
|
|
|
|
fontSize: 18,
|
|
|
|
marginHorizontal: 8,
|
|
|
|
},
|
|
|
|
list: {
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
emptyTxs: {
|
|
|
|
fontSize: 18,
|
|
|
|
color: '#9aa0aa',
|
|
|
|
textAlign: 'center',
|
|
|
|
marginVertical: 16,
|
|
|
|
},
|
|
|
|
emptyTxsLightning: {
|
|
|
|
fontSize: 18,
|
|
|
|
color: '#9aa0aa',
|
|
|
|
textAlign: 'center',
|
|
|
|
fontWeight: '600',
|
|
|
|
},
|
|
|
|
buyBitcoin: {
|
|
|
|
backgroundColor: '#007AFF',
|
|
|
|
minWidth: 260,
|
|
|
|
borderRadius: 8,
|
|
|
|
alignSelf: 'center',
|
|
|
|
paddingVertical: 14,
|
|
|
|
paddingHorizontal: 32,
|
|
|
|
},
|
|
|
|
buyBitcoinText: {
|
|
|
|
fontSize: 15,
|
|
|
|
color: '#fff',
|
|
|
|
textAlign: 'center',
|
|
|
|
fontWeight: '600',
|
|
|
|
},
|
|
|
|
sendIcon: {
|
|
|
|
transform: [{ rotate: '225deg' }],
|
|
|
|
},
|
|
|
|
receiveIcon: {
|
|
|
|
transform: [{ rotate: '-45deg' }],
|
|
|
|
},
|
|
|
|
});
|