Commit 1a151e6b authored by Christophe Henry's avatar Christophe Henry

Bump dependencies

parent a5116ae5
Pipeline #4768 passed with stage
in 0 seconds
......@@ -4,6 +4,7 @@
* Add possibility to enable a debug mode ([!108](https://git.feneas.org/christophehenry/freshrss-android/-/merge_requests/108))
* Add possibility to send a report of failed refreshed when debug mode is enabled ([!108](https://git.feneas.org/christophehenry/freshrss-android/-/merge_requests/108))
* Update dependencies ([!117](https://git.feneas.org/christophehenry/freshrss-android/-/merge_requests/117))
## Bug fixes
......
......@@ -13,9 +13,9 @@ pipeline {
environment {
MIN_SDK_VERSION = 23
MAX_SDK_VERSION = 28
MAX_SDK_VERSION = 30
MIN_SDK_IMAGE = "system-images;android-$MIN_SDK_VERSION;default;x86_64".toString()
MAX_SDK_IMAGE = "system-images;android-$MAX_SDK_VERSION;default;x86_64".toString()
MAX_SDK_IMAGE = "system-images;android-$MAX_SDK_VERSION;google_apis;x86_64".toString()
ANDROID_HOME = "/opt/android-sdk-linux"
SIGN_KEY_PATH = "/home/android/freshrss_signkey.jks"
SIGN_KEY_CREDENTIALS = credentials "freshrss-signkey"
......@@ -135,7 +135,7 @@ pipeline {
script {
docker.image(dockerImage).inside("-u root") { sh "find . -user root -name '*' | xargs chmod 777" }
}
deleteDir()
cleanWs()
}
}
}
......
......@@ -8,11 +8,11 @@ apply plugin: "com.diffplug.gradle.spotless"
android {
def schema_location = "$projectDir/src/main/java/fr/chenry/android/freshrss/store/database/migrations".toString()
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "fr.chenry.android.freshrss"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 15
versionName "1.3.2"
testInstrumentationRunner "fr.chenry.android.freshrss.utils.FreshRSSTestRunner"
......@@ -104,22 +104,22 @@ spotless {
}
dependencies {
def appcompat_version = "1.1.0"
def appcompat_version = "1.2.0"
def activity_version = "1.1.0"
def fragment_version = "1.2.4"
def fragment_version = "1.2.5"
def lifecycle_version = "2.2.0"
def room_version = "2.2.5"
def roomigrant_version = "0.1.7"
def jackson_version = "2.11.0"
def espresso_version = "3.2.0"
def espresso_idling_version = "3.2.0"
def roomigrant_version = "0.2.6"
def jackson_version = "2.11.2"
def espresso_version = "3.3.0"
def espresso_idling_version = "3.3.0"
def jsoup_version = "1.13.1"
def acraVersion = "5.5.1"
def acraVersion = "5.7.0"
def autoservice_version = "1.0-rc7"
def android_test = "1.2.0"
def android_test = "1.3.0"
def retrofit_version = "2.9.0"
def okhttp_version = "4.7.2"
def work_version = "2.3.4"
def okhttp_version = "4.9.0"
def work_version = "2.4.0"
def mockk_version = "1.10.0"
def hamcrest_version = "2.2"
......@@ -133,15 +133,15 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// AndroidX
implementation "androidx.core:core-ktx:1.3.0"
implementation "androidx.core:core-ktx:1.3.1"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
implementation "androidx.activity:activity-ktx:$activity_version"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.constraintlayout:constraintlayout:2.0.1"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "com.google.android.material:material:1.3.0-alpha01"
implementation "com.google.android.material:material:1.3.0-alpha02"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
......@@ -160,8 +160,8 @@ dependencies {
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "com.github.MatrixDev.Roomigrant:RoomigrantLib:$roomigrant_version"
kapt "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:$roomigrant_version"
implementation "com.github.RBusarow.Roomigrant:RoomigrantLib:$roomigrant_version"
kapt "com.github.RBusarow.Roomigrant:RoomigrantCompiler:$roomigrant_version"
// HTTP and promises
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version"
......@@ -177,7 +177,7 @@ dependencies {
// Utils
implementation "org.apache.commons:commons-text:1.8"
implementation "org.apache.commons:commons-text:1.9"
implementation "joda-time:joda-time:2.10.6"
implementation "com.squareup.picasso:picasso:2.71828"
implementation "com.x5dev:chunk-templates:3.5.0"
......@@ -220,7 +220,7 @@ dependencies {
debugImplementation "androidx.test:rules:$android_test"
debugImplementation "androidx.test:runner:$android_test"
androidTestImplementation "androidx.test.ext:junit:1.1.1"
androidTestImplementation "androidx.test.ext:junit:1.1.2"
androidTestImplementation "io.mockk:mockk-android:$mockk_version"
......
......@@ -76,7 +76,7 @@ open class FreshRSSApplication: Application(), SharedPreferences.OnSharedPrefere
//Stetho.initializeWithDefaults(this)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
/* TODO: test changing the refresh frequency updates the refresh job
Mais là, la flemme et de toutes façons, faut release */
if(key == preferences.refreshFrequencyKey) GlobalScope.launch {
......
......@@ -2,7 +2,6 @@ package fr.chenry.android.freshrss.activities
import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.content.res.AssetManager
import android.os.Bundle
import android.view.MenuItem
import android.view.SubMenu
......@@ -10,10 +9,10 @@ import android.widget.TextView
import androidx.activity.viewModels
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.text.HtmlCompat
import androidx.core.view.size
import androidx.drawerlayout.widget.DrawerLayout
import androidx.lifecycle.observe
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.*
......@@ -36,7 +35,7 @@ class MainActivity: AppCompatActivity(), OnSharedPreferenceChangeListener {
navHost.navController
}
private val drawerLayout: DrawerLayout by lazy {
private val drawerLayout by lazy {
findViewById<DrawerLayout>(R.id.activity_main_navigation_drawer)
}
......@@ -70,10 +69,6 @@ class MainActivity: AppCompatActivity(), OnSharedPreferenceChangeListener {
requireF().ensurePeriodicRequest()
}
// TODO: Remove this function when androidx.appcompat:appcompat:1.2.0 is released
// See https://stackoverflow.com/a/59961940
override fun getAssets(): AssetManager = resources.assets
fun onAddSubscriptionClick(@Suppress("UNUSED_PARAMETER") item: MenuItem) {
drawerLayout.closeDrawers()
AddSubscriptionDialog(::okCallback).show(supportFragmentManager, AddSubscriptionDialog::class.simpleName)
......@@ -82,8 +77,8 @@ class MainActivity: AppCompatActivity(), OnSharedPreferenceChangeListener {
fun onSettingsItemClick(@Suppress("UNUSED_PARAMETER") item: MenuItem) =
navigation.navigate(MainSubscriptionFragmentDirections.actionGlobalSettingsFragment())
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if(item?.itemId == android.R.id.home && navigation.isTopLevelDestination()) {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if(item.itemId == android.R.id.home && navigation.isTopLevelDestination()) {
if(isDrawerOpen()) drawerLayout.closeDrawers()
else drawerLayout.openDrawer(application_left_menu)
......@@ -99,7 +94,7 @@ class MainActivity: AppCompatActivity(), OnSharedPreferenceChangeListener {
override fun onSupportNavigateUp(): Boolean =
navigation.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
if(key != requireF().preferences.debugModeKey) return
enableDebugSection()
}
......@@ -110,7 +105,7 @@ class MainActivity: AppCompatActivity(), OnSharedPreferenceChangeListener {
if(submenu !is SubMenu) return
if(debugMode) submenu.add(0, R.id.debug_info_section_id, submenu.size, R.string.debug_infos).apply {
icon = getDrawable(R.drawable.ic_build_black_24dp)
icon = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_build_black_24dp)
setOnMenuItemClickListener {
drawerLayout.closeDrawers()
DebugAlertDialog().show(supportFragmentManager, DebugAlertDialog::class.simpleName)
......
......@@ -6,8 +6,6 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ObservableField
import androidx.lifecycle.Observer
import androidx.lifecycle.observe
import fr.chenry.android.freshrss.R
import fr.chenry.android.freshrss.databinding.ActivityStartBinding
import fr.chenry.android.freshrss.store.database.models.Account
......
......@@ -5,7 +5,6 @@ import android.os.Bundle
import android.view.*
import androidx.databinding.ObservableBoolean
import androidx.fragment.app.*
import androidx.lifecycle.*
import androidx.viewpager.widget.ViewPager
import com.google.android.material.bottomnavigation.BottomNavigationView
import fr.chenry.android.freshrss.*
......@@ -17,6 +16,7 @@ import fr.chenry.android.freshrss.utils.*
import kotlinx.android.synthetic.main.fragment_main_subscription.*
class MainSubscriptionFragment: Fragment(), SharedPreferences.OnSharedPreferenceChangeListener {
private val viewModel by activityViewModels<AccountVM>()
private val subscriptionSectionVM by activityViewModels<SubscriptionSectionVM>()
private val autoFetchDisabled = ObservableBoolean(true)
......@@ -37,7 +37,6 @@ class MainSubscriptionFragment: Fragment(), SharedPreferences.OnSharedPreference
autoFetchDisabled = this@MainSubscriptionFragment.autoFetchDisabled
}
val bottomNav = view.findViewById<BottomNavigationView>(R.id.subcription_bottom_navigation)
val viewPager = view.findViewById<ViewPager>(R.id.subcription_viewpager)
......@@ -73,14 +72,15 @@ class MainSubscriptionFragment: Fragment(), SharedPreferences.OnSharedPreference
requireF().preferences.unregisterChangeListener(this)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
if(key == requireF().preferences.refreshFrequencyKey)
autoFetchDisabled.set(requireF().preferences.refreshFrequency == 0L)
}
inner class MainSubscriptionPagerAdapter:
FragmentPagerAdapter(childFragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
inner class MainSubscriptionPagerAdapter: FragmentPagerAdapter(
childFragmentManager,
BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
) {
override fun getCount(): Int = SubscriptionSection.values().size
......@@ -94,6 +94,7 @@ class MainSubscriptionFragment: Fragment(), SharedPreferences.OnSharedPreference
}
inner class PageChangeCallback: ViewPager.SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) = SubscriptionSection.byPosition(position).let {
if(subcription_bottom_navigation.selectedItemId != it.navigationButtonId) {
subscriptionSectionVM.section.postValue(it)
......@@ -103,6 +104,7 @@ class MainSubscriptionFragment: Fragment(), SharedPreferences.OnSharedPreference
}
inner class BottomNavigationChangeCallback: BottomNavigationView.OnNavigationItemSelectedListener {
override fun onNavigationItemSelected(item: MenuItem): Boolean {
val next = SubscriptionSection.fromNavigationButton(item.itemId).ordinal
if(subcription_viewpager.currentItem != next) subcription_viewpager.currentItem = next
......
......@@ -4,7 +4,8 @@ import android.os.Bundle
import android.view.*
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.*
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.LinearLayoutManager
......
package fr.chenry.android.freshrss.components.subscriptions.adapters
import android.view.View
import androidx.lifecycle.observe
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.FlexibleAdapter.OnItemClickListener
import eu.davidea.flexibleadapter.items.IFlexible
......
......@@ -31,6 +31,7 @@ data class ContentItem(
val categories: List<String>,
val origin: ContentItemOrigin,
val summary: Summary,
@JsonDeserialize(using = HtmlEntitiesDeserializer::class)
val author: String = ""
)
......
......@@ -64,12 +64,12 @@ class FeedCategoriesDeserializer: JsonDeserializer<List<String>>() {
object TagsConverter: Converter<ResponseBody, List<FeedTagItem>> {
override fun convert(value: ResponseBody): List<FeedTagItem> = kotlin.runCatching {
value.use {
val jsonArray = JSONObject(value.string()).optJSONArray("tags")
(0 until jsonArray.length()).mapNotNull {
val result = JACKSON_OBJECT_MAPPER.readValue<FeedTagItem>(jsonArray.optJSONObject(it).toString())
if(result.type == null) null else result
}
JSONObject(value.string()).optJSONArray("tags")?.let {jsonArray ->
(0 until (jsonArray.length() ?: 0)).mapNotNull {
val result = JACKSON_OBJECT_MAPPER.readValue<FeedTagItem>(jsonArray.optJSONObject(it).toString())
if(result.type == null) null else result
}
} ?: listOf()
}
}.onFailure(this::e).getOrDefault(listOf())
}
......@@ -78,7 +78,7 @@ object SubscriptionApiItemsConverter: Converter<ResponseBody, List<SubscriptionA
override fun convert(value: ResponseBody): List<SubscriptionApiItem> = runCatching {
value.use {
val jsonArray = JSONObject(value.string()).optJSONArray("subscriptions")
JACKSON_OBJECT_MAPPER.readValue<List<SubscriptionApiItem>>(jsonArray.toString())
JACKSON_OBJECT_MAPPER.readValue<List<SubscriptionApiItem>>(jsonArray?.toString() ?: "[]")
}
}.onFailure(this::e).getOrDefault(listOf())
}
......@@ -94,7 +94,7 @@ object UnreadItemIdsConverter: Converter<ResponseBody, List<String>> {
// Ids returned by this endpoint are in long form.
// They must be converted in hex (short form) before being used.
// See https://feedhq.readthedocs.io/en/latest/api/terminology.html#items
"${Article.ARTICLE_ID_PREFIX}${id!!.toLong().toString(16).padStart(id.length, '0')}"
"${Article.ARTICLE_ID_PREFIX}${id.toLong().toString(16).padStart(id.length, '0')}"
}.onFailure(this::e).getOrNull()
}
} ?: listOf()
......
......@@ -17,8 +17,7 @@ class ArticleVM(application: Application, articleId: String): AndroidViewModel(a
init {
liveData.observeForever {
(feedTitle as MutableLiveData).value =
requireF().db.getSubcriptionTitleById(it.streamId).blockingFirst()
(feedTitle as MutableLiveData).value = requireF().db.getSubcriptionTitleById(it.streamId).blockingFirst()
}
}
}
......
......@@ -12,7 +12,6 @@ import androidx.core.text.bold
import androidx.core.text.toSpanned
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.observe
import androidx.recyclerview.widget.*
import androidx.work.Data
import androidx.work.WorkInfo
......
......@@ -9,33 +9,24 @@ import androidx.annotation.DrawableRes
import androidx.appcompat.widget.AppCompatImageView
import fr.chenry.android.freshrss.R
class EmotionnalImageSubtext: LinearLayout {
class EmotionnalImageSubtext @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0,
defStyleRes: Int = 0
): LinearLayout(context, attrs, defStyle, defStyleRes) {
var text: CharSequence?
get() = if(::textView.isInitialized) textView.text else ""
get() = textView.text
set(value) {
if(::textView.isInitialized && text != null) textView.text = value
textView.text = value
}
private lateinit var imageView: AppCompatImageView
private lateinit var textView: TextView
constructor(context: Context): super(context) {
init()
}
constructor(context: Context, attrs: AttributeSet): super(context, attrs) {
init(attrs, 0)
}
private var imageView: AppCompatImageView
private var textView: TextView
constructor(context: Context, attrs: AttributeSet, defStyle: Int): super(context, attrs, defStyle) {
init(attrs, defStyle)
}
fun setImageResource(@DrawableRes resId: Int) = imageView.setImageResource(resId)
private fun init(attrs: AttributeSet? = null, defStyle: Int = 0) {
val a =
context.obtainStyledAttributes(attrs, R.styleable.EmotionnalImageSubtext, defStyle, 0)
init {
val a = context.obtainStyledAttributes(attrs, R.styleable.EmotionnalImageSubtext, defStyle, 0)
val text = a.getString(R.styleable.EmotionnalImageSubtext_text)
val src = a.getDrawable(R.styleable.EmotionnalImageSubtext_src)
a.recycle()
......@@ -52,4 +43,6 @@ class EmotionnalImageSubtext: LinearLayout {
textView.visibility = if(text.isNullOrBlank()) View.GONE else View.VISIBLE
textView.text = text
}
fun setImageResource(@DrawableRes resId: Int) = imageView.setImageResource(resId)
}
......@@ -3,10 +3,8 @@
package fr.chenry.android.freshrss.utils
import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.net.ConnectivityManager
import android.net.Uri
import android.net.*
import android.os.Build
import android.util.Log
import androidx.fragment.app.Fragment
......@@ -62,8 +60,23 @@ fun String?.extractURLs(): List<Uri> = if(this.isNullOrBlank()) listOf() else {
fun <T: Any> T?.whenNull(body: () -> Unit) = this ?: body().let {this}
fun Context.isConnectedToNetwork(): Boolean {
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
return connectivityManager?.activeNetworkInfo?.isConnected ?: false
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as? ConnectivityManager
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val nw = connectivityManager?.activeNetwork ?: return false
val actNw = connectivityManager.getNetworkCapabilities(nw) ?: return false
return when {
actNw.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true
actNw.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true
actNw.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> true
actNw.hasTransport(NetworkCapabilities.TRANSPORT_BLUETOOTH) -> true
else -> false
}
} else {
@Suppress("DEPRECATION")
val nwInfo = connectivityManager?.activeNetworkInfo ?: return false
@Suppress("DEPRECATION")
return nwInfo.isConnected
}
}
fun URL.queryParameters(): Map<String, String> = this.query
......
......@@ -11,8 +11,6 @@ import androidx.fragment.app.DialogFragment
import fr.chenry.android.freshrss.R
class SimpleTextDialog(private val text: Spanned): DialogFragment() {
constructor(text: String): this(SpannableString(text))
private val dialogView by lazy {
requireActivity().layoutInflater.inflate(
R.layout.simple_text_dialog,
......
......@@ -7,15 +7,12 @@ import androidx.appcompat.widget.AppCompatImageView
import kotlin.math.max
import kotlin.math.min
class SquaredImageView
@JvmOverloads
constructor(
class SquaredImageView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
): AppCompatImageView(context, attrs, defStyleAttr) {
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
......
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.3.72"
ext.android_navigation = "2.2.2"
ext.kotlin_version = "1.4.10"
ext.android_navigation = "2.3.0"
repositories {
google()
......@@ -11,7 +11,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath "com.android.tools.build:gradle:4.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$android_navigation"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment