This commit is contained in:
marcosrdz 2020-11-27 22:24:20 -05:00
parent bac65abd9d
commit 1712471167
4 changed files with 90 additions and 84 deletions

View File

@ -944,11 +944,9 @@ export class BlueSpacing extends Component {
}
}
export class BlueSpacing40 extends Component {
render() {
return <View {...this.props} style={{ height: 50 }} />;
}
}
export const BlueSpacing40 = props => {
return <View {...props} style={{ height: 50 }} />;
};
export class BlueSpacingVariable extends Component {
render() {
@ -966,17 +964,13 @@ export class is {
}
}
export class BlueSpacing20 extends Component {
render() {
return <View {...this.props} style={{ height: 20, opacity: 0 }} />;
}
}
export const BlueSpacing20 = props => {
return <View {...props} style={{ height: 20, opacity: 0 }} />;
};
export class BlueSpacing10 extends Component {
render() {
return <View {...this.props} style={{ height: 10, opacity: 0 }} />;
}
}
export const BlueSpacing10 = props => {
return <View {...props} style={{ height: 10, opacity: 0 }} />;
};
export class BlueList extends Component {
render() {
@ -1514,46 +1508,6 @@ export class BlueSendButtonIcon extends Component {
}
}
export class ManageFundsBigButton extends Component {
render() {
return (
<TouchableOpacity {...this.props}>
<View
style={{
flex: 1,
width: 168,
backgroundColor: BlueCurrentTheme.colors.buttonBackgroundColor,
}}
>
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
<View
style={{
minWidth: 30,
minHeight: 30,
right: 5,
backgroundColor: 'transparent',
transform: [{ rotate: '90deg' }],
}}
>
<Icon {...this.props} name="link" size={16} type="font-awesome" color={BlueCurrentTheme.colors.buttonAlternativeTextColor} />
</View>
<Text
style={{
color: BlueCurrentTheme.colors.buttonAlternativeTextColor,
fontSize: (isIpad && 10) || 16,
fontWeight: '500',
backgroundColor: 'transparent',
}}
>
{loc.lnd.title}
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = BitcoinUnit.BTC, timeElapsed }) => {
const [subtitleNumberOfLines, setSubtitleNumberOfLines] = useState(1);
const { colors } = useTheme();

View File

@ -74,6 +74,7 @@ import UnlockWith from './UnlockWith';
import DrawerList from './screen/wallets/drawerList';
import { isTablet } from 'react-native-device-info';
import SettingsPrivacy from './screen/settings/SettingsPrivacy';
import LNDViewAdditionalInvoicePreImage from './screen/lnd/lndViewAdditionalInvoicePreImage';
const defaultScreenOptions =
Platform.OS === 'ios'
@ -139,6 +140,11 @@ const WalletsRoot = () => (
component={LNDViewAdditionalInvoiceInformation}
options={LNDViewAdditionalInvoiceInformation.navigationOptions}
/>
<WalletsStack.Screen
name="LNDViewAdditionalInvoicePreImage"
component={LNDViewAdditionalInvoicePreImage}
options={LNDViewAdditionalInvoicePreImage.navigationOptions}
/>
<WalletsStack.Screen name="HodlHodlViewOffer" component={HodlHodlViewOffer} options={HodlHodlViewOffer.navigationOptions} />
<WalletsStack.Screen name="Broadcast" component={Broadcast} options={Broadcast.navigationOptions} />
<WalletsStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions} />
@ -200,6 +206,11 @@ const LNDCreateInvoiceRoot = () => (
component={LNDViewAdditionalInvoiceInformation}
options={LNDViewAdditionalInvoiceInformation.navigationOptions}
/>
<LNDCreateInvoiceStack.Screen
name="LNDViewAdditionalInvoicePreImage"
component={LNDViewAdditionalInvoicePreImage}
options={LNDViewAdditionalInvoicePreImage.navigationOptions}
/>
</LNDCreateInvoiceStack.Navigator>
);

View File

@ -0,0 +1,65 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { BlueCopyTextToClipboard, SafeBlueArea, BlueNavigationStyle, BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import QRCode from 'react-native-qrcode-svg';
import loc from '../../loc';
import { useRoute, useTheme } from '@react-navigation/native';
const LNDViewAdditionalInvoicePreImage = () => {
// state = { walletInfo: undefined };
const { colors } = useTheme();
const { preImageData } = useRoute().params;
const stylesHook = StyleSheet.create({
root: {
backgroundColor: colors.elevated,
},
});
return (
<SafeBlueArea style={[styles.root, stylesHook.root]}>
<View style={styles.wrapper}>
<BlueTextCentered>{loc.lndViewInvoice.preimage}:</BlueTextCentered>
<BlueSpacing20 />
<View style={styles.qrCodeContainer}>
<QRCode
value={preImageData}
logo={require('../../img/qr-code.png')}
size={300}
logoSize={90}
color="#000000"
logoBackgroundColor={colors.brandingColor}
backgroundColor="#FFFFFF"
/>
</View>
<BlueSpacing20 />
<BlueCopyTextToClipboard text={preImageData} />
</View>
</SafeBlueArea>
);
};
const styles = StyleSheet.create({
root: {
flex: 1,
},
wrapper: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
qrCodeContainer: {
justifyContent: 'center',
alignItems: 'center',
marginHorizontal: 16,
borderWidth: 6,
borderRadius: 8,
borderColor: '#FFFFFF',
},
});
export default LNDViewAdditionalInvoicePreImage;
LNDViewAdditionalInvoicePreImage.navigationOptions = () => ({
...BlueNavigationStyle(),
title: loc.lndViewInvoice.additional_info,
});

View File

@ -30,7 +30,6 @@ const LNDViewInvoice = () => {
const { goBack, navigate, setParams, setOptions } = useNavigation();
const [isLoading, setIsLoading] = useState(typeof invoice === 'string');
const [isFetchingInvoices, setIsFetchingInvoices] = useState(true);
const [showPreimageQr, setShowPreimageQr] = useState(false);
const [invoiceStatusChanged, setInvoiceStatusChanged] = useState(false);
const qrCodeHeight = height > width ? width - 20 : width / 2;
const fetchInvoiceInterval = useRef();
@ -147,8 +146,10 @@ const LNDViewInvoice = () => {
return true;
};
const setShowPreimageQrTrue = () => {
setShowPreimageQr(true);
const navigateToPreImageScreen = () => {
navigate('LNDViewAdditionalInvoicePreImage', {
preImageData: invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? invoice.payment_preimage : 'none',
});
};
const handleOnSharePressed = () => {
@ -180,31 +181,6 @@ const LNDViewInvoice = () => {
const currentDate = new Date();
const now = (currentDate.getTime() / 1000) | 0;
const invoiceExpiration = invoice.timestamp + invoice.expire_time;
if (showPreimageQr) {
return (
<View style={styles.root}>
<BlueText>{loc.lndViewInvoice.preimage}:</BlueText>
<BlueSpacing20 />
<View style={styles.qrCodeContainer}>
<QRCode
value={invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? invoice.payment_preimage : 'none'}
logo={require('../../img/qr-code.png')}
size={qrCodeHeight}
logoSize={90}
color="#000000"
logoBackgroundColor={colors.brandingColor}
backgroundColor="#FFFFFF"
/>
</View>
<BlueSpacing20 />
<BlueCopyTextToClipboard
text={invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? invoice.payment_preimage : 'none'}
/>
</View>
);
}
if (invoice.ispaid || invoice.type === 'paid_invoice') {
let amount = 0;
if (invoice.type === 'paid_invoice' && invoice.value) {
@ -226,7 +202,7 @@ const LNDViewInvoice = () => {
/>
<View style={styles.detailsRoot}>
{invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? (
<TouchableOpacity style={styles.detailsTouch} onPress={setShowPreimageQrTrue}>
<TouchableOpacity style={styles.detailsTouch} onPress={navigateToPreImageScreen}>
<Text style={[styles.detailsText, stylesHook.detailsText]}>{loc.send.create_details}</Text>
<Icon name="angle-right" size={18} type="font-awesome" color={colors.alternativeTextColor} />
</TouchableOpacity>