From c5dd3dc7a91b8f90adf9865b178c5f0a6d4d2b8c Mon Sep 17 00:00:00 2001 From: TobiGr Date: Wed, 31 Mar 2021 23:32:53 +0200 Subject: [PATCH] Improve error message when loading feed Add name of unavailable channel --- .../schabi/newpipe/local/feed/FeedFragment.kt | 16 +++++++++++----- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index f0637e6ba..3662c3654 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -50,6 +50,7 @@ import org.schabi.newpipe.error.ErrorInfo import org.schabi.newpipe.error.UserAction import org.schabi.newpipe.extractor.exceptions.AccountTerminatedException import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException +import org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty import org.schabi.newpipe.fragments.list.BaseListFragment import org.schabi.newpipe.ktx.animate import org.schabi.newpipe.ktx.animateHideRecyclerViewAllowingScrolling @@ -323,17 +324,22 @@ class FeedFragment : BaseListFragment() { } ) .setNegativeButton(R.string.cancel, DialogInterface.OnClickListener { _, _ -> }) + var message = getString(R.string.feed_load_error_account_info, subscriptionEntity.name) if (cause is AccountTerminatedException) { - builder.setMessage(R.string.feed_load_error_terminated) - } else if (cause is ContentNotAvailableException && isFastFeedModeEnabled) { - builder.setMessage(R.string.feed_load_error_fast_unknown) - .setNeutralButton(R.string.feed_use_dedicated_fetch_method_disable_button) { _, _ -> + message += "\n" + getString(R.string.feed_load_error_terminated) + } else if (cause is ContentNotAvailableException) { + if (isFastFeedModeEnabled) { + message += "\n" + getString(R.string.feed_load_error_fast_unknown) + builder.setNeutralButton(R.string.feed_use_dedicated_fetch_method_disable_button) { _, _ -> sharedPreferences.edit { putBoolean(getString(R.string.feed_use_dedicated_fetch_method_key), false) } } + } else if (!isNullOrEmpty(cause.message)) { + message += "\n" + cause.message + } } - builder.create().show() + builder.setMessage(message).create().show() } private fun updateRelativeTimeViews() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29f15a6b8..09dbd486b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -692,7 +692,7 @@ Always update Error loading feed Could not load feed for \'%s\'. - The author\'s account has been terminated.\nNewPipe will not be able to load this feed in the future.\Do you want to unsubscribe from this channel? + The author\'s account has been terminated.\nNewPipe will not be able to load this feed in the future.\nDo you want to unsubscribe from this channel? The fast feed mode does not provide more info on this. Fetch from dedicated feed when available Available in some services, it is usually much faster but may return a limited amount of items and often incomplete information (e.g. no duration, item type, no live status).