Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: #1309 Sharing doesnt include text #1333

Merged
merged 1 commit into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions screen/lnd/lndViewInvoice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { View, Text, Dimensions, ScrollView, BackHandler, InteractionManager, TouchableOpacity, StyleSheet } from 'react-native';
import { View, Text, Dimensions, ScrollView, BackHandler, TouchableOpacity, StyleSheet } from 'react-native';
import Share from 'react-native-share';
import {
BlueLoading,
Expand Down Expand Up @@ -220,7 +220,6 @@ export default class LNDViewInvoice extends Component {
logo={require('../../img/qr-code.png')}
size={this.state.qrCodeHeight}
logoSize={90}
getRef={c => (this.qrCodeSVG = c)}
color={BlueApp.settings.foregroundColor}
logoBackgroundColor={BlueApp.settings.brandingColor}
/>
Expand Down Expand Up @@ -303,7 +302,6 @@ export default class LNDViewInvoice extends Component {
logo={require('../../img/qr-code.png')}
size={this.state.qrCodeHeight}
logoSize={90}
getRef={c => (this.qrCodeSVG = c)}
color={BlueApp.settings.foregroundColor}
logoBackgroundColor={BlueApp.settings.brandingColor}
/>
Expand All @@ -327,20 +325,8 @@ export default class LNDViewInvoice extends Component {
size: 10,
color: BlueApp.settings.buttonTextColor,
}}
onPress={async () => {
if (this.qrCodeSVG === undefined) {
Share.open({ message: `lightning:${invoice.payment_request}` }).catch(error => console.log(error));
} else {
InteractionManager.runAfterInteractions(async () => {
this.qrCodeSVG.toDataURL(data => {
const shareImageBase64 = {
message: `lightning:${invoice.payment_request}`,
url: `data:image/png;base64,${data}`,
};
Share.open(shareImageBase64).catch(error => console.log(error));
});
});
}
onPress={() => {
Share.open({ message: `lightning://${invoice.payment_request}` }).catch(error => console.log(error));
}}
title={loc.receive.details.share}
/>
Expand Down
18 changes: 2 additions & 16 deletions screen/receive/details.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useCallback, useRef } from 'react';
import React, { useEffect, useState, useCallback } from 'react';
import {
View,
InteractionManager,
Expand Down Expand Up @@ -46,7 +46,6 @@ const ReceiveDetails = () => {
const [customAmount, setCustomAmount] = useState(0);
const [customUnit, setCustomUnit] = useState(BitcoinUnit.BTC);
const [bip21encoded, setBip21encoded] = useState();
const qrCodeSVG = useRef();
const [isCustom, setIsCustom] = useState(false);
const [isCustomModalVisible, setIsCustomModalVisible] = useState(false);
const { navigate, goBack } = useNavigation();
Expand Down Expand Up @@ -188,19 +187,7 @@ const ReceiveDetails = () => {
};

const handleShareButtonPressed = () => {
if (qrCodeSVG === undefined) {
Share.open({ message: bip21encoded }).catch(error => console.log(error));
} else {
InteractionManager.runAfterInteractions(async () => {
qrCodeSVG.current.toDataURL(data => {
const shareImageBase64 = {
message: bip21encoded,
url: `data:image/png;base64,${data}`,
};
Share.open(shareImageBase64).catch(error => console.log(error));
});
});
}
Share.open({ message: bip21encoded }).catch(error => console.log(error));
};

/**
Expand Down Expand Up @@ -253,7 +240,6 @@ const ReceiveDetails = () => {
color={BlueApp.settings.foregroundColor}
logoBackgroundColor={BlueApp.settings.brandingColor}
ecl="H"
getRef={qrCodeSVG}
/>
)}
<BlueCopyTextToClipboard text={isCustom ? bip21encoded : address} />
Expand Down