|
@@ -1,19 +1,25 @@
|
|
|
package com.doverfuelingsolutions.issp.api.basic
|
|
|
|
|
|
+import com.doverfuelingsolutions.issp.api.WayneApiConfig
|
|
|
import okhttp3.OkHttpClient
|
|
|
import retrofit2.Retrofit
|
|
|
import retrofit2.converter.gson.GsonConverterFactory
|
|
|
+import java.time.Duration
|
|
|
+import java.util.concurrent.TimeUnit
|
|
|
|
|
|
object RetrofitUtil {
|
|
|
|
|
|
- private val loggingInterceptor: LoggingInterceptor by lazy { LoggingInterceptor() }
|
|
|
- private val authInterceptor: AuthInterceptor by lazy { AuthInterceptor() }
|
|
|
- private val basicHttpBuilder: OkHttpClient.Builder by lazy { OkHttpClient.Builder().addInterceptor(loggingInterceptor) }
|
|
|
- private val authHttpBuilder: OkHttpClient.Builder by lazy {
|
|
|
- OkHttpClient.Builder()
|
|
|
- .addInterceptor(loggingInterceptor)
|
|
|
- .addInterceptor(authInterceptor)
|
|
|
- }
|
|
|
+ private val loggingInterceptor = LoggingInterceptor()
|
|
|
+ private val authInterceptor = AuthInterceptor()
|
|
|
+ private val basicHttpBuilder = OkHttpClient.Builder()
|
|
|
+ .connectTimeout(WayneApiConfig.timeoutConnect, TimeUnit.SECONDS)
|
|
|
+ .callTimeout(WayneApiConfig.timeoutAll, TimeUnit.SECONDS) // timeout for complete call
|
|
|
+ .addInterceptor(loggingInterceptor)
|
|
|
+ private val authHttpBuilder = OkHttpClient.Builder()
|
|
|
+ .connectTimeout(WayneApiConfig.timeoutConnect, TimeUnit.SECONDS)
|
|
|
+ .callTimeout(WayneApiConfig.timeoutAll, TimeUnit.SECONDS)
|
|
|
+ .addInterceptor(loggingInterceptor)
|
|
|
+ .addInterceptor(authInterceptor)
|
|
|
|
|
|
private val mGsonConverterFactory: GsonConverterFactory by lazy { GsonConverterFactory.create() }
|
|
|
|