diff options
author | ByteHamster <info@bytehamster.com> | 2021-08-27 23:21:17 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-08-27 23:21:51 +0200 |
commit | a7d280d249c6806972a194c93d76ece46f5f41c7 (patch) | |
tree | bd73df209732cb6d290b040ede9958fe4b8e0d89 | |
parent | 85c8a419acb385cdf249662866715965de219c93 (diff) | |
download | AntennaPod-a7d280d249c6806972a194c93d76ece46f5f41c7.zip |
Removed gpodder suggestions feature
The feature was invisible since 2014 and nobody noticed.
5 files changed, 6 insertions, 134 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java b/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java index 32ad5a694..b13af78f7 100644 --- a/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java +++ b/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java @@ -75,20 +75,6 @@ public class GPodnetServiceTest { } @Test - public void testGetSubscriptionsOfUser() - throws GpodnetServiceException { - authenticate(); - service.getSubscriptionsOfUser(); - } - - @Test - public void testGetSubscriptionsOfDevice() - throws GpodnetServiceException { - authenticate(); - service.getSubscriptionsOfDevice(DEVICE_ID); - } - - @Test public void testConfigureDevices() throws GpodnetServiceException { authenticate(); service.configureDevice("foo", "This is an updated caption", GpodnetDevice.DeviceType.LAPTOP); @@ -101,12 +87,6 @@ public class GPodnetServiceTest { } @Test - public void testGetSuggestions() throws GpodnetServiceException { - authenticate(); - service.getSuggestions(10); - } - - @Test public void testTags() throws GpodnetServiceException { service.getTopTags(20); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java index ad815c3c9..2ec30b8c3 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java @@ -30,7 +30,6 @@ public class GpodnetMainFragment extends Fragment { private static final int NUM_PAGES = 2; private static final int POS_TOPLIST = 0; private static final int POS_TAGS = 1; - private static final int POS_SUGGESTIONS = 2; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -50,12 +49,9 @@ public class GpodnetMainFragment extends Fragment { case POS_TAGS: tab.setText(R.string.gpodnet_taglist_header); break; - case POS_TOPLIST: - tab.setText(R.string.gpodnet_toplist_header); - break; + case POS_TOPLIST: // Fall-through default: - case POS_SUGGESTIONS: - tab.setText(R.string.gpodnet_suggestions_header); + tab.setText(R.string.gpodnet_toplist_header); break; } }).attach(); @@ -102,11 +98,9 @@ public class GpodnetMainFragment extends Fragment { switch (position) { case POS_TAGS: return new TagListFragment(); - case POS_TOPLIST: - return new PodcastTopListFragment(); + case POS_TOPLIST: // Fall-through default: - case POS_SUGGESTIONS: - return new SuggestionListFragment(); + return new PodcastTopListFragment(); } } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java deleted file mode 100644 index e3cdb8959..000000000 --- a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java +++ /dev/null @@ -1,26 +0,0 @@ -package de.danoeh.antennapod.fragment.gpodnet; - -import java.util.Collections; -import java.util.List; - -import de.danoeh.antennapod.core.preferences.GpodnetPreferences; -import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService; -import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast; - -/** - * Displays suggestions from gpodder.net - */ -public class SuggestionListFragment extends PodcastListFragment { - private static final int SUGGESTIONS_COUNT = 50; - - @Override - protected List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException { - if (GpodnetPreferences.loggedIn()) { - service.login(); - return service.getSuggestions(SUGGESTIONS_COUNT); - } else { - return Collections.emptyList(); - } - } -} diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index d9787e749..e407b700a 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -630,7 +630,6 @@ <!-- gpodder.net --> <string name="gpodnet_taglist_header">CATEGORIES</string> <string name="gpodnet_toplist_header">TOP PODCASTS</string> - <string name="gpodnet_suggestions_header">SUGGESTIONS</string> <string name="gpodnet_search_hint">Search gpodder.net</string> <string name="gpodnetauth_login_butLabel">Login</string> <string name="gpodnetauth_encryption_warning">Password and data are not encrypted!</string> diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java index d41f613a7..eb18da80b 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java @@ -62,7 +62,7 @@ public class GpodnetService implements ISyncService { private final OkHttpClient httpClient; // split into schema, host and port - missing parts are null - private static Pattern urlsplit_regex = Pattern.compile("(?:(https?)://)?([^:]+)(?::(\\d+))?"); + private static final Pattern URLSPLIT_REGEX = Pattern.compile("(?:(https?)://)?([^:]+)(?::(\\d+))?"); public GpodnetService(OkHttpClient httpClient, String baseHosturl, String deviceId, String username, String password) { @@ -71,7 +71,7 @@ public class GpodnetService implements ISyncService { this.username = username; this.password = password; - Matcher m = urlsplit_regex.matcher(baseHosturl); + Matcher m = URLSPLIT_REGEX.matcher(baseHosturl); if (m.matches()) { this.baseScheme = m.group(1); this.baseHost = m.group(2); @@ -187,37 +187,6 @@ public class GpodnetService implements ISyncService { } /** - * Returns a list of suggested podcasts for the user that is currently - * logged in. - * <p/> - * This method requires authentication. - * - * @param count The - * number of elements that should be returned. Must be in range - * 1..100. - * @throws IllegalArgumentException if count is out of range. - * @throws GpodnetServiceAuthenticationException If there is an authentication error. - */ - public List<GpodnetPodcast> getSuggestions(int count) throws GpodnetServiceException { - if (count < 1 || count > 100) { - throw new IllegalArgumentException("Count must be in range 1..100"); - } - - try { - URL url = new URI(baseScheme, null, baseHost, basePort, - String.format(Locale.US, "/suggestions/%d.json", count), null, null).toURL(); - Request.Builder request = new Request.Builder().url(url); - String response = executeRequest(request); - - JSONArray jsonArray = new JSONArray(response); - return readPodcastListFromJsonArray(jsonArray); - } catch (JSONException | MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** * Searches the podcast directory for a given string. * * @param query The search query @@ -378,50 +347,6 @@ public class GpodnetService implements ISyncService { } /** - * Returns the subscriptions of a specific device. - * <p/> - * This method requires authentication. - * - * @param deviceId The ID of the device whose subscriptions should be returned. - * @return A list of subscriptions in OPML format. - * @throws GpodnetServiceAuthenticationException If there is an authentication error. - */ - public String getSubscriptionsOfDevice(@NonNull String deviceId) throws GpodnetServiceException { - requireLoggedIn(); - try { - URL url = new URI(baseScheme, null, baseHost, basePort, - String.format("/subscriptions/%s/%s.opml", username, deviceId), null, null).toURL(); - Request.Builder request = new Request.Builder().url(url); - return executeRequest(request); - } catch (MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** - * Returns all subscriptions of a specific user. - * <p/> - * This method requires authentication. - * - * @return A list of subscriptions in OPML format. - * @throws IllegalArgumentException If username is null. - * @throws GpodnetServiceAuthenticationException If there is an authentication error. - */ - public String getSubscriptionsOfUser() throws GpodnetServiceException { - requireLoggedIn(); - try { - URL url = new URI(baseScheme, null, baseHost, basePort, - String.format("/subscriptions/%s.opml", username), null, null).toURL(); - Request.Builder request = new Request.Builder().url(url); - return executeRequest(request); - } catch (MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** * Uploads the subscriptions of a specific device. * <p/> * This method requires authentication. |