mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-21 10:48:26 +00:00
clean
This commit is contained in:
parent
9e025f1b9d
commit
dc347d937c
@ -214,24 +214,22 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
|
|||||||
if (requests.isNotEmpty()) {
|
if (requests.isNotEmpty()) {
|
||||||
SnodeAPI.getRawBatchResponse(snode, userPublicKey, requests).bind { rawResponses ->
|
SnodeAPI.getRawBatchResponse(snode, userPublicKey, requests).bind { rawResponses ->
|
||||||
isCaughtUp = true
|
isCaughtUp = true
|
||||||
if (deferred.promise.isDone()) {
|
if (!deferred.promise.isDone()) {
|
||||||
return@bind Promise.ofSuccess(Unit)
|
|
||||||
} else {
|
|
||||||
val responseList = (rawResponses["results"] as List<RawResponse>)
|
val responseList = (rawResponses["results"] as List<RawResponse>)
|
||||||
responseList.getOrNull(0)?.let { rawResponse ->
|
responseList.getOrNull(0)?.let { rawResponse ->
|
||||||
if (rawResponse["code"] as? Int != 200) {
|
if (rawResponse["code"] as? Int != 200) {
|
||||||
Log.e("Loki", "Batch sub-request had non-200 response code, returned code ${(rawResponse["code"] as? Int) ?: "[unknown]"}")
|
Log.e("Loki", "Batch sub-request had non-200 response code, returned code ${(rawResponse["code"] as? Int) ?: "[unknown]"}")
|
||||||
return@bind Promise.ofSuccess(Unit)
|
} else {
|
||||||
|
val body = rawResponse["body"] as? RawResponse
|
||||||
|
if (body == null) {
|
||||||
|
Log.e("Loki", "Batch sub-request didn't contain a body")
|
||||||
|
} else {
|
||||||
|
processConfig(snode, body, configFactory.user!!.configNamespace(), configFactory.user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val body = rawResponse["body"] as? RawResponse
|
|
||||||
if (body == null) {
|
|
||||||
Log.e("Loki", "Batch sub-request didn't contain a body")
|
|
||||||
return@bind Promise.ofSuccess(Unit)
|
|
||||||
}
|
|
||||||
processConfig(snode, body, configFactory.user!!.configNamespace(), configFactory.user)
|
|
||||||
}
|
}
|
||||||
return@bind Promise.ofSuccess(Unit)
|
|
||||||
}
|
}
|
||||||
|
Promise.ofSuccess(Unit)
|
||||||
}.fail {
|
}.fail {
|
||||||
Log.e("Loki", "Failed to get raw batch response", it)
|
Log.e("Loki", "Failed to get raw batch response", it)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user