Minor project updates
- Update kotlinter - Opt in to serialization API to avoid IDE warnings - Replace some deprecated OkHttp function usages - Remove some unnecessary Android version checks/targets
This commit is contained in:
parent
27d26f2814
commit
542c28875d
|
@ -10,7 +10,7 @@ buildscript {
|
|||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath 'org.jmailen.gradle:kotlinter-gradle:3.3.0'
|
||||
classpath 'org.jmailen.gradle:kotlinter-gradle:3.4.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ android {
|
|||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.webkit.WebViewClient
|
|||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import okhttp3.ResponseBody
|
||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.IOException
|
||||
|
@ -72,9 +72,7 @@ class RemoteStorageUtils {
|
|||
|
||||
webview.webViewClient = object : WebViewClient() {
|
||||
override fun onPageFinished(view: WebView, url: String) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||
view.evaluateJavascript(jsScript) {}
|
||||
}
|
||||
if (transparent) {
|
||||
latch.countDown()
|
||||
}
|
||||
|
@ -94,7 +92,7 @@ class RemoteStorageUtils {
|
|||
return if (transparent) {
|
||||
response
|
||||
} else {
|
||||
response.newBuilder().body(ResponseBody.create(response.body?.contentType(), jsInterface.payload)).build()
|
||||
response.newBuilder().body(jsInterface.payload.toResponseBody(response.body?.contentType())).build()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.io.IOException
|
|||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
// TODO: remove after new stable release
|
||||
class CloudflareWafInterceptor(private val cookieDomain: String) : Interceptor {
|
||||
private val context = Injekt.get<Application>()
|
||||
private val handler by lazy { Handler(Looper.getMainLooper()) }
|
||||
|
|
|
@ -28,7 +28,6 @@ import okhttp3.Headers
|
|||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import okhttp3.Response
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.drew.metadata.exif.ExifSubIFDDirectory
|
|||
import okhttp3.Interceptor
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.Response
|
||||
import okhttp3.ResponseBody
|
||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.InputStream
|
||||
|
@ -23,7 +23,7 @@ class VizImageInterceptor : Interceptor {
|
|||
return response
|
||||
|
||||
val image = decodeImage(response.body!!.byteStream())
|
||||
val body = ResponseBody.create(MEDIA_TYPE, image)
|
||||
val body = image.toResponseBody(MEDIA_TYPE)
|
||||
return response.newBuilder()
|
||||
.body(body)
|
||||
.build()
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package eu.kanade.tachiyomi.extension.fr.japscan
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
|
@ -377,7 +375,6 @@ class Japscan : ConfigurableSource, ParsedHttpSource() {
|
|||
webview.settings.domStorageEnabled = true
|
||||
webview.settings.userAgentString = webview.settings.userAgentString.replace("Mobile", "eliboM").replace("Android", "diordnA")
|
||||
webview.webViewClient = object : WebViewClient() {
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
override fun shouldInterceptRequest(
|
||||
view: WebView,
|
||||
request: WebResourceRequest
|
||||
|
|
Loading…
Reference in New Issue