2019-01-09 14:45:02 +01:00
|
|
|
/* eslint react/prop-types: 0 */
|
2019-01-26 06:27:25 +01:00
|
|
|
/* global alert */
|
2018-01-30 23:42:38 +01:00
|
|
|
/** @type {AppStorage} */
|
2018-03-17 21:39:21 +01:00
|
|
|
import React, { Component } from 'react';
|
2018-06-25 00:22:46 +02:00
|
|
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
2018-12-25 15:16:23 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2019-01-31 01:56:34 +01:00
|
|
|
import { Icon, FormLabel, FormInput, Text, Header, List, ListItem } from 'react-native-elements';
|
2018-12-12 04:33:28 +01:00
|
|
|
import {
|
|
|
|
TouchableOpacity,
|
|
|
|
TouchableWithoutFeedback,
|
|
|
|
Animated,
|
|
|
|
ActivityIndicator,
|
|
|
|
View,
|
2019-08-06 00:25:36 +02:00
|
|
|
KeyboardAvoidingView,
|
2019-01-21 16:57:02 +01:00
|
|
|
UIManager,
|
2018-12-12 04:33:28 +01:00
|
|
|
StyleSheet,
|
|
|
|
Dimensions,
|
|
|
|
Image,
|
2019-02-09 21:46:43 +01:00
|
|
|
Keyboard,
|
2018-12-12 04:33:28 +01:00
|
|
|
SafeAreaView,
|
2019-08-31 08:54:11 +02:00
|
|
|
InteractionManager,
|
2019-01-31 07:52:21 +01:00
|
|
|
InputAccessoryView,
|
2018-12-12 04:33:28 +01:00
|
|
|
Clipboard,
|
|
|
|
Platform,
|
2018-12-23 05:13:58 +01:00
|
|
|
TextInput,
|
2018-12-12 04:33:28 +01:00
|
|
|
} from 'react-native';
|
2018-12-11 23:52:46 +01:00
|
|
|
import LinearGradient from 'react-native-linear-gradient';
|
2019-01-25 05:46:03 +01:00
|
|
|
import { LightningCustodianWallet } from './class';
|
2018-06-25 00:22:46 +02:00
|
|
|
import Carousel from 'react-native-snap-carousel';
|
2018-12-25 15:16:23 +01:00
|
|
|
import { BitcoinUnit } from './models/bitcoinUnits';
|
2019-01-24 08:36:01 +01:00
|
|
|
import NavigationService from './NavigationService';
|
2019-01-26 06:27:25 +01:00
|
|
|
import ImagePicker from 'react-native-image-picker';
|
2019-01-25 05:46:03 +01:00
|
|
|
import WalletGradient from './class/walletGradient';
|
2019-08-04 07:01:29 +02:00
|
|
|
import ToolTip from 'react-native-tooltip';
|
2019-08-03 23:29:15 +02:00
|
|
|
import { BlurView } from '@react-native-community/blur';
|
2019-08-04 07:01:29 +02:00
|
|
|
import showPopupMenu from 'react-native-popup-menu-android';
|
2019-08-27 06:05:27 +02:00
|
|
|
import NetworkTransactionFees, { NetworkTransactionFeeType } from './models/networkTransactionFees';
|
2019-01-26 06:27:25 +01:00
|
|
|
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
|
2018-06-25 00:22:46 +02:00
|
|
|
let loc = require('./loc/');
|
2018-05-22 19:10:53 +02:00
|
|
|
/** @type {AppStorage} */
|
2018-03-17 21:39:21 +01:00
|
|
|
let BlueApp = require('./BlueApp');
|
2018-05-12 22:27:34 +02:00
|
|
|
const { height, width } = Dimensions.get('window');
|
|
|
|
const aspectRatio = height / width;
|
2019-05-02 22:33:03 +02:00
|
|
|
const BigNumber = require('bignumber.js');
|
2018-05-12 22:27:34 +02:00
|
|
|
let isIpad;
|
|
|
|
if (aspectRatio > 1.6) {
|
|
|
|
isIpad = false;
|
|
|
|
} else {
|
|
|
|
isIpad = true;
|
|
|
|
}
|
2018-01-30 23:42:38 +01:00
|
|
|
|
|
|
|
export class BlueButton extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2019-03-29 15:06:09 +01:00
|
|
|
let backgroundColor = this.props.backgroundColor ? this.props.backgroundColor : BlueApp.settings.buttonBackgroundColor;
|
|
|
|
let fontColor = BlueApp.settings.buttonTextColor;
|
2019-01-30 01:50:50 +01:00
|
|
|
if (this.props.hasOwnProperty('disabled') && this.props.disabled === true) {
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor = BlueApp.settings.buttonDisabledBackgroundColor;
|
|
|
|
fontColor = BlueApp.settings.buttonDisabledTextColor;
|
2019-01-30 01:50:50 +01:00
|
|
|
}
|
2019-03-02 13:13:12 +01:00
|
|
|
let buttonWidth = width / 1.5;
|
|
|
|
if (this.props.hasOwnProperty('noMinWidth')) {
|
|
|
|
buttonWidth = 0;
|
|
|
|
}
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
2019-01-24 20:31:30 +01:00
|
|
|
<TouchableOpacity
|
2018-03-17 21:39:21 +01:00
|
|
|
style={{
|
2019-01-24 20:31:30 +01:00
|
|
|
flex: 1,
|
2018-03-17 21:39:21 +01:00
|
|
|
borderWidth: 0.7,
|
2018-06-30 15:36:13 +02:00
|
|
|
borderColor: 'transparent',
|
2019-01-30 01:50:50 +01:00
|
|
|
backgroundColor: backgroundColor,
|
2019-01-24 20:31:30 +01:00
|
|
|
minHeight: 45,
|
|
|
|
height: 45,
|
2019-01-25 19:56:43 +01:00
|
|
|
maxHeight: 45,
|
2019-01-24 20:31:30 +01:00
|
|
|
borderRadius: 25,
|
2019-03-02 13:13:12 +01:00
|
|
|
minWidth: buttonWidth,
|
2019-01-24 20:31:30 +01:00
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
2018-03-17 21:39:21 +01:00
|
|
|
}}
|
2019-01-24 19:44:33 +01:00
|
|
|
{...this.props}
|
2019-01-24 20:31:30 +01:00
|
|
|
>
|
|
|
|
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
|
|
|
|
{this.props.icon && <Icon name={this.props.icon.name} type={this.props.icon.type} color={this.props.icon.color} />}
|
2019-01-30 01:50:50 +01:00
|
|
|
{this.props.title && <Text style={{ marginHorizontal: 8, fontSize: 16, color: fontColor }}>{this.props.title}</Text>}
|
2019-01-24 20:31:30 +01:00
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
2018-07-14 20:54:27 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BitcoinButton extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => {
|
|
|
|
// eslint-disable-next-line
|
|
|
|
if (this.props.onPress) this.props.onPress();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
// eslint-disable-next-line
|
2019-05-20 19:49:12 +02:00
|
|
|
borderColor: BlueApp.settings.hdborderColor,
|
|
|
|
borderWidth: 1,
|
2018-07-14 20:54:27 +02:00
|
|
|
borderRadius: 5,
|
2019-05-20 19:49:12 +02:00
|
|
|
backgroundColor: (this.props.active && BlueApp.settings.hdbackgroundColor) || BlueApp.settings.brandingColor,
|
2018-07-14 20:54:27 +02:00
|
|
|
// eslint-disable-next-line
|
2019-05-20 19:49:12 +02:00
|
|
|
minWidth: this.props.style.width,
|
2018-07-14 20:54:27 +02:00
|
|
|
// eslint-disable-next-line
|
2019-05-20 19:49:12 +02:00
|
|
|
minHeight: this.props.style.height,
|
2018-07-14 20:54:27 +02:00
|
|
|
height: this.props.style.height,
|
2019-05-20 19:49:12 +02:00
|
|
|
flex: 1,
|
2018-07-14 20:54:27 +02:00
|
|
|
}}
|
|
|
|
>
|
2019-05-20 19:49:12 +02:00
|
|
|
<View style={{ marginTop: 16, marginLeft: 16, marginBottom: 16 }}>
|
|
|
|
<Text style={{ color: BlueApp.settings.hdborderColor, fontWeight: 'bold' }}>{loc.wallets.add.bitcoin}</Text>
|
2018-07-14 20:54:27 +02:00
|
|
|
</View>
|
2019-05-20 19:49:12 +02:00
|
|
|
<Image
|
|
|
|
style={{ width: 34, height: 34, marginRight: 8, marginBottom: 8, justifyContent: 'flex-end', alignSelf: 'flex-end' }}
|
|
|
|
source={require('./img/addWallet/bitcoin.png')}
|
|
|
|
/>
|
2018-07-14 20:54:27 +02:00
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class LightningButton extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => {
|
|
|
|
// eslint-disable-next-line
|
|
|
|
if (this.props.onPress) this.props.onPress();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
// eslint-disable-next-line
|
2019-05-20 19:49:12 +02:00
|
|
|
borderColor: BlueApp.settings.lnborderColor,
|
|
|
|
borderWidth: 1,
|
2018-07-14 20:54:27 +02:00
|
|
|
borderRadius: 5,
|
2019-05-20 19:49:12 +02:00
|
|
|
backgroundColor: (this.props.active && BlueApp.settings.lnbackgroundColor) || BlueApp.settings.brandingColor,
|
2018-07-14 20:54:27 +02:00
|
|
|
// eslint-disable-next-line
|
2019-05-20 19:49:12 +02:00
|
|
|
minWidth: this.props.style.width,
|
2018-07-14 20:54:27 +02:00
|
|
|
// eslint-disable-next-line
|
2019-05-20 19:49:12 +02:00
|
|
|
minHeight: this.props.style.height,
|
2018-07-14 20:54:27 +02:00
|
|
|
height: this.props.style.height,
|
2019-05-20 19:49:12 +02:00
|
|
|
flex: 1,
|
2018-07-14 20:54:27 +02:00
|
|
|
}}
|
|
|
|
>
|
2019-05-20 19:49:12 +02:00
|
|
|
<View style={{ marginTop: 16, marginLeft: 16, marginBottom: 16 }}>
|
|
|
|
<Text style={{ color: BlueApp.settings.lnborderColor, fontWeight: 'bold' }}>{loc.wallets.add.lightning}</Text>
|
2018-07-14 20:54:27 +02:00
|
|
|
</View>
|
2019-05-22 14:09:00 +02:00
|
|
|
<Image
|
|
|
|
style={{ width: 34, height: 34, marginRight: 8, marginBottom: 8, justifyContent: 'flex-end', alignSelf: 'flex-end' }}
|
|
|
|
source={require('./img/addWallet/lightning.png')}
|
|
|
|
/>
|
2018-07-14 20:54:27 +02:00
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-04 07:01:29 +02:00
|
|
|
export class BlueWalletNavigationHeader extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
wallet: PropTypes.shape().isRequired,
|
2019-08-04 08:42:05 +02:00
|
|
|
onWalletUnitChange: PropTypes.func,
|
2019-08-04 07:01:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static getDerivedStateFromProps(props, _state) {
|
2019-08-04 08:42:05 +02:00
|
|
|
return { wallet: props.wallet, onWalletUnitChange: props.onWalletUnitChange };
|
2019-08-04 07:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = { wallet: props.wallet, walletPreviousPreferredUnit: props.wallet.getPreferredBalanceUnit() };
|
|
|
|
}
|
|
|
|
|
|
|
|
handleCopyPress = _item => {
|
|
|
|
Clipboard.setString(loc.formatBalance(this.state.wallet.getBalance(), this.state.wallet.getPreferredBalanceUnit()).toString());
|
|
|
|
};
|
|
|
|
|
|
|
|
handleBalanceVisibility = async _item => {
|
|
|
|
const wallet = this.state.wallet;
|
|
|
|
wallet.hideBalance = !wallet.hideBalance;
|
|
|
|
this.setState({ wallet });
|
|
|
|
await BlueApp.saveToDisk();
|
|
|
|
};
|
|
|
|
|
|
|
|
showAndroidTooltip = () => {
|
|
|
|
showPopupMenu(this.toolTipMenuOptions(), this.handleToolTipSelection, this.walletBalanceText);
|
|
|
|
};
|
|
|
|
|
|
|
|
handleToolTipSelection = item => {
|
|
|
|
if (item === loc.transactions.details.copy || item.id === loc.transactions.details.copy) {
|
|
|
|
this.handleCopyPress();
|
|
|
|
} else if (item === 'balancePrivacy' || item.id === 'balancePrivacy') {
|
|
|
|
this.handleBalanceVisibility();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
toolTipMenuOptions() {
|
|
|
|
return Platform.select({
|
|
|
|
// NOT WORKING ATM.
|
|
|
|
// ios: [
|
|
|
|
// { text: this.state.wallet.hideBalance ? 'Show Balance' : 'Hide Balance', onPress: this.handleBalanceVisibility },
|
|
|
|
// { text: loc.transactions.details.copy, onPress: this.handleCopyPress },
|
|
|
|
// ],
|
|
|
|
android: this.state.wallet.hideBalance
|
|
|
|
? [{ id: 'balancePrivacy', label: this.state.wallet.hideBalance ? 'Show Balance' : 'Hide Balance' }]
|
|
|
|
: [
|
|
|
|
{ id: 'balancePrivacy', label: this.state.wallet.hideBalance ? 'Show Balance' : 'Hide Balance' },
|
|
|
|
{ id: loc.transactions.details.copy, label: loc.transactions.details.copy },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
changeWalletBalanceUnit() {
|
|
|
|
let walletPreviousPreferredUnit = this.state.wallet.getPreferredBalanceUnit();
|
|
|
|
const wallet = this.state.wallet;
|
|
|
|
if (walletPreviousPreferredUnit === BitcoinUnit.BTC) {
|
|
|
|
wallet.preferredBalanceUnit = BitcoinUnit.SATS;
|
|
|
|
walletPreviousPreferredUnit = BitcoinUnit.BTC;
|
|
|
|
} else if (walletPreviousPreferredUnit === BitcoinUnit.SATS) {
|
|
|
|
wallet.preferredBalanceUnit = BitcoinUnit.LOCAL_CURRENCY;
|
|
|
|
walletPreviousPreferredUnit = BitcoinUnit.SATS;
|
|
|
|
} else if (walletPreviousPreferredUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
|
|
|
wallet.preferredBalanceUnit = BitcoinUnit.BTC;
|
|
|
|
walletPreviousPreferredUnit = BitcoinUnit.BTC;
|
|
|
|
} else {
|
|
|
|
wallet.preferredBalanceUnit = BitcoinUnit.BTC;
|
|
|
|
walletPreviousPreferredUnit = BitcoinUnit.BTC;
|
|
|
|
}
|
|
|
|
|
2019-08-31 08:54:11 +02:00
|
|
|
this.setState({ wallet, walletPreviousPreferredUnit: walletPreviousPreferredUnit }, () => {
|
|
|
|
this.props.onWalletUnitChange(wallet);
|
2019-08-04 08:42:05 +02:00
|
|
|
});
|
2019-08-04 07:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<LinearGradient
|
|
|
|
colors={WalletGradient.gradientsFor(this.state.wallet.type)}
|
|
|
|
style={{ padding: 15, minHeight: 140, justifyContent: 'center' }}
|
|
|
|
>
|
|
|
|
<Image
|
|
|
|
source={
|
2019-08-04 08:42:05 +02:00
|
|
|
(LightningCustodianWallet.type === this.state.wallet.type && require('./img/lnd-shape.png')) || require('./img/btc-shape.png')
|
2019-08-04 07:01:29 +02:00
|
|
|
}
|
|
|
|
style={{
|
|
|
|
width: 99,
|
|
|
|
height: 94,
|
|
|
|
position: 'absolute',
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 19,
|
|
|
|
color: '#fff',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.state.wallet.getLabel()}
|
|
|
|
</Text>
|
|
|
|
{Platform.OS === 'ios' && (
|
|
|
|
<ToolTip
|
|
|
|
ref={tooltip => (this.tooltip = tooltip)}
|
|
|
|
actions={
|
|
|
|
this.state.wallet.hideBalance
|
|
|
|
? [{ text: this.state.wallet.hideBalance ? 'Show Balance' : 'Hide Balance', onPress: this.handleBalanceVisibility }]
|
|
|
|
: [
|
|
|
|
{ text: this.state.wallet.hideBalance ? 'Show Balance' : 'Hide Balance', onPress: this.handleBalanceVisibility },
|
|
|
|
{ text: loc.transactions.details.copy, onPress: this.handleCopyPress },
|
|
|
|
]
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<TouchableOpacity
|
|
|
|
style={styles.balance}
|
|
|
|
onPress={() => this.changeWalletBalanceUnit()}
|
|
|
|
ref={ref => (this.walletBalanceText = ref)}
|
|
|
|
onLongPress={() => (Platform.OS === 'ios' ? this.tooltip.showMenu() : this.showAndroidTooltip())}
|
|
|
|
>
|
|
|
|
{this.state.wallet.hideBalance ? (
|
|
|
|
<BluePrivateBalance />
|
|
|
|
) : (
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
adjustsFontSizeToFit
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 36,
|
|
|
|
color: '#fff',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.formatBalance(this.state.wallet.getBalance(), this.state.wallet.getPreferredBalanceUnit(), true).toString()}
|
|
|
|
</Text>
|
|
|
|
)}
|
|
|
|
</TouchableOpacity>
|
|
|
|
{this.state.wallet.type === LightningCustodianWallet.type && (
|
2019-08-26 18:02:15 +02:00
|
|
|
<TouchableOpacity onPress={() => NavigationService.navigate('ManageFunds', { fromWallet: this.state.wallet })}>
|
2019-08-04 07:01:29 +02:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
marginTop: 14,
|
|
|
|
marginBottom: 10,
|
|
|
|
backgroundColor: 'rgba(255,255,255,0.2)',
|
|
|
|
borderRadius: 9,
|
|
|
|
minWidth: 119,
|
|
|
|
minHeight: 39,
|
|
|
|
width: 119,
|
|
|
|
height: 39,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontWeight: '500',
|
|
|
|
fontSize: 14,
|
|
|
|
color: '#FFFFFF',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.lnd.title}
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
)}
|
|
|
|
</LinearGradient>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-14 20:54:27 +02:00
|
|
|
export class BlueButtonLink extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2019-01-31 01:56:34 +01:00
|
|
|
<TouchableOpacity
|
2018-07-14 20:54:27 +02:00
|
|
|
style={{
|
2019-01-31 01:56:34 +01:00
|
|
|
minHeight: 60,
|
|
|
|
minWidth: 100,
|
|
|
|
height: 60,
|
|
|
|
justifyContent: 'center',
|
2018-07-14 20:54:27 +02:00
|
|
|
}}
|
2019-01-31 01:56:34 +01:00
|
|
|
{...this.props}
|
|
|
|
>
|
2019-03-29 15:06:09 +01:00
|
|
|
<Text style={{ color: BlueApp.settings.foregroundColor, textAlign: 'center', fontSize: 16 }}>{this.props.title}</Text>
|
2019-01-31 01:56:34 +01:00
|
|
|
</TouchableOpacity>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-11 23:52:46 +01:00
|
|
|
export const BlueNavigationStyle = (navigation, withNavigationCloseButton = false, customCloseButtonFunction = undefined) => ({
|
2018-10-29 23:11:48 +01:00
|
|
|
headerStyle: {
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.brandingColor,
|
2018-10-29 23:11:48 +01:00
|
|
|
borderBottomWidth: 0,
|
2018-12-11 23:52:46 +01:00
|
|
|
elevation: 0,
|
2018-10-29 23:11:48 +01:00
|
|
|
},
|
|
|
|
headerTitleStyle: {
|
|
|
|
fontWeight: '600',
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.foregroundColor,
|
2018-10-29 23:11:48 +01:00
|
|
|
},
|
2019-03-29 15:06:09 +01:00
|
|
|
headerTintColor: BlueApp.settings.foregroundColor,
|
2018-10-29 23:11:48 +01:00
|
|
|
headerRight: withNavigationCloseButton ? (
|
2018-12-11 23:52:46 +01:00
|
|
|
<TouchableOpacity
|
|
|
|
style={{ width: 40, height: 40, padding: 14 }}
|
2019-02-10 12:39:26 +01:00
|
|
|
onPress={
|
|
|
|
customCloseButtonFunction === undefined
|
|
|
|
? () => {
|
|
|
|
Keyboard.dismiss();
|
|
|
|
navigation.goBack(null);
|
|
|
|
}
|
|
|
|
: customCloseButtonFunction
|
|
|
|
}
|
2018-12-11 23:52:46 +01:00
|
|
|
>
|
2018-11-10 00:44:34 +01:00
|
|
|
<Image style={{ alignSelf: 'center' }} source={require('./img/close.png')} />
|
2018-10-29 23:11:48 +01:00
|
|
|
</TouchableOpacity>
|
|
|
|
) : null,
|
|
|
|
headerBackTitle: null,
|
|
|
|
});
|
|
|
|
|
2019-09-03 05:28:52 +02:00
|
|
|
export const BlueCreateTxNavigationStyle = (navigation, withAdvancedOptionsMenuButton = false, advancedOptionsMenuButtonAction) => ({
|
|
|
|
headerStyle: {
|
|
|
|
backgroundColor: BlueApp.settings.brandingColor,
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
elevation: 0,
|
|
|
|
},
|
|
|
|
headerTitleStyle: {
|
|
|
|
fontWeight: '600',
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
},
|
|
|
|
headerTintColor: BlueApp.settings.foregroundColor,
|
|
|
|
headerLeft: (
|
|
|
|
<TouchableOpacity
|
|
|
|
style={{ minWwidth: 40, height: 40, padding: 14 }}
|
|
|
|
onPress={() => {
|
|
|
|
Keyboard.dismiss();
|
|
|
|
navigation.goBack(null);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Image style={{ alignSelf: 'center' }} source={require('./img/close.png')} />
|
|
|
|
</TouchableOpacity>
|
|
|
|
),
|
|
|
|
headerRight: withAdvancedOptionsMenuButton ? (
|
|
|
|
<TouchableOpacity style={{ minWidth: 40, height: 40, padding: 14 }} onPress={advancedOptionsMenuButtonAction}>
|
|
|
|
<Icon size={22} name="kebab-horizontal" type="octicon" color={BlueApp.settings.foregroundColor} />
|
|
|
|
</TouchableOpacity>
|
|
|
|
) : null,
|
|
|
|
headerBackTitle: null,
|
|
|
|
});
|
|
|
|
|
2019-08-03 23:29:15 +02:00
|
|
|
export const BluePrivateBalance = () => {
|
|
|
|
return Platform.select({
|
|
|
|
ios: (
|
|
|
|
<View style={{ flexDirection: 'row' }}>
|
|
|
|
<BlurView style={styles.balanceBlur} blurType="light" blurAmount={25} />
|
|
|
|
<Icon name="eye-slash" type="font-awesome" color="#FFFFFF" />
|
|
|
|
</View>
|
|
|
|
),
|
|
|
|
android: (
|
|
|
|
<View style={{ flexDirection: 'row' }}>
|
|
|
|
<View style={{ backgroundColor: '#FFFFFF', opacity: 0.5, height: 30, width: 100, marginRight: 8 }} />
|
|
|
|
<Icon name="eye-slash" type="font-awesome" color="#FFFFFF" />
|
|
|
|
</View>
|
|
|
|
),
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-09-29 06:58:09 +02:00
|
|
|
export const BlueCopyToClipboardButton = ({ stringToCopy }) => {
|
|
|
|
return (
|
|
|
|
<TouchableOpacity {...this.props} onPress={() => Clipboard.setString(stringToCopy)}>
|
|
|
|
<Text style={{ fontSize: 13, fontWeight: '400', color: '#68bbe1' }}>{loc.transactions.details.copy}</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-01-21 14:55:39 +01:00
|
|
|
export class BlueCopyTextToClipboard extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
text: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
text: '',
|
|
|
|
};
|
|
|
|
|
2019-02-02 04:45:18 +01:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2019-01-31 07:52:21 +01:00
|
|
|
if (Platform.OS === 'android') {
|
|
|
|
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
|
|
}
|
2019-02-02 04:45:18 +01:00
|
|
|
this.state = { hasTappedText: false, address: props.text };
|
2019-01-21 16:57:02 +01:00
|
|
|
}
|
|
|
|
|
2019-05-02 22:33:03 +02:00
|
|
|
static getDerivedStateFromProps(props, state) {
|
|
|
|
if (state.hasTappedText) {
|
|
|
|
return { hasTappedText: state.hasTappedText, address: state.address };
|
|
|
|
} else {
|
|
|
|
return { hasTappedText: state.hasTappedText, address: props.text };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-21 14:55:39 +01:00
|
|
|
copyToClipboard = () => {
|
2019-02-02 04:45:18 +01:00
|
|
|
this.setState({ hasTappedText: true }, () => {
|
2019-01-21 14:55:39 +01:00
|
|
|
Clipboard.setString(this.props.text);
|
2019-02-02 04:45:18 +01:00
|
|
|
this.setState({ address: loc.wallets.xpub.copiedToClipboard }, () => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.setState({ hasTappedText: false, address: this.props.text });
|
|
|
|
}, 1000);
|
|
|
|
});
|
2019-01-21 14:55:39 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View style={{ justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16 }}>
|
|
|
|
<TouchableOpacity onPress={this.copyToClipboard} disabled={this.state.hasTappedText}>
|
2019-02-02 04:45:18 +01:00
|
|
|
<Animated.Text style={styleCopyTextToClipboard.address} numberOfLines={0}>
|
|
|
|
{this.state.address}
|
|
|
|
</Animated.Text>
|
2019-01-21 14:55:39 +01:00
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const styleCopyTextToClipboard = StyleSheet.create({
|
|
|
|
address: {
|
|
|
|
marginVertical: 32,
|
|
|
|
fontSize: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
color: '#9aa0aa',
|
2019-01-21 14:55:39 +01:00
|
|
|
textAlign: 'center',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-01-30 23:42:38 +01:00
|
|
|
export class SafeBlueArea extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
|
|
|
<SafeAreaView
|
|
|
|
{...this.props}
|
2018-03-17 21:39:21 +01:00
|
|
|
forceInset={{ horizontal: 'always' }}
|
|
|
|
style={{ flex: 1, backgroundColor: BlueApp.settings.brandingColor }}
|
2018-01-30 23:42:38 +01:00
|
|
|
/>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueCard extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-09-22 13:26:45 +02:00
|
|
|
return <View {...this.props} style={{ padding: 20 }} />;
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueText extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-09-01 01:28:19 +02:00
|
|
|
return (
|
|
|
|
<Text
|
2019-01-24 20:48:40 +01:00
|
|
|
style={{
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
|
2018-09-01 01:28:19 +02:00
|
|
|
// eslint-disable-next-line
|
2019-01-24 20:48:40 +01:00
|
|
|
...this.props.style,
|
|
|
|
}}
|
2018-12-11 23:52:46 +01:00
|
|
|
{...this.props}
|
2018-09-01 01:28:19 +02:00
|
|
|
/>
|
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
2018-07-14 20:54:27 +02:00
|
|
|
export class BlueTextCentered extends Component {
|
|
|
|
render() {
|
|
|
|
return <Text {...this.props} style={{ color: BlueApp.settings.foregroundColor, textAlign: 'center' }} />;
|
|
|
|
}
|
|
|
|
}
|
2018-01-30 23:42:38 +01:00
|
|
|
|
|
|
|
export class BlueListItem extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
|
|
|
<ListItem
|
2018-09-29 00:17:26 +02:00
|
|
|
bottomDivider
|
2018-05-06 19:36:48 +02:00
|
|
|
containerStyle={{
|
2018-06-25 00:22:46 +02:00
|
|
|
backgroundColor: 'transparent',
|
2018-09-29 00:17:26 +02:00
|
|
|
borderBottomStartRadius: 20,
|
|
|
|
borderBottomEndRadius: 20,
|
|
|
|
borderBottomColor: '#ededed',
|
2018-05-06 19:36:48 +02:00
|
|
|
}}
|
2018-06-25 00:22:46 +02:00
|
|
|
titleStyle={{
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: '500',
|
|
|
|
}}
|
2019-03-29 15:06:09 +01:00
|
|
|
subtitleStyle={{ color: BlueApp.settings.alternativeTextColor }}
|
2018-09-29 17:35:04 +02:00
|
|
|
subtitleNumberOfLines={1}
|
2018-09-30 10:31:09 +02:00
|
|
|
{...this.props}
|
2018-01-30 23:42:38 +01:00
|
|
|
/>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueFormLabel extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-07-14 20:54:27 +02:00
|
|
|
return <FormLabel {...this.props} labelStyle={{ color: BlueApp.settings.foregroundColor, fontWeight: '400' }} />;
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueFormInput extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-05-06 19:14:22 +02:00
|
|
|
return (
|
|
|
|
<FormInput
|
|
|
|
{...this.props}
|
2018-07-22 16:49:59 +02:00
|
|
|
inputStyle={{ color: BlueApp.settings.foregroundColor, maxWidth: width - 105 }}
|
|
|
|
containerStyle={{
|
|
|
|
marginTop: 5,
|
2019-03-29 15:06:09 +01:00
|
|
|
borderColor: BlueApp.settings.inputBorderColor,
|
|
|
|
borderBottomColor: BlueApp.settings.inputBorderColor,
|
2018-07-22 16:49:59 +02:00
|
|
|
borderWidth: 0.5,
|
|
|
|
borderBottomWidth: 0.5,
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.inputBackgroundColor,
|
2018-07-22 16:49:59 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueFormMultiInput extends Component {
|
2019-02-28 01:45:44 +01:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
selection: { start: 0, end: 0 },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-07-22 16:49:59 +02:00
|
|
|
render() {
|
|
|
|
return (
|
2018-12-23 05:13:58 +01:00
|
|
|
<TextInput
|
2018-07-22 16:49:59 +02:00
|
|
|
multiline
|
2018-11-01 20:44:39 +01:00
|
|
|
underlineColorAndroid="transparent"
|
2018-07-22 16:49:59 +02:00
|
|
|
numberOfLines={4}
|
2018-12-23 05:13:58 +01:00
|
|
|
style={{
|
2018-07-14 20:54:27 +02:00
|
|
|
marginTop: 5,
|
2018-12-23 05:13:58 +01:00
|
|
|
marginHorizontal: 20,
|
2019-03-29 15:06:09 +01:00
|
|
|
borderColor: BlueApp.settings.inputBorderColor,
|
|
|
|
borderBottomColor: BlueApp.settings.inputBorderColor,
|
2018-07-14 20:54:27 +02:00
|
|
|
borderWidth: 0.5,
|
2018-05-22 19:12:16 +02:00
|
|
|
borderBottomWidth: 0.5,
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.inputBackgroundColor,
|
2018-12-23 05:13:58 +01:00
|
|
|
height: 200,
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
2018-05-22 19:12:16 +02:00
|
|
|
}}
|
2018-12-23 05:13:58 +01:00
|
|
|
autoCorrect={false}
|
|
|
|
autoCapitalize="none"
|
|
|
|
spellCheck={false}
|
2018-12-22 17:51:07 +01:00
|
|
|
{...this.props}
|
2019-02-28 01:45:44 +01:00
|
|
|
selectTextOnFocus={false}
|
|
|
|
keyboardType={Platform.OS === 'android' ? 'visible-password' : 'default'}
|
2018-05-06 19:14:22 +02:00
|
|
|
/>
|
|
|
|
);
|
2018-05-06 19:12:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-30 23:42:38 +01:00
|
|
|
export class BlueHeader extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
|
|
|
<Header
|
|
|
|
{...this.props}
|
2018-06-25 00:22:46 +02:00
|
|
|
backgroundColor="transparent"
|
|
|
|
outerContainerStyles={{
|
|
|
|
borderBottomColor: 'transparent',
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
}}
|
2018-06-28 03:43:28 +02:00
|
|
|
statusBarProps={{ barStyle: 'default' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueHeaderDefaultSub extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2019-03-29 15:06:09 +01:00
|
|
|
<SafeAreaView style={{ backgroundColor: BlueApp.settings.brandingColor }}>
|
2018-09-19 03:59:16 +02:00
|
|
|
<Header
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor={BlueApp.settings.brandingColor}
|
2018-09-19 03:59:16 +02:00
|
|
|
outerContainerStyles={{
|
|
|
|
borderBottomColor: 'transparent',
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
}}
|
|
|
|
statusBarProps={{ barStyle: 'default' }}
|
|
|
|
leftComponent={
|
|
|
|
<Text
|
2018-10-04 03:49:29 +02:00
|
|
|
adjustsFontSizeToFit
|
2018-09-19 03:59:16 +02:00
|
|
|
style={{
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 34,
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{
|
|
|
|
// eslint-disable-next-line
|
|
|
|
this.props.leftText
|
|
|
|
}
|
|
|
|
</Text>
|
|
|
|
}
|
|
|
|
rightComponent={
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => {
|
|
|
|
// eslint-disable-next-line
|
|
|
|
if (this.props.onClose) this.props.onClose();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View style={stylesBlueIcon.box}>
|
|
|
|
<View style={stylesBlueIcon.ballTransparrent}>
|
2018-11-01 20:44:39 +01:00
|
|
|
<Image source={require('./img/close.png')} />
|
2018-09-19 03:59:16 +02:00
|
|
|
</View>
|
2018-06-28 03:43:28 +02:00
|
|
|
</View>
|
2018-09-19 03:59:16 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
}
|
2018-09-30 10:31:09 +02:00
|
|
|
{...this.props}
|
2018-09-19 03:59:16 +02:00
|
|
|
/>
|
|
|
|
</SafeAreaView>
|
2018-06-28 03:43:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueHeaderDefaultMain extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2019-03-29 15:06:09 +01:00
|
|
|
<SafeAreaView style={{ backgroundColor: BlueApp.settings.brandingColor }}>
|
2018-09-30 11:56:32 +02:00
|
|
|
<Header
|
|
|
|
{...this.props}
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor={BlueApp.settings.brandingColor}
|
2018-09-30 11:56:32 +02:00
|
|
|
outerContainerStyles={{
|
|
|
|
borderBottomColor: 'transparent',
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
}}
|
|
|
|
statusBarProps={{ barStyle: 'default' }}
|
|
|
|
leftComponent={
|
|
|
|
<Text
|
2018-10-04 03:49:29 +02:00
|
|
|
numberOfLines={0}
|
2018-09-30 11:56:32 +02:00
|
|
|
style={{
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 34,
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{
|
|
|
|
// eslint-disable-next-line
|
|
|
|
this.props.leftText
|
|
|
|
}
|
|
|
|
</Text>
|
|
|
|
}
|
|
|
|
rightComponent={
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={this.props.onNewWalletPress}
|
|
|
|
style={{
|
|
|
|
height: 48,
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<BluePlusIcon />
|
|
|
|
</TouchableOpacity>
|
|
|
|
}
|
|
|
|
/>
|
2018-09-19 03:59:16 +02:00
|
|
|
</SafeAreaView>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueSpacing extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-07-07 15:04:32 +02:00
|
|
|
return <View {...this.props} style={{ height: 60, backgroundColor: BlueApp.settings.brandingColor }} />;
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
2018-06-29 00:17:14 +02:00
|
|
|
|
2018-05-12 22:27:34 +02:00
|
|
|
export class BlueSpacing40 extends Component {
|
|
|
|
render() {
|
2018-07-07 15:04:32 +02:00
|
|
|
return <View {...this.props} style={{ height: 50, backgroundColor: BlueApp.settings.brandingColor }} />;
|
2018-05-12 22:27:34 +02:00
|
|
|
}
|
|
|
|
}
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2018-06-29 00:17:14 +02:00
|
|
|
export class BlueSpacingVariable extends Component {
|
|
|
|
render() {
|
|
|
|
if (isIpad) {
|
|
|
|
return <BlueSpacing40 {...this.props} />;
|
|
|
|
} else {
|
|
|
|
return <BlueSpacing {...this.props} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class is {
|
|
|
|
static ipad() {
|
|
|
|
return isIpad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-30 23:42:38 +01:00
|
|
|
export class BlueSpacing20 extends Component {
|
2018-06-25 00:22:46 +02:00
|
|
|
render() {
|
|
|
|
return <View {...this.props} style={{ height: 20, opacity: 0 }} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-22 14:08:31 +02:00
|
|
|
export class BlueSpacing10 extends Component {
|
|
|
|
render() {
|
|
|
|
return <View {...this.props} style={{ height: 10, opacity: 0 }} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
export class BlueList extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
2018-06-25 00:22:46 +02:00
|
|
|
<List
|
2018-01-30 23:42:38 +01:00
|
|
|
{...this.props}
|
2018-06-25 00:22:46 +02:00
|
|
|
containerStyle={{
|
|
|
|
backgroundColor: BlueApp.settings.brandingColor,
|
|
|
|
borderTopColor: 'transparent',
|
|
|
|
borderTopWidth: 0,
|
2018-09-22 13:26:45 +02:00
|
|
|
flex: 1,
|
2018-06-25 00:22:46 +02:00
|
|
|
}}
|
2018-01-30 23:42:38 +01:00
|
|
|
/>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-31 07:52:21 +01:00
|
|
|
export class BlueUseAllFundsButton extends Component {
|
|
|
|
static InputAccessoryViewID = 'useMaxInputAccessoryViewID';
|
|
|
|
static propTypes = {
|
|
|
|
wallet: PropTypes.shape().isRequired,
|
|
|
|
onUseAllPressed: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2019-08-06 00:25:36 +02:00
|
|
|
const inputView = (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
maxHeight: 44,
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
alignItems: 'center',
|
|
|
|
backgroundColor: '#eef0f4',
|
|
|
|
}}
|
|
|
|
>
|
2019-08-06 20:47:16 +02:00
|
|
|
<View style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'flex-start' }}>
|
2019-08-07 03:42:41 +02:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: BlueApp.settings.alternativeTextColor,
|
|
|
|
fontSize: 16,
|
|
|
|
marginLeft: 8,
|
|
|
|
marginRight: 0,
|
|
|
|
paddingRight: 0,
|
|
|
|
paddingLeft: 0,
|
|
|
|
paddingTop: 12,
|
|
|
|
paddingBottom: 12,
|
|
|
|
}}
|
|
|
|
>
|
2019-08-07 07:45:27 +02:00
|
|
|
Total:
|
2019-01-31 07:52:21 +01:00
|
|
|
</Text>
|
2019-08-07 16:29:28 +02:00
|
|
|
{this.props.wallet.allowSendMax() && this.props.wallet.getBalance() > 0 ? (
|
2019-08-07 03:42:41 +02:00
|
|
|
<BlueButtonLink
|
|
|
|
onPress={this.props.onUseAllPressed}
|
2019-08-07 07:45:27 +02:00
|
|
|
style={{ marginLeft: 8, paddingRight: 0, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
|
|
|
|
title={`${loc.formatBalanceWithoutSuffix(this.props.wallet.getBalance(), BitcoinUnit.BTC, true).toString()} ${
|
|
|
|
BitcoinUnit.BTC
|
|
|
|
}`}
|
2019-08-07 03:42:41 +02:00
|
|
|
/>
|
2019-08-07 07:45:27 +02:00
|
|
|
) : (
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: BlueApp.settings.alternativeTextColor,
|
|
|
|
fontSize: 16,
|
|
|
|
marginLeft: 8,
|
|
|
|
marginRight: 0,
|
|
|
|
paddingRight: 0,
|
|
|
|
paddingLeft: 0,
|
|
|
|
paddingTop: 12,
|
|
|
|
paddingBottom: 12,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.formatBalanceWithoutSuffix(this.props.wallet.getBalance(), BitcoinUnit.BTC, true).toString()} {BitcoinUnit.BTC}
|
|
|
|
</Text>
|
2019-08-06 00:25:36 +02:00
|
|
|
)}
|
2019-01-31 07:52:21 +01:00
|
|
|
</View>
|
2019-08-06 00:25:36 +02:00
|
|
|
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'flex-end' }}>
|
2019-08-07 03:42:41 +02:00
|
|
|
<BlueButtonLink
|
|
|
|
style={{ paddingRight: 8, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
|
|
|
|
title="Done"
|
2019-09-03 05:28:52 +02:00
|
|
|
onPress={() => Keyboard.dismiss()}
|
2019-08-07 03:42:41 +02:00
|
|
|
/>
|
2019-08-06 00:25:36 +02:00
|
|
|
</View>
|
|
|
|
</View>
|
2019-01-31 07:52:21 +01:00
|
|
|
);
|
2019-08-06 00:25:36 +02:00
|
|
|
if (Platform.OS === 'ios') {
|
|
|
|
return <InputAccessoryView nativeID={BlueUseAllFundsButton.InputAccessoryViewID}>{inputView}</InputAccessoryView>;
|
|
|
|
} else {
|
|
|
|
return <KeyboardAvoidingView style={{ height: 44 }}>{inputView}</KeyboardAvoidingView>;
|
|
|
|
}
|
2019-01-31 07:52:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-17 10:23:12 +01:00
|
|
|
export class BlueDismissKeyboardInputAccessory extends Component {
|
|
|
|
static InputAccessoryViewID = 'BlueDismissKeyboardInputAccessory';
|
|
|
|
|
|
|
|
render() {
|
2019-02-21 01:32:17 +01:00
|
|
|
return Platform.OS !== 'ios' ? null : (
|
2019-02-17 10:23:12 +01:00
|
|
|
<InputAccessoryView nativeID={BlueDismissKeyboardInputAccessory.InputAccessoryViewID}>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: '#eef0f4',
|
|
|
|
height: 44,
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-end',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}
|
|
|
|
>
|
2019-08-27 06:05:27 +02:00
|
|
|
<BlueButtonLink title="Done" onPress={() => Keyboard.dismiss()} />
|
2019-02-17 10:23:12 +01:00
|
|
|
</View>
|
|
|
|
</InputAccessoryView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-29 06:18:32 +02:00
|
|
|
export class BlueDoneAndDismissKeyboardInputAccessory extends Component {
|
|
|
|
static InputAccessoryViewID = 'BlueDoneAndDismissKeyboardInputAccessory';
|
|
|
|
|
|
|
|
onPasteTapped = async () => {
|
|
|
|
const clipboard = await Clipboard.getString();
|
|
|
|
this.props.onPasteTapped(clipboard);
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const inputView = (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: '#eef0f4',
|
|
|
|
height: 44,
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'flex-end',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<BlueButtonLink title="Clear" onPress={this.props.onClearTapped} />
|
|
|
|
<BlueButtonLink title="Paste" onPress={this.onPasteTapped} />
|
|
|
|
<BlueButtonLink title="Done" onPress={() => Keyboard.dismiss()} />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (Platform.OS === 'ios') {
|
2019-08-30 02:42:49 +02:00
|
|
|
return <InputAccessoryView nativeID={BlueDoneAndDismissKeyboardInputAccessory.InputAccessoryViewID}>{inputView}</InputAccessoryView>;
|
2019-08-29 06:18:32 +02:00
|
|
|
} else {
|
|
|
|
return <KeyboardAvoidingView style={{ height: 44 }}>{inputView}</KeyboardAvoidingView>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
export class BlueLoading extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-06-25 00:22:46 +02:00
|
|
|
return (
|
|
|
|
<SafeBlueArea>
|
|
|
|
<View style={{ flex: 1, paddingTop: 200 }}>
|
|
|
|
<ActivityIndicator />
|
|
|
|
</View>
|
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
const stylesBlueIcon = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
box1: {
|
|
|
|
position: 'relative',
|
|
|
|
top: 15,
|
|
|
|
},
|
2018-06-28 03:43:28 +02:00
|
|
|
box: {
|
2018-09-19 03:59:16 +02:00
|
|
|
alignSelf: 'flex-end',
|
|
|
|
paddingHorizontal: 14,
|
|
|
|
paddingTop: 8,
|
2018-06-28 03:43:28 +02:00
|
|
|
},
|
2019-01-31 07:52:21 +01:00
|
|
|
boxIncoming: {
|
2018-06-25 00:22:46 +02:00
|
|
|
position: 'relative',
|
|
|
|
},
|
|
|
|
ball: {
|
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
backgroundColor: '#ccddf9',
|
2018-06-25 00:22:46 +02:00
|
|
|
},
|
2019-01-31 07:52:21 +01:00
|
|
|
ballIncoming: {
|
2018-06-25 00:22:46 +02:00
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
backgroundColor: '#d2f8d6',
|
2018-12-31 23:29:36 +01:00
|
|
|
transform: [{ rotate: '-45deg' }],
|
|
|
|
},
|
2019-01-31 07:52:21 +01:00
|
|
|
ballIncomingWithoutRotate: {
|
2018-12-31 23:29:36 +01:00
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
backgroundColor: '#d2f8d6',
|
2018-06-25 00:22:46 +02:00
|
|
|
},
|
|
|
|
ballReceive: {
|
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderBottomLeftRadius: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
backgroundColor: '#d2f8d6',
|
2018-06-25 00:22:46 +02:00
|
|
|
transform: [{ rotate: '-45deg' }],
|
|
|
|
},
|
|
|
|
ballOutgoing: {
|
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
backgroundColor: '#f8d2d2',
|
2018-12-31 23:29:36 +01:00
|
|
|
transform: [{ rotate: '225deg' }],
|
2018-06-25 00:22:46 +02:00
|
|
|
},
|
2018-12-28 22:43:38 +01:00
|
|
|
ballOutgoingWithoutRotate: {
|
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
2019-04-01 10:21:53 +02:00
|
|
|
backgroundColor: '#f8d2d2',
|
2018-12-28 22:43:38 +01:00
|
|
|
},
|
2018-06-25 00:22:46 +02:00
|
|
|
ballTransparrent: {
|
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
},
|
|
|
|
ballDimmed: {
|
|
|
|
width: 30,
|
|
|
|
height: 30,
|
|
|
|
borderRadius: 15,
|
|
|
|
backgroundColor: 'gray',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
export class BluePlusIcon extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
2018-06-25 00:22:46 +02:00
|
|
|
<View {...this.props} style={stylesBlueIcon.container}>
|
|
|
|
<View style={stylesBlueIcon.box1}>
|
|
|
|
<View style={stylesBlueIcon.ball}>
|
|
|
|
<Ionicons
|
|
|
|
{...this.props}
|
|
|
|
name={'ios-add'}
|
|
|
|
size={26}
|
|
|
|
style={{
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
left: 8,
|
|
|
|
top: 1,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-31 07:52:21 +01:00
|
|
|
export class BlueTransactionIncomingIcon extends Component {
|
2018-03-17 21:39:21 +01:00
|
|
|
render() {
|
2018-01-30 23:42:38 +01:00
|
|
|
return (
|
2018-09-22 13:26:45 +02:00
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
|
|
|
<View style={stylesBlueIcon.ballIncoming}>
|
2019-04-06 22:17:43 +02:00
|
|
|
<Icon
|
|
|
|
{...this.props}
|
|
|
|
name="arrow-down"
|
|
|
|
size={16}
|
|
|
|
type="font-awesome"
|
|
|
|
color={BlueApp.settings.incomingForegroundColor}
|
|
|
|
iconStyle={{ left: 0, top: 8 }}
|
|
|
|
/>
|
2018-06-25 00:22:46 +02:00
|
|
|
</View>
|
2018-01-30 23:42:38 +01:00
|
|
|
</View>
|
2018-06-25 00:22:46 +02:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueTransactionPendingIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-22 13:26:45 +02:00
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
2018-06-25 00:22:46 +02:00
|
|
|
<View style={stylesBlueIcon.ball}>
|
|
|
|
<Icon
|
|
|
|
{...this.props}
|
2019-08-06 17:30:56 +02:00
|
|
|
name="kebab-horizontal"
|
2018-06-25 00:22:46 +02:00
|
|
|
size={16}
|
2019-08-06 17:30:56 +02:00
|
|
|
type="octicon"
|
2018-06-25 00:22:46 +02:00
|
|
|
color={BlueApp.settings.foregroundColor}
|
2019-08-06 17:30:56 +02:00
|
|
|
iconStyle={{ left: 0, top: 7 }}
|
2018-06-25 00:22:46 +02:00
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-28 22:43:38 +01:00
|
|
|
export class BlueTransactionExpiredIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
2018-12-28 22:43:38 +01:00
|
|
|
<View style={stylesBlueIcon.ballOutgoingWithoutRotate}>
|
2019-04-06 22:17:43 +02:00
|
|
|
<Icon
|
|
|
|
{...this.props}
|
|
|
|
name="hourglass-end"
|
|
|
|
size={16}
|
|
|
|
type="font-awesome"
|
|
|
|
color={BlueApp.settings.outgoingForegroundColor}
|
|
|
|
iconStyle={{ left: 0, top: 6 }}
|
|
|
|
/>
|
2018-12-28 22:43:38 +01:00
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-01 01:28:19 +02:00
|
|
|
export class BlueTransactionOnchainIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-22 13:26:45 +02:00
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
|
|
|
<View style={stylesBlueIcon.ballIncoming}>
|
2018-09-01 01:28:19 +02:00
|
|
|
<Icon
|
|
|
|
{...this.props}
|
|
|
|
name="link"
|
|
|
|
size={16}
|
|
|
|
type="font-awesome"
|
2019-03-29 15:06:09 +01:00
|
|
|
color={BlueApp.settings.incomingForegroundColor}
|
2018-09-01 01:28:19 +02:00
|
|
|
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '-45deg' }] }}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-05 00:18:24 +02:00
|
|
|
export class BlueTransactionOffchainIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-22 13:26:45 +02:00
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
2018-12-31 23:29:36 +01:00
|
|
|
<View style={stylesBlueIcon.ballOutgoingWithoutRotate}>
|
2019-04-06 22:17:43 +02:00
|
|
|
<Icon
|
|
|
|
{...this.props}
|
|
|
|
name="bolt"
|
|
|
|
size={16}
|
|
|
|
type="font-awesome"
|
|
|
|
color={BlueApp.settings.outgoingForegroundColor}
|
|
|
|
iconStyle={{ left: 0, top: 7 }}
|
|
|
|
/>
|
2018-09-05 00:18:24 +02:00
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueTransactionOffchainIncomingIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-22 13:26:45 +02:00
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
|
|
|
<View style={stylesBlueIcon.ballIncomingWithoutRotate}>
|
2019-04-06 22:17:43 +02:00
|
|
|
<Icon
|
|
|
|
{...this.props}
|
|
|
|
name="bolt"
|
|
|
|
size={16}
|
|
|
|
type="font-awesome"
|
|
|
|
color={BlueApp.settings.incomingForegroundColor}
|
|
|
|
iconStyle={{ left: 0, top: 7 }}
|
|
|
|
/>
|
2018-09-05 00:18:24 +02:00
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
export class BlueTransactionOutgoingIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-22 13:26:45 +02:00
|
|
|
<View {...this.props}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<View style={stylesBlueIcon.boxIncoming}>
|
2018-06-25 00:22:46 +02:00
|
|
|
<View style={stylesBlueIcon.ballOutgoing}>
|
2019-04-06 22:17:43 +02:00
|
|
|
<Icon
|
|
|
|
{...this.props}
|
|
|
|
name="arrow-down"
|
|
|
|
size={16}
|
|
|
|
type="font-awesome"
|
|
|
|
color={BlueApp.settings.outgoingForegroundColor}
|
|
|
|
iconStyle={{ left: 0, top: 8 }}
|
|
|
|
/>
|
2018-06-25 00:22:46 +02:00
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-29 00:17:14 +02:00
|
|
|
//
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
export class BlueReceiveButtonIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-29 00:17:26 +02:00
|
|
|
<TouchableOpacity {...this.props}>
|
2019-01-05 03:14:23 +01:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flex: 1,
|
2019-01-05 03:46:10 +01:00
|
|
|
minWidth: 130,
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.buttonBackgroundColor,
|
2019-01-05 03:14:23 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
2018-06-25 00:22:46 +02:00
|
|
|
<View
|
|
|
|
style={{
|
2018-10-20 23:10:21 +02:00
|
|
|
minWidth: 30,
|
|
|
|
minHeight: 30,
|
2019-01-05 03:14:23 +01:00
|
|
|
left: 5,
|
2018-06-25 00:22:46 +02:00
|
|
|
backgroundColor: 'transparent',
|
|
|
|
transform: [{ rotate: '-45deg' }],
|
2018-09-29 00:17:26 +02:00
|
|
|
alignItems: 'center',
|
2019-01-05 03:14:23 +01:00
|
|
|
marginBottom: -11,
|
2018-06-25 00:22:46 +02:00
|
|
|
}}
|
|
|
|
>
|
2019-03-29 15:06:09 +01:00
|
|
|
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color={BlueApp.settings.buttonAlternativeTextColor} />
|
2018-06-25 00:22:46 +02:00
|
|
|
</View>
|
|
|
|
<Text
|
|
|
|
style={{
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.buttonAlternativeTextColor,
|
2018-06-29 00:17:14 +02:00
|
|
|
fontSize: (isIpad && 10) || 16,
|
2018-06-25 00:22:46 +02:00
|
|
|
fontWeight: '500',
|
|
|
|
left: 5,
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
}}
|
|
|
|
>
|
2019-01-05 03:14:23 +01:00
|
|
|
{loc.receive.header}
|
2018-06-25 00:22:46 +02:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlueSendButtonIcon extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-09-29 00:17:26 +02:00
|
|
|
<TouchableOpacity {...this.props}>
|
2019-01-05 03:14:23 +01:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flex: 1,
|
2019-01-05 03:46:10 +01:00
|
|
|
minWidth: 130,
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.buttonBackgroundColor,
|
2019-01-05 03:46:10 +01:00
|
|
|
alignItems: 'center',
|
2019-01-05 03:14:23 +01:00
|
|
|
}}
|
|
|
|
>
|
2019-01-05 03:46:10 +01:00
|
|
|
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}>
|
2018-06-25 00:22:46 +02:00
|
|
|
<View
|
|
|
|
style={{
|
2018-10-20 23:10:21 +02:00
|
|
|
minWidth: 30,
|
|
|
|
minHeight: 30,
|
2018-06-25 00:22:46 +02:00
|
|
|
left: 5,
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
transform: [{ rotate: '225deg' }],
|
2019-01-05 03:14:23 +01:00
|
|
|
marginBottom: 11,
|
2018-06-25 00:22:46 +02:00
|
|
|
}}
|
|
|
|
>
|
2019-03-29 15:06:09 +01:00
|
|
|
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color={BlueApp.settings.buttonAlternativeTextColor} />
|
2018-06-25 00:22:46 +02:00
|
|
|
</View>
|
|
|
|
<Text
|
|
|
|
style={{
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.buttonAlternativeTextColor,
|
2018-06-29 00:17:14 +02:00
|
|
|
fontSize: (isIpad && 10) || 16,
|
2018-06-25 00:22:46 +02:00
|
|
|
fontWeight: '500',
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
}}
|
|
|
|
>
|
2019-01-05 03:14:23 +01:00
|
|
|
{loc.send.header}
|
2018-06-25 00:22:46 +02:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-01 01:28:19 +02:00
|
|
|
export class ManageFundsBigButton extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2018-10-02 05:40:23 +02:00
|
|
|
<TouchableOpacity {...this.props}>
|
2019-01-05 03:14:23 +01:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flex: 1,
|
|
|
|
width: 168,
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.buttonBackgroundColor,
|
2019-01-05 03:14:23 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
2018-09-01 01:28:19 +02:00
|
|
|
<View
|
|
|
|
style={{
|
2019-01-05 03:14:23 +01:00
|
|
|
minWidth: 30,
|
|
|
|
minHeight: 30,
|
|
|
|
right: 5,
|
2018-09-01 01:28:19 +02:00
|
|
|
backgroundColor: 'transparent',
|
|
|
|
transform: [{ rotate: '90deg' }],
|
|
|
|
}}
|
|
|
|
>
|
2019-03-29 15:06:09 +01:00
|
|
|
<Icon {...this.props} name="link" size={16} type="font-awesome" color={BlueApp.settings.buttonAlternativeTextColor} />
|
2018-09-01 01:28:19 +02:00
|
|
|
</View>
|
|
|
|
<Text
|
|
|
|
style={{
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.buttonAlternativeTextColor,
|
2018-09-01 01:28:19 +02:00
|
|
|
fontSize: (isIpad && 10) || 16,
|
|
|
|
fontWeight: '500',
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
}}
|
|
|
|
>
|
2018-10-04 00:32:42 +02:00
|
|
|
{loc.lnd.title}
|
2018-09-01 01:28:19 +02:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
export class BluePlusIconDimmed extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View {...this.props} style={stylesBlueIcon.container}>
|
|
|
|
<View style={stylesBlueIcon.box1}>
|
|
|
|
<View style={stylesBlueIcon.ballDimmed}>
|
|
|
|
<Ionicons
|
|
|
|
{...this.props}
|
|
|
|
name={'ios-add'}
|
|
|
|
size={26}
|
|
|
|
style={{
|
|
|
|
color: 'white',
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
left: 8,
|
|
|
|
top: 1,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-11 23:52:46 +01:00
|
|
|
export class NewWalletPanel extends Component {
|
2018-06-25 00:22:46 +02:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
// WalletsCarousel.handleClick = props.handleClick // because cant access `this` from _renderItem
|
|
|
|
// eslint-disable-next-line
|
|
|
|
this.handleClick = props.onPress;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
|
|
|
{...this.props}
|
|
|
|
onPress={() => {
|
|
|
|
if (this.handleClick) {
|
|
|
|
this.handleClick();
|
|
|
|
}
|
|
|
|
}}
|
2018-11-10 00:44:34 +01:00
|
|
|
style={{ marginVertical: 17 }}
|
2018-06-25 00:22:46 +02:00
|
|
|
>
|
|
|
|
<LinearGradient
|
2019-01-25 05:46:03 +01:00
|
|
|
colors={WalletGradient.createWallet}
|
2018-06-25 00:22:46 +02:00
|
|
|
style={{
|
|
|
|
padding: 15,
|
|
|
|
borderRadius: 10,
|
2018-12-11 23:52:46 +01:00
|
|
|
minHeight: 164,
|
2018-06-25 00:22:46 +02:00
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<BluePlusIconDimmed />
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 20,
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.alternativeTextColor,
|
2018-06-25 00:22:46 +02:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.wallets.list.create_a_wallet}
|
|
|
|
</Text>
|
|
|
|
<Text style={{ backgroundColor: 'transparent' }} />
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 13,
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.alternativeTextColor,
|
2018-06-25 00:22:46 +02:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.wallets.list.create_a_wallet1}
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 13,
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.alternativeTextColor,
|
2018-06-25 00:22:46 +02:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.wallets.list.create_a_wallet2}
|
|
|
|
</Text>
|
|
|
|
</LinearGradient>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 03:13:45 +01:00
|
|
|
export class BlueTransactionListItem extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
item: PropTypes.shape().isRequired,
|
|
|
|
itemPriceUnit: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
itemPriceUnit: BitcoinUnit.BTC,
|
|
|
|
};
|
|
|
|
|
2019-09-19 04:57:03 +02:00
|
|
|
state = { transactionTimeToReadable: '...', subtitleNumberOfLines: 1 };
|
2019-08-31 08:54:11 +02:00
|
|
|
|
2019-01-30 03:13:45 +01:00
|
|
|
txMemo = () => {
|
|
|
|
if (BlueApp.tx_metadata[this.props.item.hash] && BlueApp.tx_metadata[this.props.item.hash]['memo']) {
|
|
|
|
return BlueApp.tx_metadata[this.props.item.hash]['memo'];
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
};
|
|
|
|
|
|
|
|
rowTitle = () => {
|
|
|
|
const item = this.props.item;
|
|
|
|
if (item.type === 'user_invoice' || item.type === 'payment_request') {
|
|
|
|
if (isNaN(item.value)) {
|
|
|
|
item.value = '0';
|
|
|
|
}
|
|
|
|
const currentDate = new Date();
|
|
|
|
const now = (currentDate.getTime() / 1000) | 0;
|
|
|
|
const invoiceExpiration = item.timestamp + item.expire_time;
|
|
|
|
|
|
|
|
if (invoiceExpiration > now) {
|
|
|
|
return loc.formatBalanceWithoutSuffix(item.value && item.value, this.props.itemPriceUnit, true).toString();
|
|
|
|
} else if (invoiceExpiration < now) {
|
|
|
|
if (item.ispaid) {
|
|
|
|
return loc.formatBalanceWithoutSuffix(item.value && item.value, this.props.itemPriceUnit, true).toString();
|
|
|
|
} else {
|
|
|
|
return loc.lnd.expired;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return loc.formatBalanceWithoutSuffix(item.value && item.value, this.props.itemPriceUnit, true).toString();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
rowTitleStyle = () => {
|
|
|
|
const item = this.props.item;
|
2019-03-29 15:06:09 +01:00
|
|
|
let color = BlueApp.settings.successColor;
|
2019-01-30 03:13:45 +01:00
|
|
|
|
|
|
|
if (item.type === 'user_invoice' || item.type === 'payment_request') {
|
|
|
|
const currentDate = new Date();
|
|
|
|
const now = (currentDate.getTime() / 1000) | 0;
|
|
|
|
const invoiceExpiration = item.timestamp + item.expire_time;
|
|
|
|
|
|
|
|
if (invoiceExpiration > now) {
|
2019-03-29 15:06:09 +01:00
|
|
|
color = BlueApp.settings.successColor;
|
2019-01-30 03:13:45 +01:00
|
|
|
} else if (invoiceExpiration < now) {
|
|
|
|
if (item.ispaid) {
|
2019-03-29 15:06:09 +01:00
|
|
|
color = BlueApp.settings.successColor;
|
2019-01-30 03:13:45 +01:00
|
|
|
} else {
|
2019-03-29 15:06:09 +01:00
|
|
|
color = BlueApp.settings.failedColor;
|
2019-01-30 03:13:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (item.value / 100000000 < 0) {
|
|
|
|
color = BlueApp.settings.foregroundColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
fontWeight: '600',
|
|
|
|
fontSize: 16,
|
|
|
|
color: color,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
avatar = () => {
|
|
|
|
// is it lightning refill tx?
|
|
|
|
if (this.props.item.category === 'receive' && this.props.item.confirmations < 3) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionPendingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.props.item.type && this.props.item.type === 'bitcoind_tx') {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOnchainIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (this.props.item.type === 'paid_invoice') {
|
|
|
|
// is it lightning offchain payment?
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOffchainIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.props.item.type === 'user_invoice' || this.props.item.type === 'payment_request') {
|
|
|
|
if (!this.props.item.ispaid) {
|
|
|
|
const currentDate = new Date();
|
|
|
|
const now = (currentDate.getTime() / 1000) | 0;
|
|
|
|
const invoiceExpiration = this.props.item.timestamp + this.props.item.expire_time;
|
|
|
|
if (invoiceExpiration < now) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionExpiredIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOffchainIncomingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.props.item.confirmations) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionPendingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else if (this.props.item.value < 0) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOutgoingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
2019-01-31 07:52:21 +01:00
|
|
|
<BlueTransactionIncomingIcon />
|
2019-01-30 03:13:45 +01:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
subtitle = () => {
|
|
|
|
return (
|
|
|
|
(this.props.item.confirmations < 7 ? loc.transactions.list.conf + ': ' + this.props.item.confirmations + ' ' : '') +
|
|
|
|
this.txMemo() +
|
|
|
|
(this.props.item.memo || '')
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
onPress = () => {
|
|
|
|
if (this.props.item.hash) {
|
2019-08-10 08:57:55 +02:00
|
|
|
NavigationService.navigate('TransactionStatus', { hash: this.props.item.hash });
|
2019-01-30 03:13:45 +01:00
|
|
|
} else if (
|
|
|
|
this.props.item.type === 'user_invoice' ||
|
|
|
|
this.props.item.type === 'payment_request' ||
|
|
|
|
this.props.item.type === 'paid_invoice'
|
|
|
|
) {
|
2019-01-30 22:53:29 +01:00
|
|
|
const lightningWallet = BlueApp.getWallets().filter(wallet => {
|
2019-01-30 03:13:45 +01:00
|
|
|
if (typeof wallet === 'object') {
|
|
|
|
if (wallet.hasOwnProperty('secret')) {
|
|
|
|
return wallet.getSecret() === this.props.item.fromWallet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2019-01-31 01:56:34 +01:00
|
|
|
if (lightningWallet.length === 1) {
|
|
|
|
NavigationService.navigate('LNDViewInvoice', {
|
|
|
|
invoice: this.props.item,
|
|
|
|
fromWallet: lightningWallet[0],
|
|
|
|
isModal: false,
|
|
|
|
});
|
|
|
|
}
|
2019-01-30 03:13:45 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-08-31 08:54:11 +02:00
|
|
|
componentDidMount() {
|
|
|
|
InteractionManager.runAfterInteractions(() => {
|
|
|
|
const transactionTimeToReadable = loc.transactionTimeToReadable(this.props.item.received);
|
|
|
|
this.setState({ transactionTimeToReadable });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-09-19 04:57:03 +02:00
|
|
|
onLongPress = () => {
|
|
|
|
if (this.state.subtitleNumberOfLines === 1) {
|
|
|
|
this.setState({ subtitleNumberOfLines: 0 });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-01-30 03:13:45 +01:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<BlueListItem
|
|
|
|
avatar={this.avatar()}
|
2019-08-31 08:54:11 +02:00
|
|
|
title={this.state.transactionTimeToReadable}
|
2019-01-30 03:13:45 +01:00
|
|
|
subtitle={this.subtitle()}
|
2019-09-19 04:57:03 +02:00
|
|
|
subtitleNumberOfLines={this.state.subtitleNumberOfLines}
|
2019-01-30 03:13:45 +01:00
|
|
|
onPress={this.onPress}
|
2019-09-19 04:57:03 +02:00
|
|
|
onLongPress={this.onLongPress}
|
2019-01-30 03:13:45 +01:00
|
|
|
badge={{
|
|
|
|
value: 3,
|
|
|
|
textStyle: { color: 'orange' },
|
|
|
|
containerStyle: { marginTop: 0 },
|
|
|
|
}}
|
|
|
|
hideChevron
|
|
|
|
rightTitle={this.rowTitle()}
|
|
|
|
rightTitleStyle={this.rowTitleStyle()}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-31 07:52:21 +01:00
|
|
|
export class BlueListTransactionItem extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
item: PropTypes.shape().isRequired,
|
|
|
|
itemPriceUnit: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
itemPriceUnit: BitcoinUnit.BTC,
|
|
|
|
};
|
|
|
|
|
|
|
|
txMemo = () => {
|
|
|
|
if (BlueApp.tx_metadata[this.props.item.hash] && BlueApp.tx_metadata[this.props.item.hash]['memo']) {
|
|
|
|
return BlueApp.tx_metadata[this.props.item.hash]['memo'];
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
};
|
|
|
|
|
|
|
|
rowTitle = () => {
|
|
|
|
const item = this.props.item;
|
|
|
|
if (item.type === 'user_invoice' || item.type === 'payment_request') {
|
|
|
|
if (isNaN(item.value)) {
|
|
|
|
item.value = '0';
|
|
|
|
}
|
|
|
|
const currentDate = new Date();
|
|
|
|
const now = (currentDate.getTime() / 1000) | 0;
|
|
|
|
const invoiceExpiration = item.timestamp + item.expire_time;
|
|
|
|
|
|
|
|
if (invoiceExpiration > now) {
|
|
|
|
return loc.formatBalanceWithoutSuffix(item.value && item.value, this.props.itemPriceUnit, true).toString();
|
|
|
|
} else if (invoiceExpiration < now) {
|
|
|
|
if (item.ispaid) {
|
|
|
|
return loc.formatBalanceWithoutSuffix(item.value && item.value, this.props.itemPriceUnit, true).toString();
|
|
|
|
} else {
|
|
|
|
return loc.lnd.expired;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return loc.formatBalanceWithoutSuffix(item.value && item.value, this.props.itemPriceUnit, true).toString();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
rowTitleStyle = () => {
|
|
|
|
const item = this.props.item;
|
|
|
|
let color = '#37c0a1';
|
|
|
|
|
|
|
|
if (item.type === 'user_invoice' || item.type === 'payment_request') {
|
|
|
|
const currentDate = new Date();
|
|
|
|
const now = (currentDate.getTime() / 1000) | 0;
|
|
|
|
const invoiceExpiration = item.timestamp + item.expire_time;
|
|
|
|
|
|
|
|
if (invoiceExpiration > now) {
|
|
|
|
color = '#37c0a1';
|
|
|
|
} else if (invoiceExpiration < now) {
|
|
|
|
if (item.ispaid) {
|
|
|
|
color = '#37c0a1';
|
|
|
|
} else {
|
|
|
|
color = '#FF0000';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (item.value / 100000000 < 0) {
|
|
|
|
color = BlueApp.settings.foregroundColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
fontWeight: '600',
|
|
|
|
fontSize: 16,
|
|
|
|
color: color,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
avatar = () => {
|
|
|
|
// is it lightning refill tx?
|
|
|
|
if (this.props.item.category === 'receive' && this.props.item.confirmations < 3) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionPendingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.props.item.type && this.props.item.type === 'bitcoind_tx') {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOnchainIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (this.props.item.type === 'paid_invoice') {
|
|
|
|
// is it lightning offchain payment?
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOffchainIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.props.item.type === 'user_invoice' || this.props.item.type === 'payment_request') {
|
|
|
|
if (!this.props.item.ispaid) {
|
|
|
|
const currentDate = new Date();
|
|
|
|
const now = (currentDate.getTime() / 1000) | 0;
|
|
|
|
const invoiceExpiration = this.props.item.timestamp + this.props.item.expire_time;
|
|
|
|
if (invoiceExpiration < now) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionExpiredIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOffchainIncomingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.props.item.confirmations) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionPendingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else if (this.props.item.value < 0) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOutgoingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionIncomingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
subtitle = () => {
|
|
|
|
return (
|
|
|
|
(this.props.item.confirmations < 7 ? loc.transactions.list.conf + ': ' + this.props.item.confirmations + ' ' : '') +
|
|
|
|
this.txMemo() +
|
|
|
|
(this.props.item.memo || '')
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
onPress = () => {
|
|
|
|
if (this.props.item.hash) {
|
2019-08-10 08:57:55 +02:00
|
|
|
NavigationService.navigate('TransactionStatus', { hash: this.props.item.hash });
|
2019-01-31 07:52:21 +01:00
|
|
|
} else if (
|
|
|
|
this.props.item.type === 'user_invoice' ||
|
|
|
|
this.props.item.type === 'payment_request' ||
|
|
|
|
this.props.item.type === 'paid_invoice'
|
|
|
|
) {
|
|
|
|
const lightningWallet = BlueApp.getWallets().filter(wallet => {
|
|
|
|
if (typeof wallet === 'object') {
|
|
|
|
if (wallet.hasOwnProperty('secret')) {
|
|
|
|
return wallet.getSecret() === this.props.item.fromWallet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
NavigationService.navigate('LNDViewInvoice', {
|
|
|
|
invoice: this.props.item,
|
|
|
|
fromWallet: lightningWallet[0],
|
|
|
|
isModal: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<BlueListItem
|
|
|
|
avatar={this.avatar()}
|
|
|
|
title={loc.transactionTimeToReadable(this.props.item.received)}
|
|
|
|
subtitle={this.subtitle()}
|
|
|
|
onPress={this.onPress}
|
|
|
|
badge={{
|
|
|
|
value: 3,
|
|
|
|
textStyle: { color: 'orange' },
|
|
|
|
containerStyle: { marginTop: 0 },
|
|
|
|
}}
|
|
|
|
hideChevron
|
|
|
|
rightTitle={this.rowTitle()}
|
|
|
|
rightTitleStyle={this.rowTitleStyle()}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-09 06:25:36 +02:00
|
|
|
const sliderWidth = width * 1;
|
|
|
|
const itemWidth = width * 0.82;
|
|
|
|
const sliderHeight = 190;
|
2018-06-25 00:22:46 +02:00
|
|
|
|
|
|
|
export class WalletsCarousel extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
// eslint-disable-next-line
|
|
|
|
WalletsCarousel.handleClick = props.handleClick; // because cant access `this` from _renderItem
|
2018-12-11 23:52:46 +01:00
|
|
|
WalletsCarousel.handleLongPress = props.handleLongPress;
|
2018-06-25 00:22:46 +02:00
|
|
|
// eslint-disable-next-line
|
|
|
|
this.onSnapToItem = props.onSnapToItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
_renderItem({ item, index }) {
|
2018-12-12 04:33:28 +01:00
|
|
|
let scaleValue = new Animated.Value(1.0);
|
2019-01-30 05:00:12 +01:00
|
|
|
let props = { duration: 50 };
|
2019-01-30 03:13:45 +01:00
|
|
|
if (Platform.OS === 'android') {
|
2019-01-31 01:56:34 +01:00
|
|
|
props['useNativeDriver'] = true;
|
2019-01-30 03:13:45 +01:00
|
|
|
}
|
2018-12-12 04:33:28 +01:00
|
|
|
this.onPressedIn = () => {
|
2019-01-30 05:00:12 +01:00
|
|
|
props.toValue = 0.9;
|
2019-01-30 03:13:45 +01:00
|
|
|
Animated.spring(scaleValue, props).start();
|
2018-12-12 04:33:28 +01:00
|
|
|
};
|
|
|
|
this.onPressedOut = () => {
|
2019-01-30 05:00:12 +01:00
|
|
|
props.toValue = 1.0;
|
2019-01-30 03:13:45 +01:00
|
|
|
Animated.spring(scaleValue, props).start();
|
2018-12-12 04:33:28 +01:00
|
|
|
};
|
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
if (!item) {
|
|
|
|
return (
|
2018-12-11 23:52:46 +01:00
|
|
|
<NewWalletPanel
|
2018-06-25 00:22:46 +02:00
|
|
|
onPress={() => {
|
|
|
|
if (WalletsCarousel.handleClick) {
|
|
|
|
WalletsCarousel.handleClick(index);
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2018-07-14 21:53:43 +02:00
|
|
|
|
2018-06-25 00:22:46 +02:00
|
|
|
return (
|
2018-12-12 04:33:28 +01:00
|
|
|
<Animated.View
|
|
|
|
style={{ paddingRight: 10, marginVertical: 17, transform: [{ scale: scaleValue }] }}
|
2018-12-11 23:52:46 +01:00
|
|
|
shadowOpacity={40 / 100}
|
|
|
|
shadowOffset={{ width: 0, height: 0 }}
|
|
|
|
shadowRadius={5}
|
|
|
|
>
|
2018-12-12 04:33:28 +01:00
|
|
|
<TouchableWithoutFeedback
|
|
|
|
onPressIn={this.onPressedIn}
|
|
|
|
onPressOut={this.onPressedOut}
|
2018-12-11 23:52:46 +01:00
|
|
|
onLongPress={WalletsCarousel.handleLongPress}
|
2018-11-02 14:53:35 +01:00
|
|
|
onPress={() => {
|
|
|
|
if (WalletsCarousel.handleClick) {
|
2019-01-25 05:46:03 +01:00
|
|
|
WalletsCarousel.handleClick(index);
|
2018-11-02 14:53:35 +01:00
|
|
|
}
|
|
|
|
}}
|
2018-09-29 00:17:26 +02:00
|
|
|
>
|
2018-11-02 14:53:35 +01:00
|
|
|
<LinearGradient
|
2019-03-29 15:06:09 +01:00
|
|
|
shadowColor={BlueApp.settings.shadowColor}
|
2019-01-25 05:46:03 +01:00
|
|
|
colors={WalletGradient.gradientsFor(item.type)}
|
2018-11-10 00:44:34 +01:00
|
|
|
style={{
|
|
|
|
padding: 15,
|
|
|
|
borderRadius: 10,
|
2018-12-11 23:52:46 +01:00
|
|
|
minHeight: 164,
|
2018-11-10 00:44:34 +01:00
|
|
|
elevation: 5,
|
|
|
|
}}
|
2018-06-25 00:22:46 +02:00
|
|
|
>
|
2018-11-02 14:53:35 +01:00
|
|
|
<Image
|
2018-12-28 16:52:06 +01:00
|
|
|
source={(LightningCustodianWallet.type === item.type && require('./img/lnd-shape.png')) || require('./img/btc-shape.png')}
|
2018-11-02 14:53:35 +01:00
|
|
|
style={{
|
|
|
|
width: 99,
|
|
|
|
height: 94,
|
|
|
|
position: 'absolute',
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Text style={{ backgroundColor: 'transparent' }} />
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 19,
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.inverseForegroundColor,
|
2018-11-02 14:53:35 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{item.getLabel()}
|
|
|
|
</Text>
|
2019-08-03 23:29:15 +02:00
|
|
|
{item.hideBalance ? (
|
|
|
|
<BluePrivateBalance />
|
|
|
|
) : (
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
adjustsFontSizeToFit
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 36,
|
|
|
|
color: BlueApp.settings.inverseForegroundColor,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.formatBalance(Number(item.getBalance()), item.getPreferredBalanceUnit(), true)}
|
|
|
|
</Text>
|
|
|
|
)}
|
2018-11-02 14:53:35 +01:00
|
|
|
<Text style={{ backgroundColor: 'transparent' }} />
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 13,
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.inverseForegroundColor,
|
2018-11-02 14:53:35 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.wallets.list.latest_transaction}
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 16,
|
2019-03-29 15:06:09 +01:00
|
|
|
color: BlueApp.settings.inverseForegroundColor,
|
2018-11-02 14:53:35 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.transactionTimeToReadable(item.getLatestTransactionTime())}
|
|
|
|
</Text>
|
|
|
|
</LinearGradient>
|
2018-12-12 04:33:28 +01:00
|
|
|
</TouchableWithoutFeedback>
|
|
|
|
</Animated.View>
|
2018-06-25 00:22:46 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2018-10-09 06:25:36 +02:00
|
|
|
<Carousel
|
|
|
|
{...this.props}
|
|
|
|
ref={c => {
|
|
|
|
WalletsCarousel.carousel = c;
|
|
|
|
}}
|
|
|
|
renderItem={this._renderItem}
|
|
|
|
sliderWidth={sliderWidth}
|
|
|
|
sliderHeight={sliderHeight}
|
|
|
|
itemWidth={itemWidth}
|
|
|
|
inactiveSlideScale={1}
|
|
|
|
inactiveSlideOpacity={0.7}
|
2018-11-02 14:53:35 +01:00
|
|
|
contentContainerCustomStyle={{ left: -20 }}
|
2018-10-09 06:25:36 +02:00
|
|
|
onSnapToItem={index => {
|
|
|
|
if (this.onSnapToItem) {
|
|
|
|
this.onSnapToItem(index);
|
|
|
|
}
|
|
|
|
console.log('snapped to card #', index);
|
|
|
|
}}
|
|
|
|
/>
|
2018-03-17 21:39:21 +01:00
|
|
|
);
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
2018-12-25 15:16:23 +01:00
|
|
|
|
2019-01-24 08:36:01 +01:00
|
|
|
export class BlueAddressInput extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
isLoading: PropTypes.bool,
|
|
|
|
onChangeText: PropTypes.func,
|
|
|
|
onBarScanned: PropTypes.func,
|
|
|
|
address: PropTypes.string,
|
2019-02-17 08:50:23 +01:00
|
|
|
placeholder: PropTypes.string,
|
2019-01-24 08:36:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
isLoading: false,
|
|
|
|
address: '',
|
2019-02-17 08:50:23 +01:00
|
|
|
placeholder: loc.send.details.address,
|
2019-01-24 08:36:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flexDirection: 'row',
|
2019-03-29 15:06:09 +01:00
|
|
|
borderColor: BlueApp.settings.inputBorderColor,
|
|
|
|
borderBottomColor: BlueApp.settings.inputBorderColor,
|
2019-01-24 08:36:01 +01:00
|
|
|
borderWidth: 1.0,
|
|
|
|
borderBottomWidth: 0.5,
|
2019-03-29 15:06:09 +01:00
|
|
|
backgroundColor: BlueApp.settings.inputBackgroundColor,
|
2019-01-24 08:36:01 +01:00
|
|
|
minHeight: 44,
|
|
|
|
height: 44,
|
|
|
|
marginHorizontal: 20,
|
|
|
|
alignItems: 'center',
|
|
|
|
marginVertical: 8,
|
|
|
|
borderRadius: 4,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<TextInput
|
|
|
|
onChangeText={text => {
|
|
|
|
this.props.onChangeText(text);
|
|
|
|
}}
|
2019-02-17 08:50:23 +01:00
|
|
|
placeholder={this.props.placeholder}
|
2019-01-24 08:36:01 +01:00
|
|
|
numberOfLines={1}
|
|
|
|
value={this.props.address}
|
|
|
|
style={{ flex: 1, marginHorizontal: 8, minHeight: 33 }}
|
|
|
|
editable={!this.props.isLoading}
|
2019-09-03 05:28:52 +02:00
|
|
|
onSubmitEditing={() => Keyboard.dismiss()}
|
2019-02-17 10:23:12 +01:00
|
|
|
{...this.props}
|
2019-01-24 08:36:01 +01:00
|
|
|
/>
|
|
|
|
<TouchableOpacity
|
|
|
|
disabled={this.props.isLoading}
|
2019-01-26 06:27:25 +01:00
|
|
|
onPress={() => {
|
2019-02-10 12:39:26 +01:00
|
|
|
Keyboard.dismiss();
|
2019-01-26 06:27:25 +01:00
|
|
|
ImagePicker.showImagePicker(
|
|
|
|
{
|
|
|
|
title: null,
|
|
|
|
mediaType: 'photo',
|
|
|
|
takePhotoButtonTitle: null,
|
|
|
|
customButtons: [{ name: 'navigatetoQRScan', title: 'Use Camera' }],
|
|
|
|
},
|
|
|
|
response => {
|
|
|
|
if (response.customButton) {
|
|
|
|
NavigationService.navigate('ScanQrAddress', { onBarScanned: this.props.onBarScanned });
|
|
|
|
} else if (response.uri) {
|
|
|
|
const uri = response.uri.toString().replace('file://', '');
|
|
|
|
LocalQRCode.decode(uri, (error, result) => {
|
|
|
|
if (!error) {
|
|
|
|
this.props.onBarScanned(result);
|
|
|
|
} else {
|
|
|
|
alert('The selected image does not contain a QR Code.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}}
|
2019-01-24 08:36:01 +01:00
|
|
|
style={{
|
|
|
|
width: 75,
|
|
|
|
height: 36,
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
backgroundColor: '#bebebe',
|
|
|
|
borderRadius: 4,
|
|
|
|
paddingVertical: 4,
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
}}
|
|
|
|
>
|
2019-03-29 15:06:09 +01:00
|
|
|
<Icon name="qrcode" size={22} type="font-awesome" color={BlueApp.settings.inverseForegroundColor} />
|
|
|
|
<Text style={{ color: BlueApp.settings.inverseForegroundColor }}>{loc.send.details.scan}</Text>
|
2019-01-24 08:36:01 +01:00
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-27 06:05:27 +02:00
|
|
|
export class BlueReplaceFeeSuggestions extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
onFeeSelected: PropTypes.func.isRequired,
|
|
|
|
transactionMinimum: PropTypes.number.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
onFeeSelected: undefined,
|
|
|
|
transactionMinimum: 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
state = { networkFees: undefined, selectedFeeType: NetworkTransactionFeeType.FAST, customFeeValue: 0 };
|
|
|
|
|
|
|
|
async componentDidMount() {
|
|
|
|
const networkFees = await NetworkTransactionFees.recommendedFees();
|
2019-09-15 07:20:21 +02:00
|
|
|
this.setState({ networkFees }, () => this.onFeeSelected(NetworkTransactionFeeType.FAST));
|
2019-08-27 06:05:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
onFeeSelected = selectedFeeType => {
|
|
|
|
if (selectedFeeType !== NetworkTransactionFeeType.CUSTOM) {
|
|
|
|
Keyboard.dismiss();
|
|
|
|
}
|
|
|
|
if (selectedFeeType === NetworkTransactionFeeType.FAST) {
|
|
|
|
this.props.onFeeSelected(this.state.networkFees.fastestFee);
|
|
|
|
this.setState({ selectedFeeType }, () => this.props.onFeeSelected(this.state.networkFees.fastestFee));
|
|
|
|
} else if (selectedFeeType === NetworkTransactionFeeType.MEDIUM) {
|
|
|
|
this.setState({ selectedFeeType }, () => this.props.onFeeSelected(this.state.networkFees.halfHourFee));
|
|
|
|
} else if (selectedFeeType === NetworkTransactionFeeType.SLOW) {
|
|
|
|
this.setState({ selectedFeeType }, () => this.props.onFeeSelected(this.state.networkFees.hourFee));
|
|
|
|
} else if (selectedFeeType === NetworkTransactionFeeType.CUSTOM) {
|
|
|
|
this.props.onFeeSelected(this.state.customFeeValue);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
onCustomFeeTextChange = customFee => {
|
|
|
|
this.setState({ customFeeValue: Number(customFee), selectedFeeType: NetworkTransactionFeeType.CUSTOM }, () => {
|
|
|
|
this.onFeeSelected(NetworkTransactionFeeType.CUSTOM);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View>
|
|
|
|
{this.state.networkFees && (
|
|
|
|
<>
|
|
|
|
<BlueText>Suggestions</BlueText>
|
|
|
|
<TouchableOpacity onPress={() => this.onFeeSelected(NetworkTransactionFeeType.FAST)}>
|
|
|
|
<BlueListItem
|
|
|
|
title={'Fast'}
|
|
|
|
rightTitle={`${this.state.networkFees.fastestFee} sat/b`}
|
|
|
|
{...(this.state.selectedFeeType === NetworkTransactionFeeType.FAST
|
|
|
|
? { rightIcon: <Icon name="check" type="font-awesome" color="#0c2550" /> }
|
|
|
|
: { hideChevron: true })}
|
|
|
|
/>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity onPress={() => this.onFeeSelected(NetworkTransactionFeeType.MEDIUM)}>
|
|
|
|
<BlueListItem
|
|
|
|
title={'Medium'}
|
|
|
|
rightTitle={`${this.state.networkFees.halfHourFee} sat/b`}
|
|
|
|
{...(this.state.selectedFeeType === NetworkTransactionFeeType.MEDIUM
|
|
|
|
? { rightIcon: <Icon name="check" type="font-awesome" color="#0c2550" /> }
|
|
|
|
: { hideChevron: true })}
|
|
|
|
/>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity onPress={() => this.onFeeSelected(NetworkTransactionFeeType.SLOW)}>
|
|
|
|
<BlueListItem
|
|
|
|
title={'Slow'}
|
|
|
|
rightTitle={`${this.state.networkFees.hourFee} sat/b`}
|
|
|
|
{...(this.state.selectedFeeType === NetworkTransactionFeeType.SLOW
|
|
|
|
? { rightIcon: <Icon name="check" type="font-awesome" color="#0c2550" /> }
|
|
|
|
: { hideChevron: true })}
|
|
|
|
/>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</>
|
|
|
|
)}
|
2019-08-27 16:40:17 +02:00
|
|
|
<TouchableOpacity onPress={() => this.customTextInput.focus()}>
|
|
|
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginLeft: 18, marginRight: 18, alignItems: 'center' }}>
|
|
|
|
<Text style={{ color: BlueApp.settings.foregroundColor, fontSize: 16, fontWeight: '500' }}>Custom</Text>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
minHeight: 44,
|
|
|
|
height: 44,
|
|
|
|
minWidth: 48,
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'flex-end',
|
|
|
|
marginVertical: 8,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<TextInput
|
|
|
|
onChangeText={this.onCustomFeeTextChange}
|
|
|
|
keyboardType={'numeric'}
|
|
|
|
value={this.state.customFeeValue}
|
|
|
|
ref={ref => (this.customTextInput = ref)}
|
|
|
|
maxLength={9}
|
|
|
|
style={{
|
|
|
|
borderColor: '#d2d2d2',
|
|
|
|
borderBottomColor: '#d2d2d2',
|
|
|
|
borderWidth: 1.0,
|
|
|
|
borderBottomWidth: 0.5,
|
|
|
|
borderRadius: 4,
|
|
|
|
minHeight: 33,
|
|
|
|
maxWidth: 100,
|
|
|
|
minWidth: 44,
|
|
|
|
backgroundColor: '#f5f5f5',
|
|
|
|
textAlign: 'right',
|
|
|
|
}}
|
|
|
|
onFocus={() => this.onCustomFeeTextChange(this.state.customFeeValue)}
|
|
|
|
defaultValue={`${this.props.transactionMinimum}`}
|
|
|
|
placeholder="Custom sat/b"
|
|
|
|
inputAccessoryViewID={BlueDismissKeyboardInputAccessory.InputAccessoryViewID}
|
|
|
|
/>
|
|
|
|
<Text style={{ color: BlueApp.settings.alternativeTextColor, marginHorizontal: 8 }}>sat/b</Text>
|
|
|
|
{this.state.selectedFeeType === NetworkTransactionFeeType.CUSTOM && <Icon name="check" type="font-awesome" color="#0c2550" />}
|
|
|
|
</View>
|
|
|
|
<BlueDismissKeyboardInputAccessory />
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
2019-08-27 06:05:27 +02:00
|
|
|
<BlueText>
|
|
|
|
The total fee rate (satoshi per byte) you want to pay should be higher than {this.props.transactionMinimum} sat/byte
|
|
|
|
</BlueText>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-25 15:16:23 +01:00
|
|
|
export class BlueBitcoinAmount extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
isLoading: PropTypes.bool,
|
2019-05-02 22:33:03 +02:00
|
|
|
amount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
2018-12-25 15:16:23 +01:00
|
|
|
onChangeText: PropTypes.func,
|
|
|
|
disabled: PropTypes.bool,
|
2019-01-06 07:39:39 +01:00
|
|
|
unit: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
unit: BitcoinUnit.BTC,
|
2018-12-25 15:16:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2019-05-02 22:33:03 +02:00
|
|
|
const amount = this.props.amount || 0;
|
|
|
|
let localCurrency = loc.formatBalanceWithoutSuffix(amount, BitcoinUnit.LOCAL_CURRENCY, false);
|
|
|
|
if (this.props.unit === BitcoinUnit.BTC) {
|
|
|
|
let sat = new BigNumber(amount);
|
|
|
|
sat = sat.multipliedBy(100000000).toString();
|
|
|
|
localCurrency = loc.formatBalanceWithoutSuffix(sat, BitcoinUnit.LOCAL_CURRENCY, false);
|
|
|
|
} else {
|
|
|
|
localCurrency = loc.formatBalanceWithoutSuffix(amount.toString(), BitcoinUnit.LOCAL_CURRENCY, false);
|
|
|
|
}
|
2019-08-04 21:33:15 +02:00
|
|
|
if (amount === BitcoinUnit.MAX) localCurrency = ''; // we dont want to display NaN
|
2018-12-25 15:16:23 +01:00
|
|
|
return (
|
2019-01-06 10:30:32 +01:00
|
|
|
<TouchableWithoutFeedback disabled={this.props.pointerEvents === 'none'} onPress={() => this.textInput.focus()}>
|
2019-01-04 04:28:15 +01:00
|
|
|
<View>
|
2019-08-06 20:13:37 +02:00
|
|
|
<View style={{ flexDirection: 'row', justifyContent: 'center', paddingTop: 16, paddingBottom: 2 }}>
|
2019-01-04 04:28:15 +01:00
|
|
|
<TextInput
|
2019-01-06 21:21:04 +01:00
|
|
|
{...this.props}
|
2019-01-04 04:28:15 +01:00
|
|
|
keyboardType="numeric"
|
2019-01-06 21:21:04 +01:00
|
|
|
onChangeText={text => {
|
2019-08-25 02:50:43 +02:00
|
|
|
text = text.trim();
|
2019-01-06 21:55:50 +01:00
|
|
|
text = text.replace(',', '.');
|
2019-08-25 02:50:43 +02:00
|
|
|
const split = text.split('.');
|
|
|
|
if (split.length >= 2) {
|
|
|
|
text = `${parseInt(split[0], 10)}.${split[1]}`;
|
2019-08-25 07:38:30 +02:00
|
|
|
} else {
|
|
|
|
text = `${parseInt(split[0], 10)}`;
|
2019-08-25 02:50:43 +02:00
|
|
|
}
|
2019-01-06 21:21:04 +01:00
|
|
|
text = this.props.unit === BitcoinUnit.BTC ? text.replace(/[^0-9.]/g, '') : text.replace(/[^0-9]/g, '');
|
2019-01-07 01:41:25 +01:00
|
|
|
text = text.replace(/(\..*)\./g, '$1');
|
2019-08-25 02:50:43 +02:00
|
|
|
|
2019-01-07 01:41:25 +01:00
|
|
|
if (text.startsWith('.')) {
|
|
|
|
text = '0.';
|
|
|
|
}
|
2019-08-25 02:50:43 +02:00
|
|
|
text = text.replace(/(0{1,}.)\./g, '$1');
|
|
|
|
if (this.props.unit !== BitcoinUnit.BTC) {
|
|
|
|
text = text.replace(/[^0-9.]/g, '');
|
|
|
|
}
|
2019-01-06 21:21:04 +01:00
|
|
|
this.props.onChangeText(text);
|
|
|
|
}}
|
2019-08-04 21:33:15 +02:00
|
|
|
onBlur={() => {
|
|
|
|
if (this.props.onBlur) this.props.onBlur();
|
|
|
|
}}
|
|
|
|
onFocus={() => {
|
|
|
|
if (this.props.onFocus) this.props.onFocus();
|
|
|
|
}}
|
2019-01-04 04:28:15 +01:00
|
|
|
placeholder="0"
|
|
|
|
maxLength={10}
|
|
|
|
ref={textInput => (this.textInput = textInput)}
|
|
|
|
editable={!this.props.isLoading && !this.props.disabled}
|
|
|
|
value={amount}
|
2019-03-29 15:06:09 +01:00
|
|
|
placeholderTextColor={this.props.disabled ? BlueApp.settings.buttonDisabledTextColor : BlueApp.settings.alternativeTextColor2}
|
2019-01-04 04:28:15 +01:00
|
|
|
style={{
|
2019-03-29 15:06:09 +01:00
|
|
|
color: this.props.disabled ? BlueApp.settings.buttonDisabledTextColor : BlueApp.settings.alternativeTextColor2,
|
2019-01-04 04:28:15 +01:00
|
|
|
fontSize: 36,
|
|
|
|
fontWeight: '600',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text
|
|
|
|
style={{
|
2019-03-29 15:06:09 +01:00
|
|
|
color: this.props.disabled ? BlueApp.settings.buttonDisabledTextColor : BlueApp.settings.alternativeTextColor2,
|
2019-01-04 04:28:15 +01:00
|
|
|
fontSize: 16,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
paddingBottom: 6,
|
|
|
|
fontWeight: '600',
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
}}
|
|
|
|
>
|
2019-01-06 07:39:39 +01:00
|
|
|
{' ' + this.props.unit}
|
2019-01-04 04:28:15 +01:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{ alignItems: 'center', marginBottom: 22, marginTop: 4 }}>
|
2019-05-02 22:33:03 +02:00
|
|
|
<Text style={{ fontSize: 18, color: '#d4d4d4', fontWeight: '600' }}>{localCurrency}</Text>
|
2019-01-04 04:28:15 +01:00
|
|
|
</View>
|
2018-12-25 15:16:23 +01:00
|
|
|
</View>
|
2019-01-04 03:06:02 +01:00
|
|
|
</TouchableWithoutFeedback>
|
2018-12-25 15:16:23 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-03 23:29:15 +02:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
balanceBlur: {
|
|
|
|
height: 30,
|
|
|
|
width: 100,
|
|
|
|
marginRight: 16,
|
|
|
|
},
|
|
|
|
});
|