Improves Logs when the app cannot connect with relays.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.actions
|
package com.vitorpamplona.amethyst.ui.actions
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -305,9 +306,10 @@ fun loadRelayInfo(
|
|||||||
object : Callback {
|
object : Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
response.use {
|
response.use {
|
||||||
|
val body = it.body.string()
|
||||||
try {
|
try {
|
||||||
if (it.isSuccessful) {
|
if (it.isSuccessful) {
|
||||||
onInfo(RelayInformation.fromJson(it.body.string()))
|
onInfo(RelayInformation.fromJson(body))
|
||||||
} else {
|
} else {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
Toast
|
Toast
|
||||||
@@ -319,6 +321,7 @@ fun loadRelayInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
Log.e("RelayInfoFail", "Resulting Message from Relay in not parseable: $body", e)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
Toast
|
Toast
|
||||||
.makeText(
|
.makeText(
|
||||||
@@ -332,7 +335,7 @@ fun loadRelayInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call, e: IOException) {
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
e.printStackTrace()
|
Log.e("RelayInfoFail", "Resulting Message from Relay in not parseable", e)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
Toast
|
Toast
|
||||||
.makeText(
|
.makeText(
|
||||||
|
|||||||
Reference in New Issue
Block a user