Upgrade dependencies (#352)

* Upgrade gradle to version 7.0.2

* Disable deprecated options

* Upgrade to latest SDK

* Upgrade kotlin

* Upgrade dependencies
This commit is contained in:
davidoskky 2021-10-07 21:01:12 +02:00 committed by GitHub
parent abba04839a
commit a12623f8e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 38 deletions

View File

@ -35,7 +35,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 30
compileSdkVersion 31
buildToolsVersion '30.0.3'
buildFeatures {
viewBinding true
@ -43,7 +43,7 @@ android {
defaultConfig {
applicationId "apps.amine.bou.readerforselfoss"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
versionCode versionCodeFromGit()
versionName versionNameFromGit()
@ -101,14 +101,14 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Android Support
implementation "androidx.appcompat:appcompat:1.3.0-alpha02"
implementation 'com.google.android.material:material:1.3.0-beta01'
implementation 'androidx.recyclerview:recyclerview:1.2.0-beta01'
implementation "androidx.appcompat:appcompat:1.4.0-beta01"
implementation 'com.google.android.material:material:1.5.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.3.0-alpha01'
implementation "androidx.legacy:legacy-support-v4:$android_version"
implementation 'androidx.vectordrawable:vectordrawable:1.2.0-alpha02'
implementation "androidx.browser:browser:1.3.0"
implementation "androidx.cardview:cardview:$android_version"
implementation 'androidx.constraintlayout:constraintlayout:2.1.0-alpha2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'org.jsoup:jsoup:1.13.1'
//multidex
@ -120,13 +120,13 @@ dependencies {
}
// Async
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
// Retrofit + http logging + okhttp
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.burgstaller:okhttp-digest:1.12'
implementation 'com.burgstaller:okhttp-digest:2.5'
// Material-ish things
implementation 'com.ashokvarma.android:bottom-navigation-bar:2.1.0'
@ -151,14 +151,13 @@ dependencies {
//PhotoView
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
implementation 'androidx.core:core-ktx:1.5.0-alpha05'
implementation 'androidx.core:core-ktx:1.7.0-beta02'
implementation "androidx.lifecycle:lifecycle-livedata:2.3.0-rc01"
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.0-rc01"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-rc01"
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.0-rc01"
implementation "androidx.room:room-runtime:2.3.0-alpha04"
implementation "androidx.room:room-ktx:2.3.0-alpha04"
kapt "androidx.room:room-compiler:2.3.0-alpha04"
implementation "androidx.room:room-ktx:2.4.0-alpha05"
kapt "androidx.room:room-compiler:2.4.0-alpha05"
implementation "android.arch.work:work-runtime-ktx:$work_version"
}

View File

@ -15,7 +15,8 @@
android:theme="@style/NoBar">
<activity
android:name=".MainActivity"
android:theme="@style/SplashTheme">
android:theme="@style/SplashTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -48,7 +49,8 @@
</activity>
<activity
android:name=".AddSourceActivity"
android:parentActivityName=".SourcesActivity">
android:parentActivityName=".SourcesActivity"
android:exported="true">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SourcesActivity" />

View File

@ -14,6 +14,8 @@ import com.burgstaller.okhttp.digest.Credentials
import com.burgstaller.okhttp.digest.DigestAuthenticator
import com.google.gson.GsonBuilder
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.ResponseBody.Companion.toResponseBody
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Call
import retrofit2.Retrofit
@ -68,7 +70,7 @@ class SelfossApi(
val request: Request = chain.request()
val response: Response = chain.proceed(request)
if (response.code() == 408) {
if (response.code == 408) {
return response
}
return response
@ -103,7 +105,7 @@ class SelfossApi(
httpClient
.addInterceptor { chain ->
val res = chain.proceed(chain.request())
if (res.code() == timeoutCode) {
if (res.code == timeoutCode) {
throw SocketTimeoutException("timeout")
}
res
@ -117,7 +119,7 @@ class SelfossApi(
Response.Builder()
.code(timeoutCode)
.protocol(Protocol.HTTP_2)
.body(ResponseBody.create(MediaType.parse("text/plain"), ""))
.body("".toResponseBody("text/plain".toMediaTypeOrNull()))
.message("")
.request(request)
.build()

View File

@ -20,6 +20,7 @@ import apps.amine.bou.readerforselfoss.ReaderActivity
import apps.amine.bou.readerforselfoss.api.selfoss.Item
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
fun Context.buildCustomTabsIntent(): CustomTabsIntent {
@ -138,13 +139,13 @@ private fun openInBrowser(linkDecoded: String, app: Activity) {
}
fun String.isUrlValid(): Boolean =
HttpUrl.parse(this) != null && Patterns.WEB_URL.matcher(this).matches()
this.toHttpUrlOrNull() != null && Patterns.WEB_URL.matcher(this).matches()
fun String.isBaseUrlValid(ctx: Context): Boolean {
val baseUrl = HttpUrl.parse(this)
val baseUrl = this.toHttpUrlOrNull()
var existsAndEndsWithSlash = false
if (baseUrl != null) {
val pathSegments = baseUrl.pathSegments()
val pathSegments = baseUrl.pathSegments
existsAndEndsWithSlash = "" == pathSegments[pathSegments.size - 1]
}

View File

@ -2,7 +2,7 @@
buildscript {
ext {
kotlin_version = '1.4.21'
kotlin_version = '1.5.31'
android_version = '1.0.0'
androidx_version = '1.1.0-alpha05'
lifecycle_version = '2.2.0-alpha01'
@ -17,7 +17,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@ -37,14 +37,4 @@ task clean(type: Delete) {
delete rootProject.buildDir
}
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin" == plugin.class.name) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin" == plugin.class.name) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
project.ext.preDexLibs = !project.hasProperty('disablePreDex')

View File

@ -16,6 +16,5 @@ org.gradle.jvmargs=-Xmx1536m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.caching=true
android.enableD8=true
android.useAndroidX=true
android.enableJetifier=true

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip