Use /sources/stats in the home #133

Merged
AmineB merged 9 commits from davidoskky/ReaderForSelfoss-multiplatform:sources into master 2023-03-13 16:26:57 +00:00
4 changed files with 6 additions and 6 deletions
Showing only changes of commit 97793a7fc8 - Show all commits

View File

@ -55,7 +55,7 @@ class SourcesActivity : AppCompatActivity(), DIAware {
binding.recyclerView.layoutManager = mLayoutManager
CoroutineScope(Dispatchers.Main).launch {
val response = repository.getSources()
val response = repository.getSourcesDetails()
AmineB marked this conversation as resolved
Review

Why would the SourcesActivity use the "public" route, instead of the actual one ?

Why would the SourcesActivity use the "public" route, instead of the actual one ?
Review

I just changed the names of the methods it's the same endpoint.
I changed the names to make them more descriptive: getSourcesStats for /sources/stats and getSourcesDetails for /sources/details

I just changed the names of the methods it's the same endpoint. I changed the names to make them more descriptive: getSourcesStats for /sources/stats and getSourcesDetails for /sources/details
if (response.isNotEmpty()) {
items = response
val mAdapter = SourcesListAdapter(

View File

@ -68,7 +68,7 @@ class UpsertSourceActivity : AppCompatActivity(), DIAware {
private fun initFields(items: Map<String, SelfossModel.Spout>) {
binding.nameInput.setText(existingSource!!.title)
binding.tags.setText(existingSource!!.tags.joinToString(", "))
binding.tags.setText(existingSource!!.tags?.joinToString(", "))
binding.sourceUri.setText(existingSource!!.params?.url)
binding.spoutsSpinner.setSelection(items.keys.indexOf(existingSource!!.spout))
binding.progress.visibility = View.GONE

View File

@ -61,7 +61,7 @@ class SourcesListAdapter(
c.circularBitmapDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
}
if (itm.error.isNotBlank()) {
if (itm.error.isNullOrBlank()) {
AmineB marked this conversation as resolved Outdated

This does not make sens. If the error is null or blank, the error text should not be displayed.

This does not make sens. If the error is null or blank, the error text should not be displayed.
binding.errorText.visibility = View.VISIBLE
binding.errorText.text = itm.error
} else {

View File

@ -84,7 +84,7 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
) {
val sourceGroup = binding.sourcesGroup
repository.getSources().forEach { source ->
repository.getSourcesStats().forEach { source ->
val c = Chip(context)
c.ellipsize = TextUtils.TruncateAt.END
@ -141,9 +141,9 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
selectedChip = c
}
c.isEnabled = source.error.isBlank()
c.isEnabled = source.error.isNullOrBlank()
if (source.error.isNotBlank() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!source.error.isNullOrBlank() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
c.tooltipText = source.error
}