mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-18 13:26:33 +01:00
Merge pull request #7445 from BlueWallet/marcosrdz-patch-3
Update LightningSettings.tsx
This commit is contained in:
commit
13bb11b062
@ -137,7 +137,7 @@
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<false/>
|
||||
<true/>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
<key>NSExceptionDomains</key>
|
||||
|
@ -100,29 +100,28 @@ const LightningSettings: React.FC = () => {
|
||||
|
||||
setURI(typeof setLndHubUrl === 'string' ? setLndHubUrl.trim() : value.trim());
|
||||
};
|
||||
const save = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||
if (URI) {
|
||||
const normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
||||
const save = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||
if (URI) {
|
||||
const normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
||||
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
||||
|
||||
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
||||
|
||||
await setLNDHub(normalizedURI);
|
||||
} else {
|
||||
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);
|
||||
await setLNDHub(normalizedURI);
|
||||
} else {
|
||||
await clearLNDHub();
|
||||
}
|
||||
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 = () => {
|
||||
navigate('ScanQRCode', {
|
||||
|
Loading…
Reference in New Issue
Block a user