Fixing compiler warning about unused variable
@@ -58,21 +58,27 @@ class AppElectrumConfigurationController(
override fun process(intent: ElectrumConfiguration.Intent) {
when (intent) {
is ElectrumConfiguration.Intent.UpdateElectrumServer -> {
- var error: Error? = null
- when {
- intent.address.isNullOrBlank() -> configurationManager.updateElectrumConfig(null)
- !intent.address.matches("""(.*):(\d*)""".toRegex()) -> {
- error = InvalidElectrumAddress
+ val error: Error? = when {
+ intent.address.isNullOrBlank() -> {
+ configurationManager.updateElectrumConfig(null)
+ null
}
- else -> {
+ intent.address.matches("""(.*):(\d*)""".toRegex()) -> {
intent.address.split(":").let {
val host = it.first()
val port = it.last()
val serverAddress = ServerAddress(host, port.toInt(), TcpSocket.TLS.SAFE)
configurationManager.updateElectrumConfig(serverAddress)
}
+ null
+ }
+ else -> {
+ InvalidElectrumAddress
}
}
+ launch {
+ model { copy(error = error) }
+ }
}
}
}
