diff --git a/.gitea/workflows/common_build.yml b/.gitea/workflows/common_build.yml index 0744cb2..ec41fe1 100644 --- a/.gitea/workflows/common_build.yml +++ b/.gitea/workflows/common_build.yml @@ -3,7 +3,7 @@ on: workflow_call: jobs: - BuildAndTest: + BuildAndTestAndCoverage: runs-on: ubuntu-latest steps: - name: Check out repository code @@ -16,9 +16,30 @@ jobs: with: distribution: 'temurin' java-version: '17' - - name: Setup Android SDK - uses: android-actions/setup-android@v3 + cache: gradle + - uses: gradle/actions/setup-gradle@v3 + - uses: android-actions/setup-android@v3 - name: Configure gradle... run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true" >> ~/.gradle/gradle.properties - name: Build and test - run: ./gradlew build -x test --stacktrace \ No newline at end of file + run: ./gradlew build -x testReleaseUnitTest -x testDebugUnitTest -x testGithubConfigReleaseUnitTest -x testGithubConfigDebugUnitTest # These tests will be done + - uses: KengoTODA/actions-setup-docker-compose@v1 + with: + version: "2.23.3" + - name: run selfoss + run: | + docker compose -f .gitea/workflows/assets/docker-compose.yml up -d + - name: coverage + run: | + ./gradlew :koverHtmlReport + - uses: actions/upload-artifact@v3 + with: + name: coverage + path: build/reports/kover/html + retention-days: 1 + overwrite: true + include-hidden-files: true + - name: Clean + if: always() + run: | + docker compose -f .gitea/workflows/assets/docker-compose.yml stop \ No newline at end of file diff --git a/.gitea/workflows/on_merge_on_release.yml b/.gitea/workflows/on_merge_on_release.yml index 4c4241f..800fc03 100644 --- a/.gitea/workflows/on_merge_on_release.yml +++ b/.gitea/workflows/on_merge_on_release.yml @@ -85,6 +85,7 @@ jobs: with: distribution: 'temurin' java-version: '17' + cache: gradle - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: Configure gradle... diff --git a/.gitea/workflows/on_pr.yml b/.gitea/workflows/on_pr.yml index 81aa997..d49e140 100644 --- a/.gitea/workflows/on_pr.yml +++ b/.gitea/workflows/on_pr.yml @@ -12,8 +12,9 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - distribution: 'temurin' # See 'Supported distributions' for available options + distribution: 'temurin' java-version: '17' + cache: gradle - name: Install klint run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.0.0/ktlint && chmod a+x ktlint && mv ktlint /usr/local/bin/ - name: Install detekt diff --git a/.gitea/workflows/on_push_coverage.yml b/.gitea/workflows/on_push_coverage.yml deleted file mode 100644 index aa326e6..0000000 --- a/.gitea/workflows/on_push_coverage.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Check master code -on: - push: - branches: - - master - -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch tags - run: git fetch --tags -p - - uses: KengoTODA/actions-setup-docker-compose@v1 - with: - version: "2.23.3" - - name: run selfoss - run: | - docker compose -f .gitea/workflows/assets/docker-compose.yml up -d - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - cache: gradle - - uses: gradle/actions/setup-gradle@v3 - - uses: android-actions/setup-android@v3 - - name: Configure gradle... - run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true" >> ~/.gradle/gradle.properties - - name: coverage - run: | - ./gradlew :koverHtmlReport - - uses: actions/upload-artifact@v3 - with: - name: coverage - path: build/reports/kover/html - retention-days: 1 - overwrite: true - include-hidden-files: true - - name: Clean - if: always() - run: | - docker compose -f .gitea/workflows/assets/docker-compose.yml stop \ No newline at end of file diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index dc12389..49bc9b3 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -203,7 +203,7 @@ dependencies { implementation("ch.acra:acra-http:$acraVersion") implementation("ch.acra:acra-toast:$acraVersion") - + implementation("com.google.auto.service:auto-service:1.1.1") } tasks.withType { diff --git a/androidApp/src/androidTest/kotlin/bou/amine/apps/readerforselfossv2/android/LoginActivityTest.kt b/androidApp/src/androidTest/kotlin/bou/amine/apps/readerforselfossv2/android/LoginActivityTest.kt index 06c554d..43d8343 100644 --- a/androidApp/src/androidTest/kotlin/bou/amine/apps/readerforselfossv2/android/LoginActivityTest.kt +++ b/androidApp/src/androidTest/kotlin/bou/amine/apps/readerforselfossv2/android/LoginActivityTest.kt @@ -62,7 +62,7 @@ class LoginActivityTest { @Test fun urlError() { - performLogin("172.17.0.1:8888") + performLogin("10.0.2.2:8888") onView(withId(R.id.urlView)).perform(click()) onView(withId(R.id.urlView)).check(matches(withError(R.string.wrong_infos))) } diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/HomeActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/HomeActivity.kt index 5b63a33..84a85e8 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/HomeActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/HomeActivity.kt @@ -1,7 +1,6 @@ package bou.amine.apps.readerforselfossv2.android import android.content.Intent -import android.net.Uri import android.os.Bundle import android.view.Menu import android.view.MenuItem @@ -32,6 +31,7 @@ import bou.amine.apps.readerforselfossv2.android.settings.SettingsActivity import bou.amine.apps.readerforselfossv2.android.testing.CountingIdlingResourceSingleton import bou.amine.apps.readerforselfossv2.android.utils.bottombar.maybeShow import bou.amine.apps.readerforselfossv2.android.utils.bottombar.removeBadge +import bou.amine.apps.readerforselfossv2.android.utils.openUrlInBrowser import bou.amine.apps.readerforselfossv2.model.SelfossModel import bou.amine.apps.readerforselfossv2.repository.Repository import bou.amine.apps.readerforselfossv2.service.AppSettingsService @@ -589,9 +589,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.issue_tracker -> { - val browserIntent = - Intent(Intent.ACTION_VIEW, Uri.parse(AppSettingsService.trackerUrl)) - startActivity(browserIntent) + baseContext.openUrlInBrowser(AppSettingsService.trackerUrl) return true } diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemCardAdapter.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemCardAdapter.kt index 2175fd7..3f2de89 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemCardAdapter.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemCardAdapter.kt @@ -8,11 +8,11 @@ import android.widget.ImageView.ScaleType import androidx.recyclerview.widget.RecyclerView import bou.amine.apps.readerforselfossv2.android.R import bou.amine.apps.readerforselfossv2.android.databinding.CardItemBinding -import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.android.utils.LinkOnTouchListener +import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.android.utils.glide.bitmapCenterCrop import bou.amine.apps.readerforselfossv2.android.utils.glide.circularDrawable -import bou.amine.apps.readerforselfossv2.android.utils.openInBrowserAsNewTask +import bou.amine.apps.readerforselfossv2.android.utils.openItemUrlInBrowserAsNewTask import bou.amine.apps.readerforselfossv2.android.utils.shareLink import bou.amine.apps.readerforselfossv2.model.SelfossModel import bou.amine.apps.readerforselfossv2.repository.Repository @@ -71,7 +71,7 @@ class ItemCardAdapter( } binding.browserBtn.setOnClickListener { - c.openInBrowserAsNewTask(items[position]) + c.openItemUrlInBrowserAsNewTask(items[position]) } } @@ -126,4 +126,4 @@ class ItemCardAdapter( } inner class ViewHolder(val binding: CardItemBinding) : RecyclerView.ViewHolder(binding.root) -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemListAdapter.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemListAdapter.kt index ac43bd6..f6a48b5 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemListAdapter.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemListAdapter.kt @@ -6,8 +6,8 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import bou.amine.apps.readerforselfossv2.android.R import bou.amine.apps.readerforselfossv2.android.databinding.ListItemBinding -import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.android.utils.LinkOnTouchListener +import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.android.utils.glide.circularDrawable import bou.amine.apps.readerforselfossv2.model.SelfossModel import bou.amine.apps.readerforselfossv2.repository.Repository @@ -73,4 +73,4 @@ class ItemListAdapter( } inner class ViewHolder(val binding: ListItemBinding) : RecyclerView.ViewHolder(binding.root) -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt index 4f052e6..84226de 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/ArticleFragment.kt @@ -1,16 +1,20 @@ package bou.amine.apps.readerforselfossv2.android.fragments -import android.content.ActivityNotFoundException import android.content.Intent import android.content.res.ColorStateList import android.content.res.TypedArray import android.graphics.Bitmap import android.graphics.Typeface import android.graphics.drawable.ColorDrawable -import android.net.Uri import android.os.Bundle import android.util.TypedValue -import android.view.* +import android.view.GestureDetector +import android.view.InflateException +import android.view.LayoutInflater +import android.view.MenuItem +import android.view.MotionEvent +import android.view.View +import android.view.ViewGroup import android.webkit.WebResourceResponse import android.webkit.WebSettings import android.webkit.WebView @@ -25,10 +29,11 @@ import bou.amine.apps.readerforselfossv2.android.databinding.FragmentArticleBind import bou.amine.apps.readerforselfossv2.android.model.ParecelableItem import bou.amine.apps.readerforselfossv2.android.model.toModel import bou.amine.apps.readerforselfossv2.android.model.toParcelable -import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName +import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.android.utils.glide.getBitmapInputStream import bou.amine.apps.readerforselfossv2.android.utils.isUrlValid -import bou.amine.apps.readerforselfossv2.android.utils.openInBrowserAsNewTask +import bou.amine.apps.readerforselfossv2.android.utils.openItemUrlInBrowserAsNewTask +import bou.amine.apps.readerforselfossv2.android.utils.openUrlInBrowser import bou.amine.apps.readerforselfossv2.android.utils.shareLink import bou.amine.apps.readerforselfossv2.model.MercuryModel import bou.amine.apps.readerforselfossv2.model.SelfossModel @@ -47,13 +52,14 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import org.acra.ktx.sendSilentlyWithAcra import org.kodein.di.DI import org.kodein.di.DIAware import org.kodein.di.android.x.closestDI import org.kodein.di.instance import java.net.MalformedURLException import java.net.URL -import java.util.* +import java.util.Locale import java.util.concurrent.ExecutionException private const val IMAGE_JPG = "image/jpg" @@ -98,7 +104,12 @@ class ArticleFragment : Fragment(), DIAware { try { binding = FragmentArticleBinding.inflate(inflater, container, false) - url = item.getLinkDecoded() + try { + url = item.getLinkDecoded() + } catch (e: Exception) { + e.sendSilentlyWithAcra() + } + contentText = item.content contentTitle = item.title.getHtmlDecoded() contentImage = item.getThumbnail(repository.baseUrl) @@ -152,7 +163,7 @@ class ArticleFragment : Fragment(), DIAware { ) } catch (e: InflateException) { e.sendSilentlyWithAcraWithName("webview not available") - if (context != null) { + try { AlertDialog.Builder(requireContext()) .setMessage(requireContext().getString(R.string.webview_dialog_issue_message)) .setTitle(requireContext().getString(R.string.webview_dialog_issue_title)) @@ -164,6 +175,8 @@ class ArticleFragment : Fragment(), DIAware { } .create() .show() + } catch (e: IllegalStateException) { + e.sendSilentlyWithAcraWithName("Context required is null") } } @@ -211,16 +224,16 @@ class ArticleFragment : Fragment(), DIAware { override fun onItemClick(item: MenuItem) { when (item.itemId) { R.id.share_action -> requireActivity().shareLink(url, contentTitle) - R.id.open_action -> requireActivity().openInBrowserAsNewTask(this@ArticleFragment.item) + R.id.open_action -> requireActivity().openItemUrlInBrowserAsNewTask(this@ArticleFragment.item) R.id.unread_action -> - if (context != null) { + try { if (this@ArticleFragment.item.unread) { CoroutineScope(Dispatchers.IO).launch { repository.markAsRead(this@ArticleFragment.item) } this@ArticleFragment.item.unread = false Toast.makeText( - context, + requireContext(), R.string.marked_as_read, Toast.LENGTH_LONG, ).show() @@ -235,7 +248,10 @@ class ArticleFragment : Fragment(), DIAware { Toast.LENGTH_LONG, ).show() } + } catch (e: IllegalStateException) { + e.sendSilentlyWithAcraWithName("Context required is null") } + else -> Unit } } @@ -288,7 +304,7 @@ class ArticleFragment : Fragment(), DIAware { contentText = data.content.orEmpty() htmlToWebview() - handleLeadImage(data?.lead_image_url) + handleLeadImage(data.lead_image_url) binding.nestedScrollView.scrollTo(0, 0) binding.progressBar.visibility = View.GONE @@ -320,11 +336,7 @@ class ArticleFragment : Fragment(), DIAware { url: String, ): Boolean { return if (context != null && url.isUrlValid() && binding.webcontent.hitTestResult.type != WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) { - try { - requireContext().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) - } catch (e: ActivityNotFoundException) { - e.sendSilentlyWithAcraWithName("activityNotFound > $url") - } + requireContext().openUrlInBrowser(url) true } else { false @@ -343,7 +355,8 @@ class ArticleFragment : Fragment(), DIAware { ) { try { val image = - Glide.with(view).asBitmap().apply(glideOptions).load(url).submit().get() + Glide.with(view).asBitmap().apply(glideOptions).load(url).submit() + .get() return WebResourceResponse( IMAGE_JPG, "UTF-8", @@ -355,7 +368,8 @@ class ArticleFragment : Fragment(), DIAware { } else if (url.lowercase(Locale.US).contains(".png")) { try { val image = - Glide.with(view).asBitmap().apply(glideOptions).load(url).submit().get() + Glide.with(view).asBitmap().apply(glideOptions).load(url).submit() + .get() return WebResourceResponse( IMAGE_JPG, "UTF-8", @@ -367,7 +381,8 @@ class ArticleFragment : Fragment(), DIAware { } else if (url.lowercase(Locale.US).contains(".webp")) { try { val image = - Glide.with(view).asBitmap().apply(glideOptions).load(url).submit().get() + Glide.with(view).asBitmap().apply(glideOptions).load(url).submit() + .get() return WebResourceResponse( IMAGE_JPG, "UTF-8", @@ -384,7 +399,7 @@ class ArticleFragment : Fragment(), DIAware { } private fun htmlToWebview() { - if (context != null) { + try { val attrs: IntArray = intArrayOf(android.R.attr.fontFamily) val a: TypedArray = requireContext().obtainStyledAttributes(resId, attrs) @@ -529,6 +544,8 @@ class ArticleFragment : Fragment(), DIAware { "utf-8", null, ) + } catch (e: IllegalStateException) { + e.sendSilentlyWithAcraWithName("Context required is null") } } @@ -544,10 +561,10 @@ class ArticleFragment : Fragment(), DIAware { private fun openInBrowserAfterFailing() { binding.progressBar.visibility = View.GONE - if (context != null) { - requireContext().openInBrowserAsNewTask(this@ArticleFragment.item) - } else { - Exception("openInBrowserAfterFailing context is null").sendSilentlyWithAcraWithName("openInBrowserAfterFailing > $context") + try { + requireContext().openItemUrlInBrowserAsNewTask(this@ArticleFragment.item) + } catch (e: IllegalStateException) { + e.sendSilentlyWithAcraWithName("Context required is null") } } @@ -565,9 +582,9 @@ class ArticleFragment : Fragment(), DIAware { fun performClick(): Boolean { if (allImages != null && ( - binding.webcontent.hitTestResult.type == WebView.HitTestResult.IMAGE_TYPE || - binding.webcontent.hitTestResult.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE - ) + binding.webcontent.hitTestResult.type == WebView.HitTestResult.IMAGE_TYPE || + binding.webcontent.hitTestResult.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE + ) ) { val position: Int = allImages.indexOf(binding.webcontent.hitTestResult.extra) @@ -579,4 +596,4 @@ class ArticleFragment : Fragment(), DIAware { } return false } -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt index cca1876..7af823f 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt @@ -15,7 +15,7 @@ import android.view.ViewGroup import bou.amine.apps.readerforselfossv2.android.HomeActivity import bou.amine.apps.readerforselfossv2.android.R import bou.amine.apps.readerforselfossv2.android.databinding.FilterFragmentBinding -import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName +import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.repository.Repository import bou.amine.apps.readerforselfossv2.utils.getColorHexCode import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded @@ -52,19 +52,17 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware { false, ) - val context: Context? = context - - if (context == null) { - dismiss() - Exception("FilterSheetFragment context is null").sendSilentlyWithAcraWithName("FilterSheetFragment > onCreateView") - } else { + try { CoroutineScope(Dispatchers.Main).launch { - handleTagChips(context) - handleSourceChips(context) + handleTagChips(requireContext()) + handleSourceChips(requireContext()) binding.progressBar2.visibility = GONE binding.filterView.visibility = VISIBLE } + } catch (e: IllegalStateException) { + dismiss() + e.sendSilentlyWithAcraWithName("FilterSheetFragment > onCreateView") } binding.floatingActionButton2.setOnClickListener { @@ -192,4 +190,4 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware { companion object { const val TAG = "FilterModalBottomSheet" } -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/model/AndroidIModelUtils.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/model/AndroidIModelUtils.kt index 7db8688..2898e9f 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/model/AndroidIModelUtils.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/model/AndroidIModelUtils.kt @@ -2,7 +2,7 @@ package bou.amine.apps.readerforselfossv2.android.model import android.content.Context import android.webkit.URLUtil -import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName +import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcraWithName import bou.amine.apps.readerforselfossv2.model.SelfossModel import bou.amine.apps.readerforselfossv2.utils.getImages import com.bumptech.glide.Glide @@ -40,4 +40,4 @@ fun String.toTextDrawableString(): String { } } return textDrawable.toString() -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/settings/SettingsActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/settings/SettingsActivity.kt index 4f11ab0..0ea06be 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/settings/SettingsActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/settings/SettingsActivity.kt @@ -1,7 +1,5 @@ package bou.amine.apps.readerforselfossv2.android.settings -import android.content.Intent -import android.net.Uri import android.os.Bundle import android.text.Editable import android.text.InputFilter @@ -16,7 +14,8 @@ import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import bou.amine.apps.readerforselfossv2.android.R import bou.amine.apps.readerforselfossv2.android.databinding.ActivitySettingsBinding -import bou.amine.apps.readerforselfossv2.android.sendSilentlyWithAcraWithName +import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcraWithName +import bou.amine.apps.readerforselfossv2.android.utils.openUrlInBrowser import bou.amine.apps.readerforselfossv2.service.AppSettingsService import com.mikepenz.aboutlibraries.LibsBuilder import org.kodein.di.DIAware @@ -105,7 +104,9 @@ class SettingsActivity : preferenceManager.findPreference("currentMode")?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> - AppCompatDelegate.setDefaultNightMode(newValue.toString().toInt()) // ListPreference Only takes string-arrays ¯\_(ツ)_/¯ + AppCompatDelegate.setDefaultNightMode( + newValue.toString().toInt() + ) // ListPreference Only takes string-arrays ¯\_(ツ)_/¯ true } @@ -129,7 +130,8 @@ class SettingsActivity : ) { setPreferencesFromResource(R.xml.pref_general, rootKey) - val editTextPreference = preferenceManager.findPreference("prefer_api_items_number") + val editTextPreference = + preferenceManager.findPreference("prefer_api_items_number") editTextPreference?.setOnBindEditTextListener { editText -> editText.inputType = InputType.TYPE_CLASS_NUMBER editText.filters = @@ -139,8 +141,11 @@ class SettingsActivity : val input: Int = (dest.toString() + source.toString()).toInt() if (input in 1..200) return@InputFilter null } catch (nfe: NumberFormatException) { - nfe.sendSilentlyWithAcraWithName("GeneralPreferenceFragment") - Toast.makeText(activity, R.string.items_number_should_be_number, Toast.LENGTH_LONG).show() + Toast.makeText( + activity, + R.string.items_number_should_be_number, + Toast.LENGTH_LONG + ).show() } "" }, @@ -222,16 +227,17 @@ class SettingsActivity : preferenceManager.findPreference("currentMode")?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> - AppCompatDelegate.setDefaultNightMode(newValue.toString().toInt()) // ListPreference Only takes string-arrays ¯\_(ツ)_/¯ + AppCompatDelegate.setDefaultNightMode( + newValue.toString().toInt() + ) // ListPreference Only takes string-arrays ¯\_(ツ)_/¯ true } } } class LinksPreferenceFragment : PreferenceFragmentCompat() { - private fun openUrl(uri: Uri?) { - val browserIntent = Intent(Intent.ACTION_VIEW, uri) - startActivity(browserIntent) + private fun openUrl(url: String) { + context?.openUrlInBrowser(url) } override fun onCreatePreferences( @@ -242,19 +248,19 @@ class SettingsActivity : preferenceManager.findPreference("trackerLink")?.onPreferenceClickListener = Preference.OnPreferenceClickListener { - openUrl(Uri.parse(AppSettingsService.trackerUrl)) + openUrl(AppSettingsService.trackerUrl) true } preferenceManager.findPreference("sourceLink")?.onPreferenceClickListener = Preference.OnPreferenceClickListener { - openUrl(Uri.parse(AppSettingsService.sourceUrl)) + openUrl(AppSettingsService.sourceUrl) false } preferenceManager.findPreference("translation")?.onPreferenceClickListener = Preference.OnPreferenceClickListener { - openUrl(Uri.parse(AppSettingsService.translationUrl)) + openUrl(AppSettingsService.translationUrl) false } } @@ -268,4 +274,4 @@ class SettingsActivity : setPreferencesFromResource(R.xml.pref_experimental, rootKey) } } -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt index a5e6d2a..ddc4752 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt @@ -1,6 +1,7 @@ package bou.amine.apps.readerforselfossv2.android.utils import android.app.Activity +import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.net.Uri @@ -17,6 +18,7 @@ import bou.amine.apps.readerforselfossv2.model.SelfossModel import bou.amine.apps.readerforselfossv2.utils.toStringUriWithHttp import okhttp3.HttpUrl.Companion.toHttpUrlOrNull + fun Context.openItemUrl( currentItem: Int, linkDecoded: String, @@ -35,15 +37,13 @@ fun Context.openItemUrl( intent.putExtra("currentItem", currentItem) app.startActivity(intent) } else { - val intent = Intent(Intent.ACTION_VIEW) - intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK - intent.data = Uri.parse(linkDecoded.toStringUriWithHttp()) - startActivity(intent) + this.openUrlInBrowserAsNewTask(linkDecoded) } } } -fun String.isUrlValid(): Boolean = this.toHttpUrlOrNull() != null && Patterns.WEB_URL.matcher(this).matches() +fun String.isUrlValid(): Boolean = + this.toHttpUrlOrNull() != null && Patterns.WEB_URL.matcher(this).matches() fun String.isBaseUrlInvalid(): Boolean { val baseUrl = this.toHttpUrlOrNull() @@ -56,11 +56,31 @@ fun String.isBaseUrlInvalid(): Boolean { return !(Patterns.WEB_URL.matcher(this).matches() && existsAndEndsWithSlash) } -fun Context.openInBrowserAsNewTask(i: SelfossModel.Item) { +fun Context.openItemUrlInBrowserAsNewTask(i: SelfossModel.Item) { + this.openUrlInBrowserAsNewTask(i.getLinkDecoded().toStringUriWithHttp()) +} + +fun Context.openUrlInBrowserAsNewTask(url: String) { + val intent = Intent(Intent.ACTION_VIEW) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK - intent.data = Uri.parse(i.getLinkDecoded().toStringUriWithHttp()) - startActivity(intent) + intent.data = Uri.parse(url) + this.mayBeStartActivity(intent) +} + +fun Context.openUrlInBrowser(url: String) { + val intent = Intent(Intent.ACTION_VIEW) + intent.data = Uri.parse(url) + this.mayBeStartActivity(intent) +} + +fun Context.mayBeStartActivity(intent: Intent) { + try { + this.startActivity(intent) + } catch (e: ActivityNotFoundException) { + Toast.makeText(this, getString(R.string.no_browser), Toast.LENGTH_SHORT).show() + } + } class LinkOnTouchListener : View.OnTouchListener { @@ -102,4 +122,4 @@ class LinkOnTouchListener : View.OnTouchListener { } return ret } -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ACRAUtils.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/acra/ACRAUtils.kt similarity index 77% rename from androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ACRAUtils.kt rename to androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/acra/ACRAUtils.kt index 14ebf0e..b6e6199 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ACRAUtils.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/acra/ACRAUtils.kt @@ -1,4 +1,4 @@ -package bou.amine.apps.readerforselfossv2.android +package bou.amine.apps.readerforselfossv2.android.utils.acra import org.acra.ACRA import org.acra.ktx.sendSilentlyWithAcra @@ -6,4 +6,4 @@ import org.acra.ktx.sendSilentlyWithAcra fun Throwable.sendSilentlyWithAcraWithName(name: String) { ACRA.errorReporter.putCustomData("error_source", name) this.sendSilentlyWithAcra() -} +} \ No newline at end of file diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/acra/AcraReportingAdministrator.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/acra/AcraReportingAdministrator.kt new file mode 100644 index 0000000..cfd5079 --- /dev/null +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/acra/AcraReportingAdministrator.kt @@ -0,0 +1,29 @@ +package bou.amine.apps.readerforselfossv2.android.utils.acra + +import android.content.Context +import android.os.DeadSystemException +import com.google.auto.service.AutoService +import org.acra.builder.ReportBuilder +import org.acra.config.CoreConfiguration +import org.acra.config.ReportingAdministrator +import org.acra.data.CrashReportData + + +@AutoService(ReportingAdministrator::class) +class AcraReportingAdministrator : ReportingAdministrator { + override fun shouldStartCollecting( + context: Context, + config: CoreConfiguration, + reportBuilder: ReportBuilder + ): Boolean { + return reportBuilder.exception !is DeadSystemException + } + + override fun shouldSendReport( + context: Context, + config: CoreConfiguration, + crashReportData: CrashReportData + ): Boolean { + return crashReportData.get("BRAND") != "redroid" + } +} \ No newline at end of file diff --git a/androidApp/src/main/res/values-ca-rES/strings.xml b/androidApp/src/main/res/values-ca-rES/strings.xml index 89dd067..69c9d49 100644 --- a/androidApp/src/main/res/values-ca-rES/strings.xml +++ b/androidApp/src/main/res/values-ca-rES/strings.xml @@ -1,5 +1,5 @@ - + "Lector per a Selfoss" "Inicia la sessió" "Contrasenya" @@ -7,6 +7,7 @@ "La contrasenya és massa curta" "Camp necessari" "URL" + "Disable SSL" "Autenticació (si és necessària)" "Pot ser que falti una \"/\" al final de l'url." "Nom d'usuari" @@ -22,13 +23,6 @@ "Torneu a comprovar la informació." "No s'han llegit totes les publicacions" "S'han llegit totes les publicacions" - "No hi ha res" - "Nou" - "Tot" - "Preferits" - "Quant a" - "Element llegit" - "Item unread" "Desfés" "Inicieu la sessió per afegir fonts." "No es pot obtenir la llista de fonts." @@ -90,7 +84,7 @@ Guarda els elements per utilitzar-los sense connexió Check for new sources and tags Disable this if your server is receiving excessive amounts of database queries. - "Network connection lost" + "Sense connexió!" "Network connection is now available" Sincronitza els articles Els articles no se sincronitzaran en segon pla @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "No hi ha res" + "Nou" + "Tot" + "Preferits" + "Quant a" + "Element llegit" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-de-rDE/strings.xml b/androidApp/src/main/res/values-de-rDE/strings.xml index 7c18d95..fad991b 100644 --- a/androidApp/src/main/res/values-de-rDE/strings.xml +++ b/androidApp/src/main/res/values-de-rDE/strings.xml @@ -1,12 +1,13 @@ - - "Reader für selfoss" + + "Reader für Selfoss" "Anmelden" "Passwort" "Fortfahren" "Passwort ist nicht lang genug" "Pflichtfeld" "URL" + "Disable SSL" "Anmeldung erforderlich?" "Ups. Du musst eventuell ein \"/\" am Ende der URL anhängen." "Benutzername" @@ -22,22 +23,15 @@ "Überprüfe deine Angaben noch einmal." "Nicht alle Beiträge wurden gelesen" "Alle Beiträge wurden gelesen" - "Keine Einträge vorhanden" - "Neu" - "Alle" - "Favoriten" - "Über" - "Artikel gelesen" - "Item unread" "Rückgängig" "Melde dich an um Quellen hinzuzufügen." "Quellen können nicht abgerufen werden." "Quelle kann nicht gespeichert werden." - "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Fehler beim Laden der Spouts-Liste aufgrund von Netzwerkproblemen." + "Fehler beim Laden der Spouts-Liste, möglicherweise aufgrund eines API-Fehlers." "Das Formular ist nicht vollständig" "Links" - "Issue Tracker" + "Ticketsystem" "Melde einen Bug oder rege ein neues Feature an" "WARNUNG" "Kachelansicht" @@ -64,71 +58,78 @@ Tags Quellen Suche - Can\'t delete the source… + Quelle konnte nicht gelöscht werden… Beim Versuch deine Selfoss-Instanz zu erreichen ist ein Fehler aufgetreten. Solltet dieser Fehler bestehen bleiben, trete bitte mit mir in Kontakt. Designs selfoss API - Loaded items number - Load more articles on scroll + Anzahl der zu ladenden Artikel + Weitere Artikel beim Navigieren laden Übersetzung - The item url is invalid. I\'m looking into solving this issue so the app won\'t crash. - The items number should be an integer. + Der Artikel-Link ist ungültig. Ich such nach einer Lösung dieses Problems, damit die App nicht abstürzt. + Die Anzahl der Artikel sollte eine Ganzzahl sein. Im Browser öffnen Teilen - Mark articles as read when swiping between articles. + Artikel als gelesen markieren, wenn zwischen den Artikeln gewischt wird. Zu Favoriten hinzufügen - Article reader content font size - Article viewer - This will refresh your Selfoss instance. + Schriftgröße im Lesemodus + Lesemodus + Dies wird die Selfoss-Instanz aktualisieren. Dies wird alle Elemente als gelesen markieren. Beim Wischen als gelesen markieren - Don\'t mark articles as read when swiping. + Artikel nicht als gelesen markieren, wenn zwischen den Artikeln gewischt wird. Eintrag als ungelesen markieren - Offline and cache - Articles won\'t be saved to the device memory, and the app won\'t be usable offline. - Articles will be saved to the device memory and will be used for offline use. - Save items for offline use - Check for new sources and tags - Disable this if your server is receiving excessive amounts of database queries. + Offline-Modus und Cache + Artikel werden nicht lokal zwischengespeichert wodurch die App nicht offline nutzbar ist. + Artikel werden lokal zwischengespeichert wodurch die App offline nutzbar ist. + Artikel lokal zwischenspeichern + Nach neuen Quellen und Tags suchen + Diese Funktion sollte deaktiviert werden, wenn der Server übermäßig viele Datenbankanfragen erhält. "Die Netzwerkverbindung wurde unterbrochen" "Netzwerkverbindung ist jetzt verfügbar" Synchronisiere Artikel Artikel werden nicht im Hintergrund synchronisiert Die Artikel werden regelmäßig synchronisiert - = 15 minutes)]]> + = 15 Minuten)]]> Nur aktualisieren, wenn das Telefon aufgeladen wird Lädt… Selfoss synchronisiert Ihre Artikel - Sync notification - New items notification - New items ! - %1$d new items loaded. - Notify on new items synced. + Synchronisationsbenachrichtigung + Benachrichtigung bei neuen Artikeln + Neue Artikel! + %1$d neue Artikel geladen. + Benachrichtigung bei neuen Artikeln Offline API-Zeitüberschreitung Experimentell - Webview not available. Disabling the article viewer to avoid any future crashes. Will load articles inside of your browser from now on. - Webview issue - Align left - Justify - Reader font - Static bottom bar in the article viewer - The bottom bar will always be displayed - The bottom bar can be shown through the floating button - Remove source - Light/Dark mode - Dark mode - Follow the system setting - Light mode - The app does not share any personal data about you. - - A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " - Filters - This app only works with a Selfoss instance, and no other RSS feed. - Sources - Update source - Disconnect ? - You will be disconnected from your selfoss instance. - Disable SSL - + Webview ist nicht verfügbar. Deaktiviere den Lesemodus, um zukünftige Abstürze zu vermeiden. Lade von nun an die Nachrichten in deinen Browser. + Webview-Probleme + Linksbündig + Blocksatz + Schriftgröße im Lesemodus + Statische untere Leiste im Lesemodus + Die untere Leiste wird dauerhaft angezeigt + Die untere Leiste kann über einen schwebenden Button angezeigt werden + Quelle entfernen + Heller/Dunkler Modus + Dunkler Modus + Systemeinstellungen übernehmen + Heller Modus + Diese App teilt keine persönlichen Daten. + + Die App ist abgestürzt. Details werden an den Entwickler gesendet. + "Automatische Fehlerberichterstattung deaktivieren." + Filter + Diese App funktioniert nur mit einer Selfoss-Instanz, nicht mit einzelnen RSS-Feeds. + Quellen + Quelle aktualisieren + Verbindung trennen? + Die Verbindung zur Selfoss-Instanz wird getrennt. + Can\'t open a link without a browser installed + "Keine Einträge vorhanden" + "Neu" + "Alle" + "Favoriten" + "Über" + "Artikel gelesen" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-es-rES/strings.xml b/androidApp/src/main/res/values-es-rES/strings.xml index bd58c51..84825c2 100644 --- a/androidApp/src/main/res/values-es-rES/strings.xml +++ b/androidApp/src/main/res/values-es-rES/strings.xml @@ -1,5 +1,5 @@ - + "Lector para Selfoss" "Iniciar sesión" "Contraseña" @@ -7,6 +7,7 @@ "La contraseña no es suficientemente larga" "Campo requerido" "Url" + "Disable SSL" "Inicio de sesión requerido ?" "Oops. Puede que necesite añadir un \"/\" al final de la url." "Nombre de usuario" @@ -22,19 +23,12 @@ "Revise sus datos de nuevo." "No todas las publicaciones fueron leídas" "Todas las publicaciones fueron leídas" - "Nada aquí" - "Nuevo" - "Todo" - "Favoritos" - "Acerca de" - "Artículo leído" - "Artículo no leído" "Deshacer" "Iniciar sesión para añadir fuentes." "No se puede obtener la lista de fuentes." "No se puede crear la fuente." "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "No se puede obtener la lista de fuentes." "El formulario no está completo" "Enlaces" "Rastreador de Incidencias" @@ -90,7 +84,7 @@ Guardar elementos para uso sin conexión Check for new sources and tags Disable this if your server is receiving excessive amounts of database queries. - "Network connection lost" + "Sin conexión!" "Network connection is now available" Sincronizar artículos Los artículos no se sincronizarán en segundo plano @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Nada aquí" + "Nuevo" + "Todo" + "Favoritos" + "Acerca de" + "Artículo leído" + "Artículo no leído" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-fa-rIR/strings.xml b/androidApp/src/main/res/values-fa-rIR/strings.xml deleted file mode 100644 index fb94070..0000000 --- a/androidApp/src/main/res/values-fa-rIR/strings.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - "Reader for Selfoss" - "Log in" - "Password" - "Go" - "Password not long enough" - "Field required" - "Url" - "Login required ?" - "Oops. You may need to add a \"/\" at the end of the url." - "Username" - "Read all" - "Disconnect" - "Settings" - "General" - "Tag1, Tag2, Tag3" - "Link" - "Name" - "Add a source" - "Save" - "Check your details again." - "All posts weren't read" - "All posts were read" - "Nothing here" - "New" - "All" - "Favorites" - "About" - "Item read" - "Item unread" - "Undo" - "Log in to add sources." - "Can't get sources list." - "Can't create source." - "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." - "The form is not complete" - "Links" - "Issue Tracker" - "Report a bug or ask for a new feature" - "WARNING" - "Card View" - "Share" - "Display the unread count as a badge for the bottom bar." - "Display unread count" - "Display count for favorite and read" - "You seem to be trying to use an invalid URL. Make sure it is correct, and if the problem persists, contact me (via the store contact link). Please note that the app needs you to be using Selfoss. You can't access RSS feeds without it." - "Open links inside the app" - "Articles will open inside the app" - "Articles will open with your default browser" - "Link handling" - "Displaying" - "The articles will be displayed as cards" - "The articles will be displayed as a list" - "Update remote" - "The remote is updated, you can now reload the articles list" - "The update didn't work, try again later, or check your selfoss logs." - "Refresh in progress" - Full height cards - Cards height will adjust to its content - Card height will be fixed - Source code - Tags - Sources - Search - Can\'t delete the source… - There was an issue when trying to communicate with your Selfoss Instance. If the issue persists, please get in touch with me. - Themes - Selfoss Api - Loaded items number - Load more articles on scroll - Translation - The item url is invalid. I\'m looking into solving this issue so the app won\'t crash. - The items number should be an integer. - Open in browser - Share - Mark articles as read when swiping between articles. - Add to favorites - Article reader content font size - Article viewer - This will refresh your Selfoss instance. - This will mark all the items as read. - Mark as read on swipe - Don\'t mark articles as read when swiping. - Mark item as unread - Offline and cache - Articles won\'t be saved to the device memory, and the app won\'t be usable offline. - Articles will be saved to the device memory and will be used for offline use. - Save items for offline use - Check for new sources and tags - Disable this if your server is receiving excessive amounts of database queries. - "Network connection lost" - "Network connection is now available" - Sync articles - Articles will not be synced in the background - Articles will periodically be synced - = 15 minutes)]]> - Only refresh when phone is charging - Loading … - Selfoss is syncing your articles - Sync notification - New items notification - New items ! - %1$d new items loaded. - Notify on new items synced. - Offline - Api Timeout - Experimental - Webview not available. Disabling the article viewer to avoid any future crashes. Will load articles inside of your browser from now on. - Webview issue - Align left - Justify - Reader font - Static bottom bar in the article viewer - The bottom bar will always be displayed - The bottom bar can be shown through the floating button - Remove source - Light/Dark mode - Dark mode - Follow the system setting - Light mode - The app does not share any personal data about you. - - A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " - Filters - This app only works with a Selfoss instance, and no other RSS feed. - Sources - Update source - Disconnect ? - You will be disconnected from your selfoss instance. - Disable SSL - diff --git a/androidApp/src/main/res/values-fr-rFR/strings.xml b/androidApp/src/main/res/values-fr-rFR/strings.xml index 4753a53..5148016 100644 --- a/androidApp/src/main/res/values-fr-rFR/strings.xml +++ b/androidApp/src/main/res/values-fr-rFR/strings.xml @@ -1,5 +1,5 @@ - + "Reader for Selfoss" "Login" "Mot de passe" @@ -7,6 +7,7 @@ "Mot de passe trop court" "Champ requis" "Url Selfoss" + "Désactiver la vérification SSL" "Avec login ?" "Petit souci. Il manque peut-être un / à la fin ?" "Utilisateur" @@ -22,16 +23,9 @@ "Vérifiez vos informations." "Tous les posts n'ont pas été lus" "Tous les posts sont lus" - "Il n'y a rien ici !" - "Non lus" - "Tous" - "Favoris" - "À propos" - "Marqué comme lu" - "Marqué comme non lu" "Annuler" "Identifiez-vous pour ajouter une source." - "Impossible de récupérer la liste des sources" + "Impossible de récupérer la liste des sources." "Impossible de créer la source." "Impossible d'obtenir la liste des spouts en raison d'un problème de réseau." "Impossible d'obtenir la liste des spouts. Cela pourrait venir de l'api." @@ -42,13 +36,13 @@ "ATTENTION" "Vue en carte" "Partager" - "Afficher le nombre d'articles non lus sur la barre en bas de l'écran" + "Afficher le nombre d'articles non lus sur la barre en bas de l'écran." "Afficher le nombre de non lus" "Afficher le nombre de favoris et d'articles lus" "Vous semblez essayer de vous connecter avec une URL invalide. Assurez-vous que c'est la bonne, et si le problème persiste, contactez-moi via le lien du play store. Notez aussi que l'application ne peut fonctionner sans l'application web Selfoss. Vous ne pouvez pas utiliser l'application pour accéder directement aux flux RSS." "Ouvrir les liens dans l'application" "Les articles s'ouvriront dans l'application" - "Les articles s'ouvriront dans votre naviguateur par défaut" + "Les articles s'ouvriront dans votre navigateur par défaut" "Gestion des liens" "Affichage" "Les articles seront affichés en forme de carte" @@ -65,7 +59,7 @@ Sources Rechercher Impossible de supprimer la source… - Il y a eu un souci lors de la communication avec votre instance Selfoss. Si le problèmes persiste, contactez-moi pour trouver une solution. + Il y a eu un souci lors de la communication avec votre instance Selfoss. Si le problème persiste, contactez-moi pour trouver une solution. Thèmes Api Selfoss Nombre d\'articles chargés @@ -81,7 +75,7 @@ Lecteur d\'articles En validant, votre instance Selfoss sera mise à jour. Marquer tous les éléments comme lus ? - Marquer comme lu à la navigation. + Marquer comme lu à la navigation Ne pas marquer les articles comme lus à la navigation. Marquer l\'article comme non lu Hors ligne et cache @@ -93,9 +87,9 @@ "Connexion au réseau perdue" "Connexion réseau de nouveau disponible" Synchroniser les articles - Les articles ne seront pas synchronisés en arrière plan - Articles seront périodiquement synchronisées - = 15 minutes)]]> + Les articles ne seront pas synchronisés en arrière-plan + Articles seront périodiquement synchronisés + = 15 minutes)]]> Synchroniser uniquement lorsque le téléphone est en charge Chargement … Selfoss synchronise vos articles @@ -107,7 +101,7 @@ Hors ligne Timeout de l\'api Expérimental - Pas de Webview disponible. Désactivation du lecteur d\'article pour éviter les futures erreurs. Les articles seront lu via votre navigateur à l\'avenir. + Pas de Webview disponible. Désactivation du lecteur d\'article pour éviter les futures erreurs. Les articles seront lus via votre navigateur à l\'avenir. Problème de Webview Aligner à gauche Justifier le texte @@ -120,15 +114,22 @@ Thème sombre Utiliser les paramètres système Thème clair - The app does not share any personal data about you. - - A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " - Filters - This app only works with a Selfoss instance, and no other RSS feed. + L\'application ne partage aucune information personnelle. + + Un bug s\'est produit. Le développeur en sera informé. + "Désactiver les rapports de plantage." + Filtres + Cette application ne fonctionne qu\'avec l\'api de Selfoss, et aucun autre. Sources - Update source - Disconnect ? - You will be disconnected from your selfoss instance. - Disable SSL - + Mise à jour des sources + Se déconnecter ? + Vous allez être déconnecté de votre instance Selfoss. + Can\'t open a link without a browser installed + "Il n'y a rien ici !" + "Non lus" + "Tous" + "Favoris" + "À propos" + "Marqué comme lu" + "Marqué comme non lu" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-gl-rES/strings.xml b/androidApp/src/main/res/values-gl-rES/strings.xml index a24ab3b..afe16ad 100644 --- a/androidApp/src/main/res/values-gl-rES/strings.xml +++ b/androidApp/src/main/res/values-gl-rES/strings.xml @@ -1,5 +1,5 @@ - + "Lector para selfoss" "Conectar" "Contrasinal" @@ -7,6 +7,7 @@ "O contrasinal non é suficientemente longo" "Campo requirido" "URL" + "Disable SSL" "É preciso iniciar sesión?" "Ups! Pode que precises engadir un \"/\" o final da URL." "Nome de usuario" @@ -22,13 +23,6 @@ "Comprobar os teus detalles de novo." "Non se leron todas as publicacións" "Leronse todas as publicacións" - "Non hai nada aquí" - "Novo" - "Todos" - "Favoritos" - "Acerca de" - "Elemento lido" - "Elemento non lido" "Desfacer" "Accede pra engadir fontes." "Non se pode obter a lista de fontes." @@ -123,12 +117,19 @@ A aplicación non comparte ningún dato persoal seu. Ocurriu un erro. Enviando os detalles o desenvolvedor. - "Deshabilitar o reporte automático de erros. " + "Deshabilitar o reporte automático de erros." Filtros Esta aplicación só funciona cunha instancia de Selfoss, e con ningún outro filtro RSS. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Non hai nada aquí" + "Novo" + "Todos" + "Favoritos" + "Acerca de" + "Elemento lido" + "Elemento non lido" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-in-rID/strings.xml b/androidApp/src/main/res/values-in-rID/strings.xml index 248a2ab..df09a8e 100644 --- a/androidApp/src/main/res/values-in-rID/strings.xml +++ b/androidApp/src/main/res/values-in-rID/strings.xml @@ -1,5 +1,5 @@ - + "Reader for Selfoss" "Masuk" "Kata sandi" @@ -7,6 +7,7 @@ "Kata sandinya tidak cukup panjang" "Kolom wajib diisi" "URL" + "Disable SSL" "Harus masuk?" "Ups. Anda mungkin harus menambahkan \"/\" di akhir url." "Nama pengguna" @@ -22,19 +23,12 @@ "Periksa kembali detail Anda." "Semua pos belum dibaca" "Semua pos sudah dibaca" - "Tidak ada di sini" - "Baru" - "Semua" - "Favorit" - "Tentang" - "Membaca item" - "Item unread" "Urung" "Masuk untuk menambah sumber." "Tidak bisa mendapatkan daftar sumber." "Tidak dapat membuat sumber." "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Tidak bisa masuk ke daftar Spouts." "Formulirnya belum selesai" "Tautan" "Pelacak Masalah" @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Tidak ada di sini" + "Baru" + "Semua" + "Favorit" + "Tentang" + "Membaca item" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-it-rIT/strings.xml b/androidApp/src/main/res/values-it-rIT/strings.xml index 3379b85..d23a504 100644 --- a/androidApp/src/main/res/values-it-rIT/strings.xml +++ b/androidApp/src/main/res/values-it-rIT/strings.xml @@ -1,5 +1,5 @@ - + "Lettore RSS per Selfoss" "Accedi" "Password" @@ -7,6 +7,7 @@ "La password non è sufficientemente lunga" "Campo obbligatorio" "URL" + "Disable SSL" "È richiesto l'accesso?" "Oops. Potrebbe essere necessario aggiungere un \"/\" alla fine dell'url." "Nome utente" @@ -22,13 +23,6 @@ "Controlla nuovamente i dati." "All posts weren't read" "Tutti i messaggi sono stati letti" - "Non c'è niente qui" - "Nuovi" - "Tutti" - "Preferiti" - "Informazioni" - "Articolo letto" - "Item unread" "Annulla" "Autenticati per aggiungere fonti." "Can't get sources list." @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Non c'è niente qui" + "Nuovi" + "Tutti" + "Preferiti" + "Informazioni" + "Articolo letto" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-ko-rKR/strings.xml b/androidApp/src/main/res/values-ko-rKR/strings.xml index 93d133b..ef66805 100644 --- a/androidApp/src/main/res/values-ko-rKR/strings.xml +++ b/androidApp/src/main/res/values-ko-rKR/strings.xml @@ -1,5 +1,5 @@ - + "Reader for Selfoss" "로그인" "비밀번호" @@ -7,6 +7,7 @@ "패스워드가 짧습니다." "필수 항목" "Url" + "Disable SSL" "로그인이 필요합니까?" "죄송합니다. Url의 끝에 \"/\"를 추가할 필요가 있습니다." "사용자 이름" @@ -22,19 +23,12 @@ "세부 정보를 다시 확인하세요." "모든 게시물을 읽지 않았습니다." "모든 게시물을 읽었습니다." - "비어있음" - "새로운" - "전체" - "즐겨찾기" - "정보" - "항목 읽기" - "Item unread" "실행 취소" "로그인 소스를 추가 해야 합니다." "소스 리스트를 얻을 수 없습니다." "소스를 만들 수 없습니다." "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Spouts 목록을 가져올 수 없습니다." "양식이 완료되지 않았습니다." "링크" "이슈 트래커" @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "비어있음" + "새로운" + "전체" + "즐겨찾기" + "정보" + "항목 읽기" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-nl-rNL/strings.xml b/androidApp/src/main/res/values-nl-rNL/strings.xml index e16d314..374a226 100644 --- a/androidApp/src/main/res/values-nl-rNL/strings.xml +++ b/androidApp/src/main/res/values-nl-rNL/strings.xml @@ -1,5 +1,5 @@ - + "Selfoss Reader" "Inloggen" "Wachtwoord" @@ -7,6 +7,7 @@ "Wachtwoord niet lang genoeg" "Dit veld is verplicht" "Selfoss server" + "Disable SSL" "Authenticatie vereist?" "Oeps, ben je soms de \"/\" vergeten aan het eind?" "Gebruikersnaam" @@ -22,19 +23,11 @@ "Controleer de gegevens nogmaals." "Fout bij markeren als gelezen" "Alle artikelen gemarkeerd als gelezen" - "Niets gevonden" - "Nieuw" - "Alle" - "Favorieten" - "Over" - "Artikel gelezen" - "Item unread" - "Ongedaan maken" "Login om bronnen toe te voegen" "Kan de lijst met bronnen niet ophalen" "Kan bron niet creëeren" "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Ophalen spouts mislukt" "Formulier is niet volledig ingevuld" "Links" "Bug tracker" @@ -92,7 +85,7 @@ Disable this if your server is receiving excessive amounts of database queries. "Network connection lost" "Network connection is now available" - Sync articles + Artikel synchronisieren Articles will not be synced in the background Articles will periodically be synced = 15 minutes)]]> @@ -123,12 +116,20 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Niets gevonden" + "Nieuw" + "Alle" + "Favorieten" + "Over" + "Artikel gelezen" + "Item unread" + "Ongedaan maken" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-pt-rBR/strings.xml b/androidApp/src/main/res/values-pt-rBR/strings.xml index 7ae3e67..be6b8ad 100644 --- a/androidApp/src/main/res/values-pt-rBR/strings.xml +++ b/androidApp/src/main/res/values-pt-rBR/strings.xml @@ -1,5 +1,5 @@ - + "Reader for Selfoss" "Entrar" "Senha" @@ -7,6 +7,7 @@ "Senha muito pequena" "Campo obrigatório" "Url" + "Disable SSL" "É necessário o login ?" "Oops. Talvez você precise adicionar uma \"/\" no final da url." "Usuário" @@ -22,19 +23,12 @@ "Verifique os detalhes novamente." "Nenhum post foi lido" "Todos os posts foram lidos" - "Nada aqui" - "Novo" - "Todos" - "Favoritos" - "Sobre" - "Item lido" - "Item unread" "Desfazer" "Faça login para adicionar fontes." "Não é possível obter a lista de fontes." "Não é possível criar fonte." "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Não é possível obter a lista de spouts." "O formulário não está completo" "Links" "Rastreador de problemas" @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Nada aqui" + "Novo" + "Todos" + "Favoritos" + "Sobre" + "Item lido" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-pt-rPT/strings.xml b/androidApp/src/main/res/values-pt-rPT/strings.xml index 79c39c4..b532f49 100644 --- a/androidApp/src/main/res/values-pt-rPT/strings.xml +++ b/androidApp/src/main/res/values-pt-rPT/strings.xml @@ -1,5 +1,5 @@ - + "Leitor para Selfoss" "Iniciar sessão" "Palavra passe" @@ -7,6 +7,7 @@ "Senha não é longa o suficiente" "Campo obrigatório" "Url" + "Disable SSL" "É necessário fazer login?" "Uups. Você pode precisar adicionar uma \"/\" no final da url." "Nome do usuário" @@ -22,19 +23,12 @@ "Verifique seus dados novamente." "Todas as postagens não foram lidas" "Todas as postagens foram lidas" - "Nada aqui" - "Novo" - "Tudo" - "Favoritos" - "Sobre" - "Item lido" - "Item unread" "Desfazer" "Logar para adicionar fontes." "Não é possível obter a lista de fontes." "Não é possível criar a fonte." "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Não é possível obter a lista de bicos." "O formulário não está completo" "Links" "Rastreador de problemas" @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Nada aqui" + "Novo" + "Tudo" + "Favoritos" + "Sobre" + "Item lido" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-si-rLK/strings.xml b/androidApp/src/main/res/values-si-rLK/strings.xml index 2f46a3e..508b07e 100644 --- a/androidApp/src/main/res/values-si-rLK/strings.xml +++ b/androidApp/src/main/res/values-si-rLK/strings.xml @@ -1,5 +1,5 @@ - + "Reader for Selfoss" "පිවිසෙන්න" "මුර පදය" @@ -7,6 +7,7 @@ "Password not long enough" "Field required" "Url" + "Disable SSL" "Login required ?" "Oops. You may need to add a \"/\" at the end of the url." "පරිශීලක නාමය" @@ -22,13 +23,6 @@ "Check your details again." "All posts weren't read" "All posts were read" - "Nothing here" - "New" - "සියල්ල" - "Favorites" - "මේ ගැන" - "Item read" - "Item unread" "Undo" "Log in to add sources." "Can't get sources list." @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Nothing here" + "New" + "සියල්ල" + "Favorites" + "මේ ගැන" + "Item read" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-tr-rTR/strings.xml b/androidApp/src/main/res/values-tr-rTR/strings.xml index e6bab9a..d77b448 100644 --- a/androidApp/src/main/res/values-tr-rTR/strings.xml +++ b/androidApp/src/main/res/values-tr-rTR/strings.xml @@ -1,5 +1,5 @@ - + "Selfoss için okuyucu" "Giriş" "Şifre" @@ -7,6 +7,7 @@ "Parola yeterince uzun değil" "Alan gereklidir" "Url" + "Disable SSL" "Kullanıcı Girişi Gerekli?" "Oops. Url'nin sonuna \"/\" eklemek gerekebilir." "Kullanıcı adı" @@ -22,19 +23,12 @@ "Detaylarınızı tekrar kontrol edin." "Tüm mesajlar okunmadı" "Tüm mesajlar okundu" - "Burada hiçbir şey yok" - "Yeni" - "Tüm" - "Favoriler" - "Hakkında" - "Öğeleri oku" - "Item unread" "Geri al" "Kaynakları eklemek için giriş yapın." "Kaynakları listesi alınamıyor." "Kaynak oluşturulamıyor." "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "Spouts listesine girilemiyor." "Form tamamlanamadı" "Bağlantılar" "Sorun İzleyici" @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "Burada hiçbir şey yok" + "Yeni" + "Tüm" + "Favoriler" + "Hakkında" + "Öğeleri oku" + "Item unread" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-zh-rCN/strings.xml b/androidApp/src/main/res/values-zh-rCN/strings.xml index c562215..692f6b6 100644 --- a/androidApp/src/main/res/values-zh-rCN/strings.xml +++ b/androidApp/src/main/res/values-zh-rCN/strings.xml @@ -1,5 +1,5 @@ - + "Selfoss 阅读器" "登录" "密码" @@ -7,6 +7,7 @@ "密码不够长" "必填字段" "网址" + "Disable SSL" "需要登录?" "哎呀。您可能需要在网址的末尾添加一个 \"/\"。" "用户名" @@ -22,13 +23,6 @@ "再次检查您的详细信息。" "所有帖子都未读" "所有帖子已读" - "暂无内容!" - "新建" - "所有" - "收藏夹" - "关于我们" - "已读" - "未读条目" "撤销" "登录以添加数据源。" "无法获取数据列表。" @@ -123,12 +117,19 @@ 该应用不分享任何关于您的个人数据。 发生崩溃。请将细节发送给开发人员。 - "禁用自动错误报告 " + "禁用自动错误报告" 筛选器 此应用只适用于 Selfoss 实例,不适用于其他 RSS 。 更新源 - Disconnect ? - You will be disconnected from your selfoss instance. - Disable SSL - + 断开连接? + 您将断开与 selfoss 实例的连接。 + Can\'t open a link without a browser installed + "暂无内容!" + "新建" + "所有" + "收藏夹" + "关于我们" + "已读" + "未读条目" + \ No newline at end of file diff --git a/androidApp/src/main/res/values-zh-rTW/strings.xml b/androidApp/src/main/res/values-zh-rTW/strings.xml index 0a44316..d259c26 100644 --- a/androidApp/src/main/res/values-zh-rTW/strings.xml +++ b/androidApp/src/main/res/values-zh-rTW/strings.xml @@ -1,5 +1,5 @@ - + "Selfoss 阅读器" "登录" "密码" @@ -7,6 +7,7 @@ "密码不够长" "欄位必填" "网址" + "Disable SSL" "需要登入?" "哎呀。您可能需要在网址的末尾添加一个 \"/\"。" "使用者名稱" @@ -22,19 +23,12 @@ "再次检查您的详细信息。" "所有帖子都未读" "所有帖子已读" - "暂无内容!" - "新建" - "所有" - "收藏夹" - "关于我们" - "已读" - "未讀項目" "撤销" "登录以添加数据源。" "无法获取数据列表。" "无法创建源数据。" "Can't get spouts list because of a network issue." - "Can't get spouts list. There may ben an api issue." + "无法获取数据列表" "窗体未完成" "链接" "问题追踪器" @@ -123,12 +117,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - Disable SSL - + Can\'t open a link without a browser installed + "暂无内容!" + "新建" + "所有" + "收藏夹" + "关于我们" + "已读" + "未讀項目" + \ No newline at end of file diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml index 6cbc2cd..d44675b 100644 --- a/androidApp/src/main/res/values/strings.xml +++ b/androidApp/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - + "Reader for Selfoss" "Log in" "Password" @@ -22,13 +22,6 @@ "Check your details again." "All posts weren't read" "All posts were read" - "Nothing here" - "New" - "All" - "Favorites" - "About" - "Item read" - "Item unread" "Undo" "Log in to add sources." "Can't get sources list." @@ -55,8 +48,7 @@ "The articles will be displayed as a list" "Update remote" "The remote is updated, you can now reload the articles list" - "The update didn't work, try again later, or check your selfoss logs." + "The update didn't work, try again later, or check your selfoss logs." "Refresh in progress" Full height cards Cards height will adjust to its content @@ -127,11 +119,19 @@ The app does not share any personal data about you. A crash occured. Sending the details to the developper. - "Disable automatic bug reporting. " + "Disable automatic bug reporting." Filters This app only works with a Selfoss instance, and no other RSS feed. Sources Update source Disconnect ? You will be disconnected from your selfoss instance. - + Can\'t open a link without a browser installed + "Nothing here" + "New" + "All" + "Favorites" + "About" + "Item read" + "Item unread" + \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml index 62ace39..c7c8c36 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -3,3 +3,4 @@ files: translation: /androidApp/src/main/res/values-%android_code%/%original_file_name% translate_attributes: '0' content_segmentation: '0' +preserve_hierarchy: true \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt index 70073bd..9b2bd99 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt @@ -2,6 +2,7 @@ package bou.amine.apps.readerforselfossv2.model import bou.amine.apps.readerforselfossv2.utils.DateUtils import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded +import bou.amine.apps.readerforselfossv2.utils.isEmptyOrNullOrNullString import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.descriptors.PrimitiveKind @@ -10,7 +11,12 @@ import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.encodeCollection -import kotlinx.serialization.json.* +import kotlinx.serialization.json.JsonArray +import kotlinx.serialization.json.JsonDecoder +import kotlinx.serialization.json.boolean +import kotlinx.serialization.json.booleanOrNull +import kotlinx.serialization.json.int +import kotlinx.serialization.json.jsonPrimitive class SelfossModel { @Serializable @@ -134,6 +140,10 @@ class SelfossModel { stringUrl = "http:$stringUrl" } + if (stringUrl.isEmptyOrNullOrNullString()) { + throw Exception("Link ${link} was translated to ${stringUrl}, but was empty. Handle this.") + } + return stringUrl } @@ -176,7 +186,10 @@ class SelfossModel { encoder: Encoder, value: List, ) { - encoder.encodeCollection(PrimitiveSerialDescriptor("tags", PrimitiveKind.STRING), value.size) { this.toString() } + encoder.encodeCollection( + PrimitiveSerialDescriptor("tags", PrimitiveKind.STRING), + value.size + ) { this.toString() } } } @@ -191,7 +204,10 @@ class SelfossModel { } override val descriptor: SerialDescriptor - get() = PrimitiveSerialDescriptor("BooleanOrIntForSomeSelfossVersions", PrimitiveKind.BOOLEAN) + get() = PrimitiveSerialDescriptor( + "BooleanOrIntForSomeSelfossVersions", + PrimitiveKind.BOOLEAN + ) override fun serialize( encoder: Encoder, @@ -200,4 +216,4 @@ class SelfossModel { TODO("Not yet implemented") } } -} +} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/RestUtils.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/RestUtils.kt index be5b12e..f499cdc 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/RestUtils.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/RestUtils.kt @@ -30,10 +30,14 @@ suspend fun maybeResponse(r: HttpResponse?): SuccessResponse { } suspend inline fun bodyOrFailure(r: HttpResponse?): StatusAndData { - return if (r != null && r.status.isSuccess()) { - StatusAndData.succes(r.body()) - } else { - StatusAndData.error() + try { + return if (r != null && r.status.isSuccess()) { + StatusAndData.succes(r.body()) + } else { + StatusAndData.error() + } + } catch (e: Throwable) { + return StatusAndData.error() } } @@ -94,4 +98,4 @@ suspend fun HttpClient.tryToSubmitForm( url(url) block() } - } + } \ No newline at end of file diff --git a/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt b/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt index 39c6fe0..6b6cb5b 100644 --- a/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt +++ b/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt @@ -2,12 +2,8 @@ package bou.amine.apps.readerforselfossv2.utils actual class DateUtils { actual companion object { - actual fun parseDate(dateString: String): Long { - TODO("Not yet implemented") - } - actual fun parseRelativeDate(dateString: String): String { TODO("Not yet implemented") } } -} +} \ No newline at end of file diff --git a/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt b/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt index 39c6fe0..6b6cb5b 100644 --- a/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt +++ b/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/utils/DateUtils.kt @@ -2,12 +2,8 @@ package bou.amine.apps.readerforselfossv2.utils actual class DateUtils { actual companion object { - actual fun parseDate(dateString: String): Long { - TODO("Not yet implemented") - } - actual fun parseRelativeDate(dateString: String): String { TODO("Not yet implemented") } } -} +} \ No newline at end of file