* remove unused imports * remove legacy liquid navigation listener * add extra details prop to spark receive payment wrapper * improve robusness of liquid swaps * bump breez sdk + change swap message * making sure to only mark failed if payment truly failed * improve fee
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import { useNavigation } from '@react-navigation/native';
|
|
import { useEffect, useRef } from 'react';
|
|
import { useAppStatus } from './appStatus';
|
|
import { crashlyticsLogReport } from '../app/functions/crashlyticsLogs';
|
|
import { useRootstockProvider } from './rootstockSwapContext';
|
|
import i18next from 'i18next';
|
|
|
|
export function RootstockNavigationListener() {
|
|
const navigation = useNavigation();
|
|
const { didGetToHomepage } = useAppStatus();
|
|
const { pendingNavigation, setPendingNavigation } = useRootstockProvider();
|
|
const isNavigating = useRef(false); // Use a ref for local state
|
|
|
|
useEffect(() => {
|
|
if (!pendingNavigation) return;
|
|
if (!didGetToHomepage) {
|
|
setPendingNavigation(null);
|
|
return;
|
|
}
|
|
if (isNavigating.current) return;
|
|
crashlyticsLogReport(`Navigating to confirm tx page in roostock listener`);
|
|
isNavigating.current = true;
|
|
|
|
setTimeout(() => {
|
|
requestAnimationFrame(() => {
|
|
navigation.navigate('ErrorScreen', {
|
|
errorMessage: i18next.t('errormessages.receivedRootstock'),
|
|
});
|
|
isNavigating.current = false;
|
|
console.log('cleaning up navigation for rootstock');
|
|
});
|
|
}, 100);
|
|
|
|
setPendingNavigation(null);
|
|
}, [pendingNavigation, didGetToHomepage]);
|
|
|
|
return null;
|
|
}
|