FIX: electrum settings

This commit is contained in:
Overtorment 2019-07-19 21:19:53 +01:00
parent 8ef089d777
commit e99e9e8e62

View File

@ -42,7 +42,11 @@ export default class ElectrumSettings extends Component {
this.state.host = this.state.host ? this.state.host : ''; this.state.host = this.state.host ? this.state.host : '';
this.state.port = this.state.port ? this.state.port : ''; this.state.port = this.state.port ? this.state.port : '';
try { try {
if (!(await BlueElectrum.testConnection(this.state.host, this.state.port))) { if (!this.state.host && !this.state.port) {
await AsyncStorage.setItem(AppStorage.ELECTRUM_HOST, '');
await AsyncStorage.setItem(AppStorage.ELECTRUM_TCP_PORT, '');
alert('Your changes have been saved successfully. Restart may be required for changes to take effect.');
} else if (!(await BlueElectrum.testConnection(this.state.host, this.state.port))) {
alert("Can't connect to provided Electrum server"); alert("Can't connect to provided Electrum server");
} else { } else {
await AsyncStorage.setItem(AppStorage.ELECTRUM_HOST, this.state.host); await AsyncStorage.setItem(AppStorage.ELECTRUM_HOST, this.state.host);