Skip to content

Commit

Permalink
Changed Request structure
Browse files Browse the repository at this point in the history
  • Loading branch information
nono3551 committed Jun 17, 2020
1 parent 5bf8934 commit a10a001
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0.5"
versionName "1.0.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import com.android.volley.ParseError
import com.android.volley.Response
import com.android.volley.toolbox.HttpHeaderParser
import com.android.volley.toolbox.JsonRequest
import com.google.gson.ExclusionStrategy
import org.json.JSONException
import org.json.JSONObject
import sk.backbone.android.shared.repositories.server.client.exceptions.BaseHttpException
import sk.backbone.android.shared.repositories.server.client.exceptions.IExceptionDescriptionProvider
import sk.backbone.android.shared.utils.notNullValuesOnly
import sk.backbone.android.shared.utils.toJsonString
import java.io.UnsupportedEncodingException
import java.nio.charset.Charset
import kotlin.coroutines.Continuation
Expand All @@ -27,13 +29,14 @@ abstract class BaseHttpRequest<T>(
val apiVersion: String,
val endpoint: String,
val queryParameters: MutableMap<String, String?>?,
val body: String,
val body: Any?,
val parseSuccessResponse: (JSONObject?) -> T?,
val errorParser: IExceptionDescriptionProvider
val errorParser: IExceptionDescriptionProvider,
val bodyExclusionStrategy: ExclusionStrategy? = null
): JsonRequest<JSONObject>(
requestMethod,
getUri(schema, serverAddress, apiVersion, endpoint, queryParameters).toString(),
body,
body?.toJsonString(bodyExclusionStrategy),
onSuccess(continuation, parseSuccessResponse),
onError(errorParser, continuation)){

Expand All @@ -42,6 +45,7 @@ abstract class BaseHttpRequest<T>(
}

init {
//TODO: Add console logging
retryPolicy = DefaultRetryPolicy(
60000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
Expand Down

0 comments on commit a10a001

Please sign in to comment.