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:
@@ -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" />
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user