Commit 9ef3355a authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update app/build.gradle

parent a58f2b0c
...@@ -10,6 +10,13 @@ import okhttp3.OkHttpClient ...@@ -10,6 +10,13 @@ import okhttp3.OkHttpClient
object OkHttpHelper { object OkHttpHelper {
fun getClient(): OkHttpClient {
if (httpClient == null) {
httpClient = OkHttpClient()
}
return httpClient ?: throw AssertionError("httpClient set to null by another thread")
}
fun getClientForUploadFile(): OkHttpClient { fun getClientForUploadFile(): OkHttpClient {
if (httpClientForUploadFile == null) { if (httpClientForUploadFile == null) {
httpClientForUploadFile = OkHttpClient.Builder().build() httpClientForUploadFile = OkHttpClient.Builder().build()
...@@ -39,6 +46,7 @@ object OkHttpHelper { ...@@ -39,6 +46,7 @@ object OkHttpHelper {
return httpClientForWS ?: throw AssertionError("httpClientForWS set to null by another thread") return httpClientForWS ?: throw AssertionError("httpClientForWS set to null by another thread")
} }
private var httpClient: OkHttpClient? = null
private var httpClientForUploadFile: OkHttpClient? = null private var httpClientForUploadFile: OkHttpClient? = null
private var httpClientForDownloadFile: OkHttpClient? = null private var httpClientForDownloadFile: OkHttpClient? = null
private var httpClientForWS: OkHttpClient? = null private var httpClientForWS: OkHttpClient? = null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment