diff --git a/MainBottomTabs.js b/MainBottomTabs.js index 88cef5c8a..367ff586e 100644 --- a/MainBottomTabs.js +++ b/MainBottomTabs.js @@ -180,6 +180,15 @@ const CreateWalletStackNavigator = createStackNavigator({ }, }); +const LightningScanInvoiceStackNavigator = createStackNavigator({ + ScanLndInvoice: { + screen: ScanLndInvoice, + }, + Success: { + screen: Success, + }, +}); + const MainBottomTabs = createStackNavigator( { Wallets: { @@ -236,7 +245,10 @@ const MainBottomTabs = createStackNavigator( }, }, ScanLndInvoice: { - screen: ScanLndInvoice, + screen: LightningScanInvoiceStackNavigator, + navigationOptions: { + header: null, + }, }, ScanQrAddress: { screen: sendScanQrAddress, diff --git a/screen/lnd/scanLndInvoice.js b/screen/lnd/scanLndInvoice.js index 61584f6f0..3cf2a5bc1 100644 --- a/screen/lnd/scanLndInvoice.js +++ b/screen/lnd/scanLndInvoice.js @@ -72,12 +72,6 @@ export default class ScanLndInvoice extends React.Component { processInvoice = data => { this.setState({ isLoading: true }, async () => { - if (this.ignoreRead) return; - this.ignoreRead = true; - setTimeout(() => { - this.ignoreRead = false; - }, 6000); - if (!this.state.fromWallet) { alert('Before paying a Lightning invoice, you must first add a Lightning wallet.'); return this.props.navigation.goBack(); @@ -149,11 +143,8 @@ export default class ScanLndInvoice extends React.Component { return alert(loc.lnd.sameWalletAsInvoiceError); } - let start = +new Date(); - let end; try { await fromWallet.payInvoice(this.state.invoice, this.state.decoded.num_satoshis); - end = +new Date(); } catch (Err) { console.log(Err.message); this.setState({ isLoading: false }); @@ -161,11 +152,12 @@ export default class ScanLndInvoice extends React.Component { return alert('Error'); } - console.log('payInvoice took', (end - start) / 1000, 'sec'); EV(EV.enum.REMOTE_TRANSACTIONS_COUNT_CHANGED); // someone should fetch txs - - alert('Success'); - this.props.navigation.goBack(); + this.props.navigation.navigate('Success', { + amount: this.state.decoded.num_satoshis, + amountUnit: BitcoinUnit.SATS, + dismissModal: () => this.props.navigation.dismiss(), + }); }, ); } @@ -237,24 +229,26 @@ export default class ScanLndInvoice extends React.Component { )} - {this.state.isLoading ? ( - - - - ) : ( - { - this.pay(); - }} - disabled={this.shouldDisablePayButton()} - /> - )} + + {this.state.isLoading ? ( + + + + ) : ( + { + this.pay(); + }} + disabled={this.shouldDisablePayButton()} + /> + )} + diff --git a/screen/send/success.js b/screen/send/success.js index 301484cc5..c6b7e8aa2 100644 --- a/screen/send/success.js +++ b/screen/send/success.js @@ -18,7 +18,8 @@ export default class Success extends Component { this.state = { amount: props.navigation.getParam('amount'), - fee: props.navigation.getParam('fee'), + fee: props.navigation.getParam('fee') || 0, + amountUnit: props.navigation.getParam('amountUnit') || BitcoinUnit.BTC, }; } @@ -51,21 +52,23 @@ export default class Success extends Component { alignSelf: 'flex-end', }} > - {' ' + BitcoinUnit.BTC} + {' ' + this.state.amountUnit} - - {loc.send.create.fee}: {loc.formatBalance(this.state.fee, BitcoinUnit.SATS)} - + {this.state.fee > 0 && ( + + {loc.send.create.fee}: {loc.formatBalance(this.state.fee, BitcoinUnit.SATS)} + + )}