Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ internal class GeoError(volleyError: VolleyError) : Exception(volleyError)
internal class ProductSegmentationError(volleyError: VolleyError) :
Exception(volleyError)

internal class InAppContentFetchingError(error: GlideException?) : Exception(error)
internal class InAppContentFetchingError(error: GlideException?) : Exception(error)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.android.volley.DefaultRetryPolicy
import com.android.volley.DefaultRetryPolicy.DEFAULT_BACKOFF_MULT
import com.android.volley.Request
import com.android.volley.VolleyError
import com.android.volley.toolbox.StringRequest
import com.google.gson.Gson
import kotlinx.coroutines.*
import org.json.JSONException
Expand Down Expand Up @@ -409,17 +408,18 @@ internal class GatewayManager(private val mindboxServiceGenerator: MindboxServic
}
}


suspend fun fetchMobileConfig(configuration: Configuration): String {
return suspendCoroutine { continuation ->
mindboxServiceGenerator.addToRequestQueue(
StringRequest(
Request.Method.GET,
getConfigUrl(configuration),
{ response ->
continuation.resume(response)
MindboxRequest(
methodType = Request.Method.GET,
fullUrl = getConfigUrl(configuration),
configuration = configuration,
jsonRequest = null,
listener = { response ->
continuation.resume(response.toString())
},
{ error ->
errorsListener = { error ->
continuation.resumeWithException(error)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Если тут указать обертку над volleyError, то не будет работать получение конфига из кэша при отсутствии интернета

},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import cloud.mindbox.mobile_sdk.models.MindboxRequest
import cloud.mindbox.mobile_sdk.utils.LoggingExceptionHandler
import com.android.volley.RequestQueue
import com.android.volley.VolleyLog
import com.android.volley.toolbox.StringRequest
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine

Expand All @@ -29,11 +28,6 @@ internal class MindboxServiceGenerator(private val requestQueue: RequestQueue) {
}
}

internal fun addToRequestQueue(request: StringRequest) {
requestQueue.add(request)
// TODO change StringRequest to MindboxRequest or log here
}

internal fun addToRequestQueue(request: MindboxRequest) = LoggingExceptionHandler.runCatching {
requestQueue.let { requestQueue ->
requestQueue.add(request)
Expand Down