From 1712471167f792adfcfdbd78f5dc0948af3b7900 Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Fri, 27 Nov 2020 22:24:20 -0500 Subject: [PATCH] WIP --- BlueComponents.js | 64 +++--------------- Navigation.js | 11 ++++ .../lnd/lndViewAdditionalInvoicePreImage.js | 65 +++++++++++++++++++ screen/lnd/lndViewInvoice.js | 34 ++-------- 4 files changed, 90 insertions(+), 84 deletions(-) create mode 100644 screen/lnd/lndViewAdditionalInvoicePreImage.js diff --git a/BlueComponents.js b/BlueComponents.js index 9cc644048..a1ed44dca 100644 --- a/BlueComponents.js +++ b/BlueComponents.js @@ -944,11 +944,9 @@ export class BlueSpacing extends Component { } } -export class BlueSpacing40 extends Component { - render() { - return ; - } -} +export const BlueSpacing40 = props => { + return ; +}; export class BlueSpacingVariable extends Component { render() { @@ -966,17 +964,13 @@ export class is { } } -export class BlueSpacing20 extends Component { - render() { - return ; - } -} +export const BlueSpacing20 = props => { + return ; +}; -export class BlueSpacing10 extends Component { - render() { - return ; - } -} +export const BlueSpacing10 = props => { + return ; +}; export class BlueList extends Component { render() { @@ -1514,46 +1508,6 @@ export class BlueSendButtonIcon extends Component { } } -export class ManageFundsBigButton extends Component { - render() { - return ( - - - - - - - - {loc.lnd.title} - - - - - ); - } -} - export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = BitcoinUnit.BTC, timeElapsed }) => { const [subtitleNumberOfLines, setSubtitleNumberOfLines] = useState(1); const { colors } = useTheme(); diff --git a/Navigation.js b/Navigation.js index 7ddf35df8..44e8d81bb 100644 --- a/Navigation.js +++ b/Navigation.js @@ -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} /> + @@ -200,6 +206,11 @@ const LNDCreateInvoiceRoot = () => ( component={LNDViewAdditionalInvoiceInformation} options={LNDViewAdditionalInvoiceInformation.navigationOptions} /> + ); diff --git a/screen/lnd/lndViewAdditionalInvoicePreImage.js b/screen/lnd/lndViewAdditionalInvoicePreImage.js new file mode 100644 index 000000000..f6b33d10e --- /dev/null +++ b/screen/lnd/lndViewAdditionalInvoicePreImage.js @@ -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 ( + + + {loc.lndViewInvoice.preimage}: + + + + + + + + + ); +}; + +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, +}); diff --git a/screen/lnd/lndViewInvoice.js b/screen/lnd/lndViewInvoice.js index 7b188e963..1c1ab3980 100644 --- a/screen/lnd/lndViewInvoice.js +++ b/screen/lnd/lndViewInvoice.js @@ -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 ( - - {loc.lndViewInvoice.preimage}: - - - - - - - - ); - } - if (invoice.ispaid || invoice.type === 'paid_invoice') { let amount = 0; if (invoice.type === 'paid_invoice' && invoice.value) { @@ -226,7 +202,7 @@ const LNDViewInvoice = () => { /> {invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? ( - + {loc.send.create_details}