Merge pull request #6200 from ByteHamster/detailed-error-message

Show human readable error message on details dialog
This commit is contained in:
ByteHamster 2022-11-30 21:16:13 +01:00 committed by GitHub
commit bc3b717911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.util.DownloadErrorLabel;
import de.danoeh.antennapod.model.download.DownloadStatus;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.event.MessageEvent;
@ -21,7 +22,6 @@ public class DownloadLogDetailsDialog extends MaterialAlertDialogBuilder {
super(context);
String url = "unknown";
String message = context.getString(R.string.download_successful);
if (status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
FeedMedia media = DBReader.getFeedMedia(status.getFeedfileId());
if (media != null) {
@ -34,11 +34,13 @@ public class DownloadLogDetailsDialog extends MaterialAlertDialogBuilder {
}
}
String message = context.getString(R.string.download_successful);
if (!status.isSuccessful()) {
message = status.getReasonDetailed();
}
String messageFull = context.getString(R.string.download_error_details_message, message, url);
String messageFull = context.getString(R.string.download_log_details_message,
context.getString(DownloadErrorLabel.from(status.getReason())), message, url);
setTitle(R.string.download_error_details);
setMessage(messageFull);
setPositiveButton(android.R.string.ok, null);

View File

@ -256,7 +256,7 @@
<string name="download_pending">Download pending</string>
<string name="download_running">Download running</string>
<string name="download_error_details">Details</string>
<string name="download_error_details_message">%1$s \n\nFile URL:\n%2$s</string>
<string name="download_log_details_message">%1$s \n\nTechnical reason: \n%2$s \n\nFile URL:\n%3$s</string>
<string name="download_error_tap_for_details">Tap to view details.</string>
<string name="download_error_device_not_found">Storage Device not found</string>
<string name="download_error_insufficient_space">There is not enough space left on your device.</string>