Update Okhttp, Jackson and retrofit
This commit is contained in:
parent
dee4675715
commit
e153565086
|
@ -17,8 +17,8 @@ fun Response<out ResponseBody>.toStreamResponse(): StreamResponse {
|
|||
val contentType = responseBody?.contentType()
|
||||
if (
|
||||
contentType != null &&
|
||||
contentType.type().equals("application", true) &&
|
||||
contentType.subtype().equals("json", true)
|
||||
contentType.type.equals("application", true) &&
|
||||
contentType.subtype.equals("json", true)
|
||||
) {
|
||||
val error = SubsonicAPIClient.jacksonMapper.readValue<SubsonicResponse>(
|
||||
responseBody.byteStream()
|
||||
|
@ -40,7 +40,7 @@ fun Response<out ResponseBody>.toStreamResponse(): StreamResponse {
|
|||
* It creates Exceptions from the results returned by the Subsonic API
|
||||
*/
|
||||
@Suppress("ThrowsCount")
|
||||
fun <T : SubsonicResponse> Response<out T>.throwOnFailure(): Response<out T> {
|
||||
fun <T : SubsonicResponse> Response<T>.throwOnFailure(): Response<T> {
|
||||
val response = this
|
||||
|
||||
if (response.isSuccessful && response.body()!!.status === SubsonicResponse.Status.OK) {
|
||||
|
|
|
@ -68,7 +68,7 @@ class SubsonicAPIClient(
|
|||
.addInterceptor { chain ->
|
||||
// Adds default request params
|
||||
val originalRequest = chain.request()
|
||||
val newUrl = originalRequest.url().newBuilder()
|
||||
val newUrl = originalRequest.url.newBuilder()
|
||||
.addQueryParameter("u", config.username)
|
||||
.addQueryParameter("c", config.clientID)
|
||||
.addQueryParameter("f", "json")
|
||||
|
|
|
@ -18,7 +18,7 @@ class PasswordHexInterceptor(private val password: String) : Interceptor {
|
|||
|
||||
override fun intercept(chain: Chain): Response {
|
||||
val originalRequest = chain.request()
|
||||
val updatedUrl = originalRequest.url().newBuilder()
|
||||
val updatedUrl = originalRequest.url.newBuilder()
|
||||
.addEncodedQueryParameter("p", passwordHex).build()
|
||||
return chain.proceed(originalRequest.newBuilder().url(updatedUrl).build())
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class PasswordMD5Interceptor(private val password: String) : Interceptor {
|
|||
override fun intercept(chain: Chain): Response {
|
||||
val originalRequest = chain.request()
|
||||
val salt = getSalt()
|
||||
val updatedUrl = originalRequest.url().newBuilder()
|
||||
val updatedUrl = originalRequest.url.newBuilder()
|
||||
.addQueryParameter("t", getPasswordMD5Hash(salt))
|
||||
.addQueryParameter("s", salt)
|
||||
.build()
|
||||
|
|
|
@ -19,7 +19,7 @@ internal const val TIMEOUT_MILLIS_PER_OFFSET_BYTE = 0.02
|
|||
internal class RangeHeaderInterceptor : Interceptor {
|
||||
override fun intercept(chain: Chain): Response {
|
||||
val originalRequest = chain.request()
|
||||
val headers = originalRequest.headers()
|
||||
val headers = originalRequest.headers
|
||||
return if (headers.names().contains("Range")) {
|
||||
val offsetValue = headers["Range"] ?: "0"
|
||||
val offset = "bytes=$offsetValue-"
|
||||
|
|
|
@ -18,7 +18,7 @@ internal class VersionInterceptor(
|
|||
val newRequest = originalRequest.newBuilder()
|
||||
.url(
|
||||
originalRequest
|
||||
.url()
|
||||
.url
|
||||
.newBuilder()
|
||||
.addQueryParameter("v", protocolVersion.restApiVersion)
|
||||
.build()
|
||||
|
|
|
@ -22,9 +22,9 @@ kotlin = "1.6.10"
|
|||
kotlinxCoroutines = "1.6.0-native-mt"
|
||||
viewModelKtx = "2.3.0"
|
||||
|
||||
retrofit = "2.6.4"
|
||||
jackson = "2.9.5"
|
||||
okhttp = "3.12.13"
|
||||
retrofit = "2.9.0"
|
||||
jackson = "2.10.1"
|
||||
okhttp = "4.9.1"
|
||||
koin = "3.0.2"
|
||||
picasso = "2.71828"
|
||||
|
||||
|
|
Loading…
Reference in New Issue