mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-27 09:13:53 +01:00
Merge pull request #3101 from orionlee/bugfix_add_podcast_by_url_case_no_feed_in_html_3099
bugfix - add podcast by URL - show error dialog when URL points to no feed
This commit is contained in:
commit
f5956bcd56
@ -342,8 +342,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||||||
} catch (UnsupportedFeedtypeException e) {
|
} catch (UnsupportedFeedtypeException e) {
|
||||||
Log.d(TAG, "Unsupported feed type detected");
|
Log.d(TAG, "Unsupported feed type detected");
|
||||||
if ("html".equalsIgnoreCase(e.getRootElement())) {
|
if ("html".equalsIgnoreCase(e.getRootElement())) {
|
||||||
showFeedDiscoveryDialog(new File(feed.getFile_url()), feed.getDownload_url());
|
boolean dialogShown = showFeedDiscoveryDialog(new File(feed.getFile_url()), feed.getDownload_url());
|
||||||
return Optional.empty();
|
if (dialogShown) {
|
||||||
|
return Optional.empty();
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "Supplied feed is an HTML web page that has no references to any feed");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@ -539,21 +544,25 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFeedDiscoveryDialog(File feedFile, String baseUrl) {
|
/**
|
||||||
|
*
|
||||||
|
* @return true if a FeedDiscoveryDialog is shown, false otherwise (e.g., due to no feed found).
|
||||||
|
*/
|
||||||
|
private boolean showFeedDiscoveryDialog(File feedFile, String baseUrl) {
|
||||||
FeedDiscoverer fd = new FeedDiscoverer();
|
FeedDiscoverer fd = new FeedDiscoverer();
|
||||||
final Map<String, String> urlsMap;
|
final Map<String, String> urlsMap;
|
||||||
try {
|
try {
|
||||||
urlsMap = fd.findLinks(feedFile, baseUrl);
|
urlsMap = fd.findLinks(feedFile, baseUrl);
|
||||||
if (urlsMap == null || urlsMap.isEmpty()) {
|
if (urlsMap == null || urlsMap.isEmpty()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPaused || isFinishing()) {
|
if (isPaused || isFinishing()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> titles = new ArrayList<>();
|
final List<String> titles = new ArrayList<>();
|
||||||
@ -589,6 +598,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
dialog = ab.show();
|
dialog = ab.show();
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FeedViewAuthenticationDialog extends AuthenticationDialog {
|
private class FeedViewAuthenticationDialog extends AuthenticationDialog {
|
||||||
|
Loading…
Reference in New Issue
Block a user