Drop dependency upon Fuel library
Current version is outdated and it was mainly here for Android 4.4 support. Move to Okhttpclient instead. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -157,7 +157,6 @@ dependencies {
|
|||||||
implementation "com.novoda:merlin:1.2.1"
|
implementation "com.novoda:merlin:1.2.1"
|
||||||
|
|
||||||
//HTTP Clients
|
//HTTP Clients
|
||||||
implementation "com.github.kittinunf.fuel:fuel:2.3.1"
|
|
||||||
implementation "com.squareup.okhttp3:okhttp:4.11.0"
|
implementation "com.squareup.okhttp3:okhttp:4.11.0"
|
||||||
|
|
||||||
//Fetch - Downloader
|
//Fetch - Downloader
|
||||||
|
|||||||
@@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
package com.aurora.store.util
|
package com.aurora.store.util
|
||||||
|
|
||||||
import com.github.kittinunf.fuel.Fuel
|
import com.aurora.store.data.network.OkHttpClient
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
|
||||||
class AC2DMTask {
|
class AC2DMTask {
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
@@ -44,18 +45,19 @@ class AC2DMTask {
|
|||||||
|
|
||||||
val body = params.map { "${it.key}=${it.value}" }.joinToString(separator = "&")
|
val body = params.map { "${it.key}=${it.value}" }.joinToString(separator = "&")
|
||||||
|
|
||||||
val response = Fuel.post(TOKEN_AUTH_URL)
|
val header = mapOf(
|
||||||
.body(body)
|
"app" to "com.google.android.gms",
|
||||||
.header("app" to "com.google.android.gms")
|
"User-Agent" to "",
|
||||||
.header("User-Agent" to "")
|
"Content-Type" to "application/x-www-form-urlencoded"
|
||||||
.header("Content-Type" to "application/x-www-form-urlencoded")
|
)
|
||||||
.response()
|
|
||||||
|
|
||||||
return response.third.fold(success = {
|
val response = OkHttpClient.post(TOKEN_AUTH_URL, header, body.toRequestBody())
|
||||||
AC2DMUtil.parseResponse(String(it))
|
|
||||||
}, failure = {
|
return if (response.isSuccessful) {
|
||||||
|
AC2DMUtil.parseResponse(String(response.responseBytes))
|
||||||
|
} else {
|
||||||
mapOf()
|
mapOf()
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user