Update useExtendedNavigation.ts

This commit is contained in:
Marcos Rodriguez Velez 2024-03-24 16:43:12 -04:00
parent 7db5c03790
commit cf29590356
No known key found for this signature in database
GPG Key ID: 6030B2F48CCE86D7

View File

@ -68,17 +68,18 @@ export const useExtendedNavigation = (): NavigationProp<ParamListBase> => {
} }
const wallet = wallets.find(w => w.getID() === walletID); const wallet = wallets.find(w => w.getID() === walletID);
if (wallet && !wallet.getUserHasSavedExport()) { if (wallet && !wallet.getUserHasSavedExport()) {
await presentWalletExportReminder() try {
.then(() => { await presentWalletExportReminder();
wallet.setUserHasSavedExport(true); wallet.setUserHasSavedExport(true);
saveToDisk().finally(() => proceedWithNavigation()); await saveToDisk(); // Assuming saveToDisk() returns a Promise.
}) proceedWithNavigation();
.catch(() => { } catch {
originalNavigation.navigate('WalletExportRoot', { originalNavigation.navigate('WalletExportRoot', {
screen: 'WalletExport', screen: 'WalletExport',
params: { walletID }, params: { walletID },
});
}); });
}
return; // Prevent proceeding with the original navigation if the reminder is shown return; // Prevent proceeding with the original navigation if the reminder is shown
} }
} }