diff --git a/annotations/build.gradle.kts b/annotations/build.gradle.kts index 7fada1cc2..82482f1b3 100644 --- a/annotations/build.gradle.kts +++ b/annotations/build.gradle.kts @@ -3,5 +3,5 @@ plugins { } dependencies { - compileOnly(Deps.kotlin.stdlib) + compileOnly(Dependencies.kotlin.stdlib) } diff --git a/buildSrc/src/main/kotlin/AndroidConfig.kt b/buildSrc/src/main/kotlin/AndroidConfig.kt new file mode 100644 index 000000000..94aaf4e26 --- /dev/null +++ b/buildSrc/src/main/kotlin/AndroidConfig.kt @@ -0,0 +1,6 @@ +object AndroidConfig { + const val compileSdk = 30 + const val minSdk = 21 + const val targetSdk = 29 + const val buildTools = "30.0.3" +} diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt deleted file mode 100644 index fe87a5100..000000000 --- a/buildSrc/src/main/kotlin/Config.kt +++ /dev/null @@ -1,6 +0,0 @@ -object Config { - const val compileSdk = 29 - const val minSdk = 21 - const val targetSdk = 29 - const val buildTools = "29.0.3" -} diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Dependencies.kt similarity index 56% rename from buildSrc/src/main/kotlin/Deps.kt rename to buildSrc/src/main/kotlin/Dependencies.kt index 2ef266b98..5a209d904 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,9 +1,9 @@ -object Deps { +object Dependencies { 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 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" } diff --git a/common.gradle b/common.gradle index dce2d536d..17e2b5d0a 100644 --- a/common.gradle +++ b/common.gradle @@ -1,8 +1,8 @@ apply plugin: 'org.jmailen.kotlinter' android { - compileSdkVersion Config.compileSdk - buildToolsVersion Config.buildTools + compileSdkVersion AndroidConfig.compileSdk + buildToolsVersion AndroidConfig.buildTools buildTypes { release { @@ -25,8 +25,8 @@ android { } defaultConfig { - minSdkVersion Config.minSdk - targetSdkVersion Config.targetSdk + minSdkVersion AndroidConfig.minSdk + targetSdkVersion AndroidConfig.targetSdk applicationIdSuffix pkgNameSuffix versionCode extVersionCode versionName "$libVersion.$extVersionCode" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 3dcff7437..c9065b8d4 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -3,11 +3,11 @@ plugins { } android { - compileSdkVersion(Config.compileSdk) - buildToolsVersion(Config.buildTools) + compileSdkVersion(AndroidConfig.compileSdk) + buildToolsVersion(AndroidConfig.buildTools) defaultConfig { - minSdkVersion(Config.minSdk) + minSdkVersion(AndroidConfig.minSdk) } sourceSets { diff --git a/lib/dataimage/build.gradle.kts b/lib/dataimage/build.gradle.kts index a283c2fa3..f5cf8cb52 100644 --- a/lib/dataimage/build.gradle.kts +++ b/lib/dataimage/build.gradle.kts @@ -4,12 +4,12 @@ plugins { } android { - compileSdkVersion(Config.compileSdk) - buildToolsVersion(Config.buildTools) + compileSdkVersion(AndroidConfig.compileSdk) + buildToolsVersion(AndroidConfig.buildTools) defaultConfig { - minSdkVersion(Config.minSdk) - targetSdkVersion(Config.targetSdk) + minSdkVersion(AndroidConfig.minSdk) + targetSdkVersion(AndroidConfig.targetSdk) } } @@ -18,7 +18,7 @@ repositories { } dependencies { - compileOnly(Deps.kotlin.stdlib) - compileOnly(Deps.okhttp) - compileOnly(Deps.jsoup) + compileOnly(Dependencies.kotlin.stdlib) + compileOnly(Dependencies.okhttp) + compileOnly(Dependencies.jsoup) } diff --git a/lib/dataimage/src/main/java/eu/kanade/tachiyomi/lib/dataimage/DataImageInterceptor.kt b/lib/dataimage/src/main/java/eu/kanade/tachiyomi/lib/dataimage/DataImageInterceptor.kt index df1cc81f6..3599a8910 100644 --- a/lib/dataimage/src/main/java/eu/kanade/tachiyomi/lib/dataimage/DataImageInterceptor.kt +++ b/lib/dataimage/src/main/java/eu/kanade/tachiyomi/lib/dataimage/DataImageInterceptor.kt @@ -2,10 +2,10 @@ package eu.kanade.tachiyomi.lib.dataimage import android.util.Base64 import okhttp3.Interceptor -import okhttp3.MediaType +import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Protocol import okhttp3.Response -import okhttp3.ResponseBody +import okhttp3.ResponseBody.Companion.toResponseBody import org.jsoup.nodes.Element /** @@ -43,7 +43,7 @@ class DataImageInterceptor : Interceptor { private val mediaTypePattern = Regex("""(^[^;,]*)[;,]""") 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")) { val dataString = url.substringAfter("?") val byteArray = if (dataString.contains("base64")) { @@ -51,8 +51,8 @@ class DataImageInterceptor : Interceptor { } else { dataString.substringAfter(",").toByteArray() } - val mediaType = MediaType.parse(mediaTypePattern.find(dataString)!!.value) - Response.Builder().body(ResponseBody.create(mediaType, byteArray)) + val mediaType = mediaTypePattern.find(dataString)!!.value.toMediaTypeOrNull() + Response.Builder().body(byteArray.toResponseBody(mediaType)) .request(chain.request()) .protocol(Protocol.HTTP_1_0) .code(200) diff --git a/lib/ratelimit/build.gradle.kts b/lib/ratelimit/build.gradle.kts index 5dfcf0f41..a9c37e057 100644 --- a/lib/ratelimit/build.gradle.kts +++ b/lib/ratelimit/build.gradle.kts @@ -4,12 +4,12 @@ plugins { } android { - compileSdkVersion(Config.compileSdk) - buildToolsVersion(Config.buildTools) + compileSdkVersion(AndroidConfig.compileSdk) + buildToolsVersion(AndroidConfig.buildTools) defaultConfig { - minSdkVersion(Config.minSdk) - targetSdkVersion(Config.targetSdk) + minSdkVersion(AndroidConfig.minSdk) + targetSdkVersion(AndroidConfig.targetSdk) } } @@ -18,6 +18,6 @@ repositories { } dependencies { - compileOnly(Deps.kotlin.stdlib) - compileOnly(Deps.okhttp) + compileOnly(Dependencies.kotlin.stdlib) + compileOnly(Dependencies.okhttp) } diff --git a/lib/ratelimit/src/main/java/eu/kanade/tachiyomi/lib/ratelimit/SpecificHostRateLimitInterceptor.kt b/lib/ratelimit/src/main/java/eu/kanade/tachiyomi/lib/ratelimit/SpecificHostRateLimitInterceptor.kt index b9e8ee9b5..cd2e5cbf0 100644 --- a/lib/ratelimit/src/main/java/eu/kanade/tachiyomi/lib/ratelimit/SpecificHostRateLimitInterceptor.kt +++ b/lib/ratelimit/src/main/java/eu/kanade/tachiyomi/lib/ratelimit/SpecificHostRateLimitInterceptor.kt @@ -28,10 +28,10 @@ class SpecificHostRateLimitInterceptor( private val requestQueue = ArrayList(permits) private val rateLimitMillis = unit.toMillis(period) - private val host = httpUrl.host() + private val host = httpUrl.host override fun intercept(chain: Interceptor.Chain): Response { - if (chain.request().url().host() != host) { + if (chain.request().url.host != host) { return chain.proceed(chain.request()) } synchronized(requestQueue) { diff --git a/multisrc/build.gradle.kts b/multisrc/build.gradle.kts index 12cbc3004..4181abd12 100644 --- a/multisrc/build.gradle.kts +++ b/multisrc/build.gradle.kts @@ -7,12 +7,12 @@ plugins { } android { - compileSdkVersion(Config.compileSdk) - buildToolsVersion(Config.buildTools) + compileSdkVersion(AndroidConfig.compileSdk) + buildToolsVersion(AndroidConfig.buildTools) defaultConfig { minSdkVersion(29) - targetSdkVersion(Config.targetSdk) + targetSdkVersion(AndroidConfig.targetSdk) } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt index c66528c7f..53ffe76db 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt @@ -245,7 +245,7 @@ abstract class Madara( private class ArtistFilter : Filter.Text("Artist") private class YearFilter : Filter.Text("Year of Released") private class StatusFilter(status: List) : Filter.Group("Status", status) - + private class OrderByFilter : UriPartFilter( "Order By", arrayOf( @@ -258,7 +258,7 @@ abstract class Madara( Pair("New", "new-manga") ) ) - + private class GenreConditionFilter : UriPartFilter( "Genre condition", arrayOf( @@ -266,7 +266,7 @@ abstract class Madara( Pair("and", "1") ) ) - + private class AdultContentFilter : UriPartFilter( "Adult Content", arrayOf( @@ -275,7 +275,7 @@ abstract class Madara( Pair("Only", "1") ) ) - + private class GenreList(genres: List) : Filter.Group("Genres", genres) class Genre(name: String, val id: String = name) : Filter.CheckBox(name) @@ -626,10 +626,8 @@ abstract class Madara( val hostName = prefsEntries[prefsEntryValues.indexOf(validHost)] Handler(Looper.getMainLooper()).post { val toast = Toast.makeText(Injekt.get().applicationContext, "Host : $hostName\nYou may want to switch to this host to avoid unnecessary loading time", Toast.LENGTH_SHORT) - val view = toast.view.findViewById(android.R.id.message) - view?.let { - view.gravity = Gravity.CENTER_HORIZONTAL - } + val view = toast.view?.findViewById(android.R.id.message) + view?.let { it.gravity = Gravity.CENTER_HORIZONTAL } toast.show() } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 0cc75d9c7..33b164998 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -38,7 +38,7 @@ if (System.getenv("CI") == null || System.getenv("CI_PUSH") == "true") { * comment out the parts above and uncomment below. */ // val lang = "all" - // val name = "mmrcms" + // val name = "mangadex" // include(":${lang}-${name}") // project(":${lang}-${name}").projectDir = File("src/${lang}/${name}") } else {