mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-15 11:59:21 +01:00
Update LightningSettings.tsx
This commit is contained in:
parent
cbda4cafab
commit
c5c2ce8a61
1 changed files with 21 additions and 20 deletions
|
@ -106,29 +106,30 @@ const LightningSettings: React.FC = () => {
|
||||||
|
|
||||||
setURI(typeof setLndHubUrl === 'string' ? setLndHubUrl.trim() : value.trim());
|
setURI(typeof setLndHubUrl === 'string' ? setLndHubUrl.trim() : value.trim());
|
||||||
};
|
};
|
||||||
const save = useCallback(async () => {
|
const save = useCallback(async () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||||
if (URI) {
|
if (URI) {
|
||||||
const normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
const normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
||||||
|
|
||||||
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
// Validate the normalized URI
|
||||||
|
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
||||||
|
|
||||||
await setLNDHub(normalizedURI);
|
await setLNDHub(normalizedURI);
|
||||||
} else {
|
} else {
|
||||||
await clearLNDHub();
|
await clearLNDHub();
|
||||||
}
|
|
||||||
|
|
||||||
presentAlert({ message: loc.settings.lightning_saved, type: AlertType.Toast });
|
|
||||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
|
||||||
} catch (error) {
|
|
||||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
|
||||||
presentAlert({ message: loc.settings.lightning_error_lndhub_uri });
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
setIsLoading(false);
|
|
||||||
}, [URI]);
|
presentAlert({ message: loc.settings.lightning_saved, type: AlertType.Toast });
|
||||||
|
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||||
|
} catch (error) {
|
||||||
|
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||||
|
presentAlert({ message: loc.settings.lightning_error_lndhub_uri });
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setIsLoading(false);
|
||||||
|
}, [URI]);
|
||||||
|
|
||||||
const importScan = () => {
|
const importScan = () => {
|
||||||
scanQrHelper(route.name).then(data => {
|
scanQrHelper(route.name).then(data => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue