This commit is contained in:
Marcos Rodriguez Velez 2024-11-13 01:44:11 -04:00
parent 18786d7dc8
commit 45a5db206a
3 changed files with 6 additions and 13 deletions

View File

@ -36,7 +36,6 @@ const LNDCreateInvoice = () => {
const { wallets, saveToDisk, setSelectedWalletID } = useStorage();
const { walletID, uri } = useRoute().params;
const wallet = useRef(wallets.find(item => item.getID() === walletID) || wallets.find(item => item.chain === Chain.OFFCHAIN));
const createInvoiceRef = useRef();
const { name } = useRoute();
const { colors } = useTheme();
const { navigate, getParent, goBack, pop, setParams } = useNavigation();
@ -192,7 +191,7 @@ const LNDCreateInvoice = () => {
// lets decode payreq and subscribe groundcontrol so we can receive push notification when our invoice is paid
/** @type LightningCustodianWallet */
const decoded = await wallet.current.decodeInvoice(invoiceRequest);
await tryToObtainPermissions(createInvoiceRef);
await tryToObtainPermissions();
majorTomToGroundControl([], [decoded.payment_hash], []);
// send to lnurl-withdraw callback url if that exists
@ -315,11 +314,7 @@ const LNDCreateInvoice = () => {
const renderCreateButton = () => {
return (
<View style={styles.createButton}>
{isLoading ? (
<ActivityIndicator />
) : (
<Button disabled={!(amount > 0)} ref={createInvoiceRef} onPress={createInvoice} title={loc.send.details_create} />
)}
{isLoading ? <ActivityIndicator /> : <Button disabled={!(amount > 0)} onPress={createInvoice} title={loc.send.details_create} />}
</View>
);
};

View File

@ -67,7 +67,6 @@ const ReceiveDetails = () => {
const [initialUnconfirmed, setInitialUnconfirmed] = useState(0);
const [displayBalance, setDisplayBalance] = useState('');
const fetchAddressInterval = useRef();
const receiveAddressButton = useRef();
const stylesHook = StyleSheet.create({
customAmount: {
borderColor: colors.formBorder,
@ -110,7 +109,7 @@ const ReceiveDetails = () => {
if (address) {
setAddressBIP21Encoded(address);
try {
await tryToObtainPermissions(receiveAddressButton);
await tryToObtainPermissions();
majorTomToGroundControl([address], [], []);
} catch (error) {
console.error('Error obtaining notifications permissions:', error);
@ -144,7 +143,7 @@ const ReceiveDetails = () => {
}
setAddressBIP21Encoded(newAddress);
try {
await tryToObtainPermissions(receiveAddressButton);
await tryToObtainPermissions();
majorTomToGroundControl([newAddress], [], []);
} catch (error) {
console.error('Error obtaining notifications permissions:', error);
@ -366,7 +365,7 @@ const ReceiveDetails = () => {
)}
<QRCodeComponent value={bip21encoded} />
<CopyTextToClipboard text={isCustom ? bip21encoded : address} ref={receiveAddressButton} />
<CopyTextToClipboard text={isCustom ? bip21encoded : address} />
</View>
</>
);

View File

@ -95,11 +95,10 @@ const NotificationSettings: React.FC = () => {
if (permissionsGranted) {
const invalidated = (await AsyncStorage.getItem(PUSH_TOKEN_INVALIDATED)) === 'true';
let token = await getPushToken();
if (invalidated) {
console.debug('Token previously invalidated. Proceeding to reconfigure notifications.');
const tokenGenerated = await configureNotifications();
token = await getPushToken();
const token = await getPushToken();
if (tokenGenerated && token) {
console.debug('Token reactivated:', token);
await setLevels(true);