mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-15 11:59:21 +01:00
FIX: Attempts to connect without Orbot would not indicate errors
This commit is contained in:
parent
3f1ea9432b
commit
4be2668c81
3 changed files with 12 additions and 3 deletions
|
@ -243,6 +243,7 @@
|
||||||
"electrum_connected": "Connected",
|
"electrum_connected": "Connected",
|
||||||
"electrum_connected_not": "Not Connected",
|
"electrum_connected_not": "Not Connected",
|
||||||
"electrum_error_connect": "Cannot connect to the provided Electrum server",
|
"electrum_error_connect": "Cannot connect to the provided Electrum server",
|
||||||
|
"electrum_error_connect_tor": "Cannot connect to the provided Electrum server. Please make sure Orbot app is connected and try again.",
|
||||||
"lndhub_uri": "E.g., {example}",
|
"lndhub_uri": "E.g., {example}",
|
||||||
"electrum_host": "E.g., {example}",
|
"electrum_host": "E.g., {example}",
|
||||||
"electrum_offline_mode": "Offline Mode",
|
"electrum_offline_mode": "Offline Mode",
|
||||||
|
@ -289,6 +290,7 @@
|
||||||
"language_isRTL": "Restarting BlueWallet is required for the language orientation to take effect.",
|
"language_isRTL": "Restarting BlueWallet is required for the language orientation to take effect.",
|
||||||
"license": "License",
|
"license": "License",
|
||||||
"lightning_error_lndhub_uri": "Invalid LNDhub URI",
|
"lightning_error_lndhub_uri": "Invalid LNDhub URI",
|
||||||
|
"lightning_error_lndhub_uri_tor": "Invalid LNDhub URI. Please make sure Orbot app is connected and try again.",
|
||||||
"lightning_saved": "Your changes have been saved successfully.",
|
"lightning_saved": "Your changes have been saved successfully.",
|
||||||
"lightning_settings": "Lightning Settings",
|
"lightning_settings": "Lightning Settings",
|
||||||
"lightning_settings_explain": "To connect to your own LND node, please install LNDhub and put its URL here in settings. Please note that only wallets created after saving changes will connect to the specified LNDhub.",
|
"lightning_settings_explain": "To connect to your own LND node, please install LNDhub and put its URL here in settings. Please note that only wallets created after saving changes will connect to the specified LNDhub.",
|
||||||
|
|
|
@ -185,7 +185,11 @@ const ElectrumSettings: React.FC = () => {
|
||||||
|
|
||||||
if (serverHost && (serverPort || serverSslPort)) {
|
if (serverHost && (serverPort || serverSslPort)) {
|
||||||
const testConnect = await BlueElectrum.testConnection(serverHost, Number(serverPort), Number(serverSslPort));
|
const testConnect = await BlueElectrum.testConnection(serverHost, Number(serverPort), Number(serverSslPort));
|
||||||
if (!testConnect) return;
|
if (!testConnect) {
|
||||||
|
return presentAlert({
|
||||||
|
message: serverHost.endsWith('.onion') ? loc.settings.electrum_error_connect_tor : loc.settings.electrum_error_connect,
|
||||||
|
});
|
||||||
|
}
|
||||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||||
|
|
||||||
// Clear current data for the preferred host
|
// Clear current data for the preferred host
|
||||||
|
|
|
@ -80,10 +80,11 @@ const LightningSettings: React.FC = () => {
|
||||||
};
|
};
|
||||||
const save = useCallback(async () => {
|
const save = useCallback(async () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
let normalizedURI;
|
||||||
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();
|
normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
||||||
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
||||||
|
|
||||||
await setLNDHub(normalizedURI);
|
await setLNDHub(normalizedURI);
|
||||||
|
@ -95,7 +96,9 @@ const LightningSettings: React.FC = () => {
|
||||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||||
presentAlert({ message: loc.settings.lightning_error_lndhub_uri });
|
presentAlert({
|
||||||
|
message: normalizedURI?.endsWith('.onion') ? loc.settings.lightning_error_lndhub_uri_tor : loc.settings.lightning_error_lndhub_uri,
|
||||||
|
});
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue