Compile to SDK 30, update lib dependencies (#7187)

This commit is contained in:
arkon 2021-05-22 16:04:17 -04:00 committed by GitHub
parent 5f10f155d9
commit 3d0af119ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 47 additions and 49 deletions

View File

@ -3,5 +3,5 @@ plugins {
} }
dependencies { dependencies {
compileOnly(Deps.kotlin.stdlib) compileOnly(Dependencies.kotlin.stdlib)
} }

View File

@ -0,0 +1,6 @@
object AndroidConfig {
const val compileSdk = 30
const val minSdk = 21
const val targetSdk = 29
const val buildTools = "30.0.3"
}

View File

@ -1,6 +0,0 @@
object Config {
const val compileSdk = 29
const val minSdk = 21
const val targetSdk = 29
const val buildTools = "29.0.3"
}

View File

@ -1,9 +1,9 @@
object Deps { object Dependencies {
object kotlin { object kotlin {
const val version = "1.4.10" const val version = "1.4.32"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
} }
const val jsoup = "org.jsoup:jsoup:1.13.1" const val jsoup = "org.jsoup:jsoup:1.13.1"
const val okhttp = "com.squareup.okhttp3:okhttp:3.10.0" const val okhttp = "com.squareup.okhttp3:okhttp:4.9.1"
} }

View File

@ -1,8 +1,8 @@
apply plugin: 'org.jmailen.kotlinter' apply plugin: 'org.jmailen.kotlinter'
android { android {
compileSdkVersion Config.compileSdk compileSdkVersion AndroidConfig.compileSdk
buildToolsVersion Config.buildTools buildToolsVersion AndroidConfig.buildTools
buildTypes { buildTypes {
release { release {
@ -25,8 +25,8 @@ android {
} }
defaultConfig { defaultConfig {
minSdkVersion Config.minSdk minSdkVersion AndroidConfig.minSdk
targetSdkVersion Config.targetSdk targetSdkVersion AndroidConfig.targetSdk
applicationIdSuffix pkgNameSuffix applicationIdSuffix pkgNameSuffix
versionCode extVersionCode versionCode extVersionCode
versionName "$libVersion.$extVersionCode" versionName "$libVersion.$extVersionCode"

View File

@ -3,11 +3,11 @@ plugins {
} }
android { android {
compileSdkVersion(Config.compileSdk) compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(Config.buildTools) buildToolsVersion(AndroidConfig.buildTools)
defaultConfig { defaultConfig {
minSdkVersion(Config.minSdk) minSdkVersion(AndroidConfig.minSdk)
} }
sourceSets { sourceSets {

View File

@ -4,12 +4,12 @@ plugins {
} }
android { android {
compileSdkVersion(Config.compileSdk) compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(Config.buildTools) buildToolsVersion(AndroidConfig.buildTools)
defaultConfig { defaultConfig {
minSdkVersion(Config.minSdk) minSdkVersion(AndroidConfig.minSdk)
targetSdkVersion(Config.targetSdk) targetSdkVersion(AndroidConfig.targetSdk)
} }
} }
@ -18,7 +18,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly(Deps.kotlin.stdlib) compileOnly(Dependencies.kotlin.stdlib)
compileOnly(Deps.okhttp) compileOnly(Dependencies.okhttp)
compileOnly(Deps.jsoup) compileOnly(Dependencies.jsoup)
} }

View File

@ -2,10 +2,10 @@ package eu.kanade.tachiyomi.lib.dataimage
import android.util.Base64 import android.util.Base64
import okhttp3.Interceptor import okhttp3.Interceptor
import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.Protocol import okhttp3.Protocol
import okhttp3.Response import okhttp3.Response
import okhttp3.ResponseBody import okhttp3.ResponseBody.Companion.toResponseBody
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
/** /**
@ -43,7 +43,7 @@ class DataImageInterceptor : Interceptor {
private val mediaTypePattern = Regex("""(^[^;,]*)[;,]""") private val mediaTypePattern = Regex("""(^[^;,]*)[;,]""")
override fun intercept(chain: Interceptor.Chain): Response { override fun intercept(chain: Interceptor.Chain): Response {
val url = chain.request().url().toString() val url = chain.request().url.toString()
return if (url.startsWith("https://127.0.0.1/?image")) { return if (url.startsWith("https://127.0.0.1/?image")) {
val dataString = url.substringAfter("?") val dataString = url.substringAfter("?")
val byteArray = if (dataString.contains("base64")) { val byteArray = if (dataString.contains("base64")) {
@ -51,8 +51,8 @@ class DataImageInterceptor : Interceptor {
} else { } else {
dataString.substringAfter(",").toByteArray() dataString.substringAfter(",").toByteArray()
} }
val mediaType = MediaType.parse(mediaTypePattern.find(dataString)!!.value) val mediaType = mediaTypePattern.find(dataString)!!.value.toMediaTypeOrNull()
Response.Builder().body(ResponseBody.create(mediaType, byteArray)) Response.Builder().body(byteArray.toResponseBody(mediaType))
.request(chain.request()) .request(chain.request())
.protocol(Protocol.HTTP_1_0) .protocol(Protocol.HTTP_1_0)
.code(200) .code(200)

View File

@ -4,12 +4,12 @@ plugins {
} }
android { android {
compileSdkVersion(Config.compileSdk) compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(Config.buildTools) buildToolsVersion(AndroidConfig.buildTools)
defaultConfig { defaultConfig {
minSdkVersion(Config.minSdk) minSdkVersion(AndroidConfig.minSdk)
targetSdkVersion(Config.targetSdk) targetSdkVersion(AndroidConfig.targetSdk)
} }
} }
@ -18,6 +18,6 @@ repositories {
} }
dependencies { dependencies {
compileOnly(Deps.kotlin.stdlib) compileOnly(Dependencies.kotlin.stdlib)
compileOnly(Deps.okhttp) compileOnly(Dependencies.okhttp)
} }

View File

@ -28,10 +28,10 @@ class SpecificHostRateLimitInterceptor(
private val requestQueue = ArrayList<Long>(permits) private val requestQueue = ArrayList<Long>(permits)
private val rateLimitMillis = unit.toMillis(period) private val rateLimitMillis = unit.toMillis(period)
private val host = httpUrl.host() private val host = httpUrl.host
override fun intercept(chain: Interceptor.Chain): Response { override fun intercept(chain: Interceptor.Chain): Response {
if (chain.request().url().host() != host) { if (chain.request().url.host != host) {
return chain.proceed(chain.request()) return chain.proceed(chain.request())
} }
synchronized(requestQueue) { synchronized(requestQueue) {

View File

@ -7,12 +7,12 @@ plugins {
} }
android { android {
compileSdkVersion(Config.compileSdk) compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(Config.buildTools) buildToolsVersion(AndroidConfig.buildTools)
defaultConfig { defaultConfig {
minSdkVersion(29) minSdkVersion(29)
targetSdkVersion(Config.targetSdk) targetSdkVersion(AndroidConfig.targetSdk)
} }
} }

View File

@ -245,7 +245,7 @@ abstract class Madara(
private class ArtistFilter : Filter.Text("Artist") private class ArtistFilter : Filter.Text("Artist")
private class YearFilter : Filter.Text("Year of Released") private class YearFilter : Filter.Text("Year of Released")
private class StatusFilter(status: List<Tag>) : Filter.Group<Tag>("Status", status) private class StatusFilter(status: List<Tag>) : Filter.Group<Tag>("Status", status)
private class OrderByFilter : UriPartFilter( private class OrderByFilter : UriPartFilter(
"Order By", "Order By",
arrayOf( arrayOf(
@ -258,7 +258,7 @@ abstract class Madara(
Pair("New", "new-manga") Pair("New", "new-manga")
) )
) )
private class GenreConditionFilter : UriPartFilter( private class GenreConditionFilter : UriPartFilter(
"Genre condition", "Genre condition",
arrayOf( arrayOf(
@ -266,7 +266,7 @@ abstract class Madara(
Pair("and", "1") Pair("and", "1")
) )
) )
private class AdultContentFilter : UriPartFilter( private class AdultContentFilter : UriPartFilter(
"Adult Content", "Adult Content",
arrayOf( arrayOf(
@ -275,7 +275,7 @@ abstract class Madara(
Pair("Only", "1") Pair("Only", "1")
) )
) )
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres) private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
class Genre(name: String, val id: String = name) : Filter.CheckBox(name) class Genre(name: String, val id: String = name) : Filter.CheckBox(name)
@ -626,10 +626,8 @@ abstract class Madara(
val hostName = prefsEntries[prefsEntryValues.indexOf(validHost)] val hostName = prefsEntries[prefsEntryValues.indexOf(validHost)]
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
val toast = Toast.makeText(Injekt.get<Application>().applicationContext, "Host : $hostName\nYou may want to switch to this host to avoid unnecessary loading time", Toast.LENGTH_SHORT) val toast = Toast.makeText(Injekt.get<Application>().applicationContext, "Host : $hostName\nYou may want to switch to this host to avoid unnecessary loading time", Toast.LENGTH_SHORT)
val view = toast.view.findViewById<TextView>(android.R.id.message) val view = toast.view?.findViewById<TextView>(android.R.id.message)
view?.let { view?.let { it.gravity = Gravity.CENTER_HORIZONTAL }
view.gravity = Gravity.CENTER_HORIZONTAL
}
toast.show() toast.show()
} }
} }

View File

@ -38,7 +38,7 @@ if (System.getenv("CI") == null || System.getenv("CI_PUSH") == "true") {
* comment out the parts above and uncomment below. * comment out the parts above and uncomment below.
*/ */
// val lang = "all" // val lang = "all"
// val name = "mmrcms" // val name = "mangadex"
// include(":${lang}-${name}") // include(":${lang}-${name}")
// project(":${lang}-${name}").projectDir = File("src/${lang}/${name}") // project(":${lang}-${name}").projectDir = File("src/${lang}/${name}")
} else { } else {