Displays an error message when it cannot parse the returning json from relays.
This commit is contained in:
@@ -305,14 +305,25 @@ fun loadRelayInfo(
|
|||||||
object : Callback {
|
object : Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
response.use {
|
response.use {
|
||||||
if (it.isSuccessful) {
|
try {
|
||||||
onInfo(RelayInformation.fromJson(it.body.string()))
|
if (it.isSuccessful) {
|
||||||
} else {
|
onInfo(RelayInformation.fromJson(it.body.string()))
|
||||||
|
} else {
|
||||||
|
scope.launch {
|
||||||
|
Toast
|
||||||
|
.makeText(
|
||||||
|
context,
|
||||||
|
context.getString(R.string.an_error_ocurred_trying_to_get_relay_information, dirtyUrl),
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
Toast
|
Toast
|
||||||
.makeText(
|
.makeText(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.an_error_ocurred_trying_to_get_relay_information),
|
context.getString(R.string.an_error_ocurred_trying_to_get_relay_information, dirtyUrl),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
@@ -326,7 +337,7 @@ fun loadRelayInfo(
|
|||||||
Toast
|
Toast
|
||||||
.makeText(
|
.makeText(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.an_error_ocurred_trying_to_get_relay_information),
|
context.getString(R.string.an_error_ocurred_trying_to_get_relay_information, dirtyUrl),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,7 +433,7 @@
|
|||||||
<string name="sats_to_complete">Zapraiser at %1$s. %2$s sats to goal</string>
|
<string name="sats_to_complete">Zapraiser at %1$s. %2$s sats to goal</string>
|
||||||
<string name="read_from_relay">Read from Relay</string>
|
<string name="read_from_relay">Read from Relay</string>
|
||||||
<string name="write_to_relay">Write to Relay</string>
|
<string name="write_to_relay">Write to Relay</string>
|
||||||
<string name="an_error_ocurred_trying_to_get_relay_information">An error ocurred trying to get relay information</string>
|
<string name="an_error_ocurred_trying_to_get_relay_information">An error ocurred trying to get relay information from %1$s</string>
|
||||||
<string name="owner">Owner</string>
|
<string name="owner">Owner</string>
|
||||||
<string name="version">Version</string>
|
<string name="version">Version</string>
|
||||||
<string name="software">Software</string>
|
<string name="software">Software</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user