Move DownloadService-Interface to new module
This commit is contained in:
parent
e4d4c69519
commit
b140d7297a
|
@ -81,7 +81,9 @@ dependencies {
|
||||||
implementation project(":core")
|
implementation project(":core")
|
||||||
implementation project(":event")
|
implementation project(":event")
|
||||||
implementation project(':model')
|
implementation project(':model')
|
||||||
|
implementation project(':net:common')
|
||||||
implementation project(':net:discovery')
|
implementation project(':net:discovery')
|
||||||
|
implementation project(':net:download:service-interface')
|
||||||
implementation project(':net:sync:gpoddernet')
|
implementation project(':net:sync:gpoddernet')
|
||||||
implementation project(':net:sync:model')
|
implementation project(':net:sync:model')
|
||||||
implementation project(':parser:feed')
|
implementation project(':parser:feed')
|
||||||
|
|
|
@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.service.download;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.util.Consumer;
|
import androidx.core.util.Consumer;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
public class StubDownloader extends Downloader {
|
public class StubDownloader extends Downloader {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.test.antennapod.EspressoTestUtils;
|
import de.test.antennapod.EspressoTestUtils;
|
||||||
import org.awaitility.Awaitility;
|
import org.awaitility.Awaitility;
|
||||||
import org.awaitility.core.ConditionTimeoutException;
|
import org.awaitility.core.ConditionTimeoutException;
|
||||||
|
@ -27,7 +27,7 @@ import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import de.danoeh.antennapod.model.feed.FeedFile;
|
import de.danoeh.antennapod.model.feed.FeedFile;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||||
import de.danoeh.antennapod.core.service.download.HttpDownloader;
|
import de.danoeh.antennapod.core.service.download.HttpDownloader;
|
||||||
|
|
|
@ -4,11 +4,11 @@ import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.dialog.AuthenticationDialog;
|
import de.danoeh.antennapod.dialog.AuthenticationDialog;
|
||||||
|
|
|
@ -35,14 +35,14 @@ import de.danoeh.antennapod.core.event.DownloadEvent;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
|
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface;
|
import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface;
|
||||||
import de.danoeh.antennapod.core.util.DownloadErrorLabel;
|
import de.danoeh.antennapod.core.util.DownloadErrorLabel;
|
||||||
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
||||||
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
||||||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||||
import de.danoeh.antennapod.core.service.download.HttpDownloader;
|
import de.danoeh.antennapod.core.service.download.HttpDownloader;
|
||||||
|
@ -55,7 +55,7 @@ import de.danoeh.antennapod.parser.feed.FeedHandler;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
||||||
import de.danoeh.antennapod.model.download.DownloadError;
|
import de.danoeh.antennapod.model.download.DownloadError;
|
||||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||||
import de.danoeh.antennapod.core.util.URLChecker;
|
import de.danoeh.antennapod.net.common.UrlChecker;
|
||||||
import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
|
import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
|
||||||
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
||||||
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
|
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
|
||||||
|
@ -286,7 +286,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private void startFeedDownload(String url) {
|
private void startFeedDownload(String url) {
|
||||||
Log.d(TAG, "Starting feed download");
|
Log.d(TAG, "Starting feed download");
|
||||||
selectedDownloadUrl = URLChecker.prepareURL(url);
|
selectedDownloadUrl = UrlChecker.prepareUrl(url);
|
||||||
DownloadRequest request = DownloadRequestCreator.create(new Feed(selectedDownloadUrl, null))
|
DownloadRequest request = DownloadRequestCreator.create(new Feed(selectedDownloadUrl, null))
|
||||||
.withAuthentication(username, password)
|
.withAuthentication(username, password)
|
||||||
.withInitiatedByUser(true)
|
.withInitiatedByUser(true)
|
||||||
|
|
|
@ -29,7 +29,7 @@ import de.danoeh.antennapod.core.export.opml.OpmlReader;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.databinding.OpmlSelectionBinding;
|
import de.danoeh.antennapod.databinding.OpmlSelectionBinding;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import io.reactivex.Completable;
|
import io.reactivex.Completable;
|
||||||
|
|
|
@ -11,9 +11,9 @@ import android.widget.Toast;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import androidx.annotation.StringRes;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.core.preferences.UsageStatistics;
|
import de.danoeh.antennapod.core.preferences.UsageStatistics;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import android.content.Context;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.DownloadAuthenticationActivity;
|
import de.danoeh.antennapod.activity.DownloadAuthenticationActivity;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.core.DownloadServiceCallbacks;
|
import de.danoeh.antennapod.core.DownloadServiceCallbacks;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
|
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
|
||||||
import de.danoeh.antennapod.fragment.QueueFragment;
|
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import de.danoeh.antennapod.adapter.actionbutton.StreamActionButton;
|
||||||
import de.danoeh.antennapod.adapter.actionbutton.VisitWebsiteActionButton;
|
import de.danoeh.antennapod.adapter.actionbutton.VisitWebsiteActionButton;
|
||||||
import de.danoeh.antennapod.core.event.DownloadEvent;
|
import de.danoeh.antennapod.core.event.DownloadEvent;
|
||||||
import de.danoeh.antennapod.core.event.DownloaderUpdate;
|
import de.danoeh.antennapod.core.event.DownloaderUpdate;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
|
|
|
@ -11,9 +11,9 @@ import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.core.util.LongList;
|
import de.danoeh.antennapod.core.util.LongList;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.util.Log;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.ClientConfigurator;
|
import de.danoeh.antennapod.core.ClientConfigurator;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||||
|
|
||||||
// modified from http://developer.android.com/training/monitoring-device-state/battery-monitoring.html
|
// modified from http://developer.android.com/training/monitoring-device-state/battery-monitoring.html
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Arrays;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.ClientConfigurator;
|
import de.danoeh.antennapod.core.ClientConfigurator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,7 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.adapter.CoverLoader;
|
import de.danoeh.antennapod.adapter.CoverLoader;
|
||||||
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
|
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
||||||
import de.danoeh.antennapod.core.util.download.MediaSizeLoader;
|
import de.danoeh.antennapod.core.util.download.MediaSizeLoader;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.adapter.CoverLoader;
|
import de.danoeh.antennapod.adapter.CoverLoader;
|
||||||
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
|
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
|
||||||
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
|
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.core.util.DateFormatter;
|
import de.danoeh.antennapod.core.util.DateFormatter;
|
||||||
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
||||||
|
|
|
@ -23,6 +23,8 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':event')
|
implementation project(':event')
|
||||||
implementation project(':model')
|
implementation project(':model')
|
||||||
|
implementation project(':net:common')
|
||||||
|
implementation project(':net:download:service-interface')
|
||||||
implementation project(':net:ssl')
|
implementation project(':net:ssl')
|
||||||
implementation project(':net:sync:gpoddernet')
|
implementation project(':net:sync:gpoddernet')
|
||||||
implementation project(':net:sync:model')
|
implementation project(':net:sync:model')
|
||||||
|
|
|
@ -6,7 +6,7 @@ import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
|
||||||
import de.danoeh.antennapod.core.preferences.UsageStatistics;
|
import de.danoeh.antennapod.core.preferences.UsageStatistics;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceImpl;
|
import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceImpl;
|
||||||
import de.danoeh.antennapod.core.sync.SyncService;
|
import de.danoeh.antennapod.core.sync.SyncService;
|
||||||
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink;
|
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package de.danoeh.antennapod.core;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callbacks for the DownloadService of the core module.
|
* Callbacks for the DownloadService of the core module.
|
||||||
|
|
|
@ -8,9 +8,9 @@ import android.content.Context;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.service;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.HttpCredentialEncoder;
|
import de.danoeh.antennapod.core.service.download.HttpCredentialEncoder;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.util.URIUtil;
|
import de.danoeh.antennapod.core.util.URIUtil;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.util.Log;
|
||||||
import android.webkit.URLUtil;
|
import android.webkit.URLUtil;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
public class DefaultDownloaderFactory implements DownloaderFactory {
|
public class DefaultDownloaderFactory implements DownloaderFactory {
|
||||||
private static final String TAG = "DefaultDwnldrFactory";
|
private static final String TAG = "DefaultDwnldrFactory";
|
||||||
|
|
|
@ -6,6 +6,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.util.FileNameGenerator;
|
import de.danoeh.antennapod.core.util.FileNameGenerator;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import de.danoeh.antennapod.core.R;
|
||||||
import de.danoeh.antennapod.core.feed.LocalFeedUpdater;
|
import de.danoeh.antennapod.core.feed.LocalFeedUpdater;
|
||||||
import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithmFactory;
|
import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithmFactory;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.content.Intent;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import com.google.android.exoplayer2.util.Log;
|
import com.google.android.exoplayer2.util.Log;
|
||||||
import de.danoeh.antennapod.core.BuildConfig;
|
import de.danoeh.antennapod.core.BuildConfig;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.concurrent.Callable;
|
||||||
import de.danoeh.antennapod.core.ClientConfig;
|
import de.danoeh.antennapod.core.ClientConfig;
|
||||||
import de.danoeh.antennapod.core.R;
|
import de.danoeh.antennapod.core.R;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads files
|
* Downloads files
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.core.service.download;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
public interface DownloaderFactory {
|
public interface DownloaderFactory {
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.util.Log;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import okhttp3.CacheControl;
|
import okhttp3.CacheControl;
|
||||||
import okhttp3.internal.http.StatusLine;
|
import okhttp3.internal.http.StatusLine;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package de.danoeh.antennapod.core.service.download;
|
package de.danoeh.antennapod.core.service.download;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This does not actually download, but it keeps track of a local feed's refresh state.
|
* This does not actually download, but it keeps track of a local feed's refresh state.
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.service.download.handler;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@ import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
||||||
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
|
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandler;
|
import de.danoeh.antennapod.parser.feed.FeedHandler;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.io.File;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
|
|
|
@ -7,9 +7,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
import de.danoeh.antennapod.core.util.PlaybackStatus;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
||||||
|
|
|
@ -10,9 +10,9 @@ import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
||||||
import de.danoeh.antennapod.storage.database.mapper.FeedCursorMapper;
|
import de.danoeh.antennapod.storage.database.mapper.FeedCursorMapper;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface;
|
import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface;
|
||||||
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
|
@ -20,10 +20,10 @@ import androidx.work.WorkManager;
|
||||||
import androidx.work.Worker;
|
import androidx.work.Worker;
|
||||||
import androidx.work.WorkerParameters;
|
import androidx.work.WorkerParameters;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueStorage;
|
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueStorage;
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||||
import de.danoeh.antennapod.core.util.LongList;
|
import de.danoeh.antennapod.core.util.LongList;
|
||||||
import de.danoeh.antennapod.core.util.URLChecker;
|
import de.danoeh.antennapod.net.common.UrlChecker;
|
||||||
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
|
@ -150,7 +150,7 @@ public class SyncService extends Worker {
|
||||||
Log.d(TAG, "Skipping url: " + downloadUrl);
|
Log.d(TAG, "Skipping url: " + downloadUrl);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!URLChecker.containsUrl(localSubscriptions, downloadUrl) && !queuedRemovedFeeds.contains(downloadUrl)) {
|
if (!UrlChecker.containsUrl(localSubscriptions, downloadUrl) && !queuedRemovedFeeds.contains(downloadUrl)) {
|
||||||
Feed feed = new Feed(downloadUrl, null);
|
Feed feed = new Feed(downloadUrl, null);
|
||||||
DownloadRequest.Builder builder = DownloadRequestCreator.create(feed);
|
DownloadRequest.Builder builder = DownloadRequestCreator.create(feed);
|
||||||
DownloadServiceInterface.get().download(getApplicationContext(), false, builder.build());
|
DownloadServiceInterface.get().download(getApplicationContext(), false, builder.build());
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util.download;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import com.google.android.exoplayer2.util.Log;
|
import com.google.android.exoplayer2.util.Log;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceStub;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterfaceStub;
|
||||||
import de.danoeh.antennapod.core.util.FastDocumentFile;
|
import de.danoeh.antennapod.core.util.FastDocumentFile;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
|
|
|
@ -10,8 +10,8 @@ import androidx.core.util.Consumer;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadServiceInterfaceStub;
|
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterfaceStub;
|
||||||
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
||||||
import org.awaitility.Awaitility;
|
import org.awaitility.Awaitility;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# :net:common
|
||||||
|
|
||||||
|
This module contains general network related utilities.
|
|
@ -0,0 +1,12 @@
|
||||||
|
plugins {
|
||||||
|
id("com.android.library")
|
||||||
|
}
|
||||||
|
apply from: "../../common.gradle"
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||||
|
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||||
|
|
||||||
|
testImplementation "junit:junit:$junitVersion"
|
||||||
|
testImplementation "org.robolectric:robolectric:$robolectricVersion"
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<manifest package="de.danoeh.antennapod.net.common" />
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.net.common;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -11,22 +11,23 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides methods for checking and editing a URL.
|
* Provides methods for checking and editing a URL.
|
||||||
*/
|
*/
|
||||||
public final class URLChecker {
|
public final class UrlChecker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class shall not be instantiated.
|
* Class shall not be instantiated.
|
||||||
*/
|
*/
|
||||||
private URLChecker() {
|
private UrlChecker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging tag.
|
* Logging tag.
|
||||||
*/
|
*/
|
||||||
private static final String TAG = "URLChecker";
|
private static final String TAG = "UrlChecker";
|
||||||
|
|
||||||
private static final String AP_SUBSCRIBE = "antennapod-subscribe://";
|
private static final String AP_SUBSCRIBE = "antennapod-subscribe://";
|
||||||
private static final String AP_SUBSCRIBE_DEEPLINK = "antennapod.org/deeplink/subscribe";
|
private static final String AP_SUBSCRIBE_DEEPLINK = "antennapod.org/deeplink/subscribe";
|
||||||
|
@ -37,31 +38,31 @@ public final class URLChecker {
|
||||||
* @param url The url which is going to be prepared
|
* @param url The url which is going to be prepared
|
||||||
* @return The prepared url
|
* @return The prepared url
|
||||||
*/
|
*/
|
||||||
public static String prepareURL(@NonNull String url) {
|
public static String prepareUrl(@NonNull String url) {
|
||||||
url = url.trim();
|
url = url.trim();
|
||||||
String lowerCaseUrl = url.toLowerCase(); // protocol names are case insensitive
|
String lowerCaseUrl = url.toLowerCase(Locale.ROOT); // protocol names are case insensitive
|
||||||
if (lowerCaseUrl.startsWith("feed://")) {
|
if (lowerCaseUrl.startsWith("feed://")) {
|
||||||
Log.d(TAG, "Replacing feed:// with http://");
|
Log.d(TAG, "Replacing feed:// with http://");
|
||||||
return prepareURL(url.substring("feed://".length()));
|
return prepareUrl(url.substring("feed://".length()));
|
||||||
} else if (lowerCaseUrl.startsWith("pcast://")) {
|
} else if (lowerCaseUrl.startsWith("pcast://")) {
|
||||||
Log.d(TAG, "Removing pcast://");
|
Log.d(TAG, "Removing pcast://");
|
||||||
return prepareURL(url.substring("pcast://".length()));
|
return prepareUrl(url.substring("pcast://".length()));
|
||||||
} else if (lowerCaseUrl.startsWith("pcast:")) {
|
} else if (lowerCaseUrl.startsWith("pcast:")) {
|
||||||
Log.d(TAG, "Removing pcast:");
|
Log.d(TAG, "Removing pcast:");
|
||||||
return prepareURL(url.substring("pcast:".length()));
|
return prepareUrl(url.substring("pcast:".length()));
|
||||||
} else if (lowerCaseUrl.startsWith("itpc")) {
|
} else if (lowerCaseUrl.startsWith("itpc")) {
|
||||||
Log.d(TAG, "Replacing itpc:// with http://");
|
Log.d(TAG, "Replacing itpc:// with http://");
|
||||||
return prepareURL(url.substring("itpc://".length()));
|
return prepareUrl(url.substring("itpc://".length()));
|
||||||
} else if (lowerCaseUrl.startsWith(AP_SUBSCRIBE)) {
|
} else if (lowerCaseUrl.startsWith(AP_SUBSCRIBE)) {
|
||||||
Log.d(TAG, "Removing antennapod-subscribe://");
|
Log.d(TAG, "Removing antennapod-subscribe://");
|
||||||
return prepareURL(url.substring(AP_SUBSCRIBE.length()));
|
return prepareUrl(url.substring(AP_SUBSCRIBE.length()));
|
||||||
} else if (lowerCaseUrl.contains(AP_SUBSCRIBE_DEEPLINK)) {
|
} else if (lowerCaseUrl.contains(AP_SUBSCRIBE_DEEPLINK)) {
|
||||||
Log.d(TAG, "Removing " + AP_SUBSCRIBE_DEEPLINK);
|
Log.d(TAG, "Removing " + AP_SUBSCRIBE_DEEPLINK);
|
||||||
String removedWebsite = url.substring(url.indexOf("?url=") + "?url=".length());
|
String removedWebsite = url.substring(url.indexOf("?url=") + "?url=".length());
|
||||||
try {
|
try {
|
||||||
return prepareURL(URLDecoder.decode(removedWebsite, "UTF-8"));
|
return prepareUrl(URLDecoder.decode(removedWebsite, "UTF-8"));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
return prepareURL(removedWebsite);
|
return prepareUrl(removedWebsite);
|
||||||
}
|
}
|
||||||
} else if (!(lowerCaseUrl.startsWith("http://") || lowerCaseUrl.startsWith("https://"))) {
|
} else if (!(lowerCaseUrl.startsWith("http://") || lowerCaseUrl.startsWith("https://"))) {
|
||||||
Log.d(TAG, "Adding http:// at the beginning of the URL");
|
Log.d(TAG, "Adding http:// at the beginning of the URL");
|
||||||
|
@ -80,18 +81,18 @@ public final class URLChecker {
|
||||||
* the result of prepareURL(url) is returned instead.
|
* the result of prepareURL(url) is returned instead.
|
||||||
* @return The prepared url
|
* @return The prepared url
|
||||||
*/
|
*/
|
||||||
public static String prepareURL(String url, String base) {
|
public static String prepareUrl(String url, String base) {
|
||||||
if (base == null) {
|
if (base == null) {
|
||||||
return prepareURL(url);
|
return prepareUrl(url);
|
||||||
}
|
}
|
||||||
url = url.trim();
|
url = url.trim();
|
||||||
base = prepareURL(base);
|
base = prepareUrl(base);
|
||||||
Uri urlUri = Uri.parse(url);
|
Uri urlUri = Uri.parse(url);
|
||||||
Uri baseUri = Uri.parse(base);
|
Uri baseUri = Uri.parse(base);
|
||||||
if (urlUri.isRelative() && baseUri.isAbsolute()) {
|
if (urlUri.isRelative() && baseUri.isAbsolute()) {
|
||||||
return urlUri.buildUpon().scheme(baseUri.getScheme()).build().toString();
|
return urlUri.buildUpon().scheme(baseUri.getScheme()).build().toString();
|
||||||
} else {
|
} else {
|
||||||
return prepareURL(url);
|
return prepareUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +131,7 @@ public final class URLChecker {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (String string : input) {
|
for (String string : input) {
|
||||||
if (!TextUtils.isEmpty(string)) {
|
if (!TextUtils.isEmpty(string)) {
|
||||||
result.add(string.toLowerCase());
|
result.add(string.toLowerCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.net.common;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -12,107 +12,107 @@ import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for {@link URLChecker}
|
* Test class for {@link UrlChecker}
|
||||||
*/
|
*/
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class URLCheckerTest {
|
public class UrlCheckerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCorrectURLHttp() {
|
public void testCorrectURLHttp() {
|
||||||
final String in = "http://example.com";
|
final String in = "http://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals(in, out);
|
assertEquals(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCorrectURLHttps() {
|
public void testCorrectURLHttps() {
|
||||||
final String in = "https://example.com";
|
final String in = "https://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals(in, out);
|
assertEquals(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingProtocol() {
|
public void testMissingProtocol() {
|
||||||
final String in = "example.com";
|
final String in = "example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFeedProtocol() {
|
public void testFeedProtocol() {
|
||||||
final String in = "feed://example.com";
|
final String in = "feed://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPcastProtocolNoScheme() {
|
public void testPcastProtocolNoScheme() {
|
||||||
final String in = "pcast://example.com";
|
final String in = "pcast://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testItpcProtocol() {
|
public void testItpcProtocol() {
|
||||||
final String in = "itpc://example.com";
|
final String in = "itpc://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testItpcProtocolWithScheme() {
|
public void testItpcProtocolWithScheme() {
|
||||||
final String in = "itpc://https://example.com";
|
final String in = "itpc://https://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("https://example.com", out);
|
assertEquals("https://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhiteSpaceUrlShouldNotAppend() {
|
public void testWhiteSpaceUrlShouldNotAppend() {
|
||||||
final String in = "\n http://example.com \t";
|
final String in = "\n http://example.com \t";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhiteSpaceShouldAppend() {
|
public void testWhiteSpaceShouldAppend() {
|
||||||
final String in = "\n example.com \t";
|
final String in = "\n example.com \t";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAntennaPodSubscribeProtocolNoScheme() {
|
public void testAntennaPodSubscribeProtocolNoScheme() {
|
||||||
final String in = "antennapod-subscribe://example.com";
|
final String in = "antennapod-subscribe://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPcastProtocolWithScheme() {
|
public void testPcastProtocolWithScheme() {
|
||||||
final String in = "pcast://https://example.com";
|
final String in = "pcast://https://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("https://example.com", out);
|
assertEquals("https://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAntennaPodSubscribeProtocolWithScheme() {
|
public void testAntennaPodSubscribeProtocolWithScheme() {
|
||||||
final String in = "antennapod-subscribe://https://example.com";
|
final String in = "antennapod-subscribe://https://example.com";
|
||||||
final String out = URLChecker.prepareURL(in);
|
final String out = UrlChecker.prepareUrl(in);
|
||||||
assertEquals("https://example.com", out);
|
assertEquals("https://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAntennaPodSubscribeDeeplink() throws UnsupportedEncodingException {
|
public void testAntennaPodSubscribeDeeplink() throws UnsupportedEncodingException {
|
||||||
final String feed = "http://example.org/podcast.rss";
|
final String feed = "http://example.org/podcast.rss";
|
||||||
assertEquals(feed, URLChecker.prepareURL("https://antennapod.org/deeplink/subscribe?url=" + feed));
|
assertEquals(feed, UrlChecker.prepareUrl("https://antennapod.org/deeplink/subscribe?url=" + feed));
|
||||||
assertEquals(feed, URLChecker.prepareURL("http://antennapod.org/deeplink/subscribe?url=" + feed));
|
assertEquals(feed, UrlChecker.prepareUrl("http://antennapod.org/deeplink/subscribe?url=" + feed));
|
||||||
assertEquals(feed, URLChecker.prepareURL("http://antennapod.org/deeplink/subscribe/?url=" + feed));
|
assertEquals(feed, UrlChecker.prepareUrl("http://antennapod.org/deeplink/subscribe/?url=" + feed));
|
||||||
assertEquals(feed, URLChecker.prepareURL("https://www.antennapod.org/deeplink/subscribe?url=" + feed));
|
assertEquals(feed, UrlChecker.prepareUrl("https://www.antennapod.org/deeplink/subscribe?url=" + feed));
|
||||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe?url=" + feed));
|
assertEquals(feed, UrlChecker.prepareUrl("http://www.antennapod.org/deeplink/subscribe?url=" + feed));
|
||||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe/?url=" + feed));
|
assertEquals(feed, UrlChecker.prepareUrl("http://www.antennapod.org/deeplink/subscribe/?url=" + feed));
|
||||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe?url="
|
assertEquals(feed, UrlChecker.prepareUrl("http://www.antennapod.org/deeplink/subscribe?url="
|
||||||
+ URLEncoder.encode(feed, "UTF-8")));
|
+ URLEncoder.encode(feed, "UTF-8")));
|
||||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe?url="
|
assertEquals(feed, UrlChecker.prepareUrl("http://www.antennapod.org/deeplink/subscribe?url="
|
||||||
+ "example.org/podcast.rss"));
|
+ "example.org/podcast.rss"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class URLCheckerTest {
|
||||||
public void testProtocolRelativeUrlIsAbsolute() {
|
public void testProtocolRelativeUrlIsAbsolute() {
|
||||||
final String in = "https://example.com";
|
final String in = "https://example.com";
|
||||||
final String inBase = "http://examplebase.com";
|
final String inBase = "http://examplebase.com";
|
||||||
final String out = URLChecker.prepareURL(in, inBase);
|
final String out = UrlChecker.prepareUrl(in, inBase);
|
||||||
assertEquals(in, out);
|
assertEquals(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class URLCheckerTest {
|
||||||
public void testProtocolRelativeUrlIsRelativeHttps() {
|
public void testProtocolRelativeUrlIsRelativeHttps() {
|
||||||
final String in = "//example.com";
|
final String in = "//example.com";
|
||||||
final String inBase = "https://examplebase.com";
|
final String inBase = "https://examplebase.com";
|
||||||
final String out = URLChecker.prepareURL(in, inBase);
|
final String out = UrlChecker.prepareUrl(in, inBase);
|
||||||
assertEquals("https://example.com", out);
|
assertEquals("https://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,40 +136,40 @@ public class URLCheckerTest {
|
||||||
public void testProtocolRelativeUrlIsHttpsWithApSubscribeProtocol() {
|
public void testProtocolRelativeUrlIsHttpsWithApSubscribeProtocol() {
|
||||||
final String in = "//example.com";
|
final String in = "//example.com";
|
||||||
final String inBase = "antennapod-subscribe://https://examplebase.com";
|
final String inBase = "antennapod-subscribe://https://examplebase.com";
|
||||||
final String out = URLChecker.prepareURL(in, inBase);
|
final String out = UrlChecker.prepareUrl(in, inBase);
|
||||||
assertEquals("https://example.com", out);
|
assertEquals("https://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProtocolRelativeUrlBaseUrlNull() {
|
public void testProtocolRelativeUrlBaseUrlNull() {
|
||||||
final String in = "example.com";
|
final String in = "example.com";
|
||||||
final String out = URLChecker.prepareURL(in, null);
|
final String out = UrlChecker.prepareUrl(in, null);
|
||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUrlEqualsSame() {
|
public void testUrlEqualsSame() {
|
||||||
assertTrue(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.com/test"));
|
assertTrue(UrlChecker.urlEquals("https://www.example.com/test", "https://www.example.com/test"));
|
||||||
assertTrue(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.com/test/"));
|
assertTrue(UrlChecker.urlEquals("https://www.example.com/test", "https://www.example.com/test/"));
|
||||||
assertTrue(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.com//test"));
|
assertTrue(UrlChecker.urlEquals("https://www.example.com/test", "https://www.example.com//test"));
|
||||||
assertTrue(URLChecker.urlEquals("https://www.example.com", "https://www.example.com/"));
|
assertTrue(UrlChecker.urlEquals("https://www.example.com", "https://www.example.com/"));
|
||||||
assertTrue(URLChecker.urlEquals("https://www.example.com", "http://www.example.com"));
|
assertTrue(UrlChecker.urlEquals("https://www.example.com", "http://www.example.com"));
|
||||||
assertTrue(URLChecker.urlEquals("http://www.example.com/", "https://www.example.com/"));
|
assertTrue(UrlChecker.urlEquals("http://www.example.com/", "https://www.example.com/"));
|
||||||
assertTrue(URLChecker.urlEquals("https://www.example.com/?id=42", "https://www.example.com/?id=42"));
|
assertTrue(UrlChecker.urlEquals("https://www.example.com/?id=42", "https://www.example.com/?id=42"));
|
||||||
assertTrue(URLChecker.urlEquals("https://example.com/podcast%20test", "https://example.com/podcast test"));
|
assertTrue(UrlChecker.urlEquals("https://example.com/podcast%20test", "https://example.com/podcast test"));
|
||||||
assertTrue(URLChecker.urlEquals("https://example.com/?a=podcast%20test", "https://example.com/?a=podcast test"));
|
assertTrue(UrlChecker.urlEquals("https://example.com/?a=podcast%20test", "https://example.com/?a=podcast test"));
|
||||||
assertTrue(URLChecker.urlEquals("https://example.com/?", "https://example.com/"));
|
assertTrue(UrlChecker.urlEquals("https://example.com/?", "https://example.com/"));
|
||||||
assertTrue(URLChecker.urlEquals("https://example.com/?", "https://example.com"));
|
assertTrue(UrlChecker.urlEquals("https://example.com/?", "https://example.com"));
|
||||||
assertTrue(URLChecker.urlEquals("https://Example.com", "https://example.com"));
|
assertTrue(UrlChecker.urlEquals("https://Example.com", "https://example.com"));
|
||||||
assertTrue(URLChecker.urlEquals("https://example.com/test", "https://example.com/Test"));
|
assertTrue(UrlChecker.urlEquals("https://example.com/test", "https://example.com/Test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUrlEqualsDifferent() {
|
public void testUrlEqualsDifferent() {
|
||||||
assertFalse(URLChecker.urlEquals("https://www.example.com/test", "https://www.example2.com/test"));
|
assertFalse(UrlChecker.urlEquals("https://www.example.com/test", "https://www.example2.com/test"));
|
||||||
assertFalse(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.de/test"));
|
assertFalse(UrlChecker.urlEquals("https://www.example.com/test", "https://www.example.de/test"));
|
||||||
assertFalse(URLChecker.urlEquals("https://example.com/", "https://otherpodcast.example.com/"));
|
assertFalse(UrlChecker.urlEquals("https://example.com/", "https://otherpodcast.example.com/"));
|
||||||
assertFalse(URLChecker.urlEquals("https://www.example.com/?id=42&a=b", "https://www.example.com/?id=43&a=b"));
|
assertFalse(UrlChecker.urlEquals("https://www.example.com/?id=42&a=b", "https://www.example.com/?id=43&a=b"));
|
||||||
assertFalse(URLChecker.urlEquals("https://example.com/podcast%25test", "https://example.com/podcast test"));
|
assertFalse(UrlChecker.urlEquals("https://example.com/podcast%25test", "https://example.com/podcast test"));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
# :net:download
|
||||||
|
|
||||||
|
This folder contains the download service and its interface.
|
|
@ -0,0 +1,3 @@
|
||||||
|
# :net:download:service-interface
|
||||||
|
|
||||||
|
Interface of the download service. Enables other modules to call the download service without actually depending on the implementation.
|
|
@ -0,0 +1,21 @@
|
||||||
|
plugins {
|
||||||
|
id("com.android.library")
|
||||||
|
id("java-test-fixtures")
|
||||||
|
}
|
||||||
|
apply from: "../../../common.gradle"
|
||||||
|
|
||||||
|
android {
|
||||||
|
lintOptions {
|
||||||
|
disable 'ParcelClassLoader'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':model')
|
||||||
|
implementation project(':net:common')
|
||||||
|
|
||||||
|
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||||
|
|
||||||
|
testImplementation "junit:junit:$junitVersion"
|
||||||
|
testImplementation "org.robolectric:robolectric:$robolectricVersion"
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<manifest package="de.danoeh.antennapod.net.download.serviceinterface" />
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.service.download;
|
package de.danoeh.antennapod.net.download.serviceinterface;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
@ -9,7 +9,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.core.util.URLChecker;
|
import de.danoeh.antennapod.net.common.UrlChecker;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
|
|
||||||
public class DownloadRequest implements Parcelable {
|
public class DownloadRequest implements Parcelable {
|
||||||
|
@ -276,7 +276,7 @@ public class DownloadRequest implements Parcelable {
|
||||||
|
|
||||||
public Builder(@NonNull String destination, @NonNull FeedMedia media) {
|
public Builder(@NonNull String destination, @NonNull FeedMedia media) {
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.source = URLChecker.prepareURL(media.getDownload_url());
|
this.source = UrlChecker.prepareUrl(media.getDownload_url());
|
||||||
this.title = media.getHumanReadableIdentifier();
|
this.title = media.getHumanReadableIdentifier();
|
||||||
this.feedfileId = media.getId();
|
this.feedfileId = media.getId();
|
||||||
this.feedfileType = media.getTypeAsInt();
|
this.feedfileType = media.getTypeAsInt();
|
||||||
|
@ -284,7 +284,7 @@ public class DownloadRequest implements Parcelable {
|
||||||
|
|
||||||
public Builder(@NonNull String destination, @NonNull Feed feed) {
|
public Builder(@NonNull String destination, @NonNull Feed feed) {
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.source = feed.isLocalFeed() ? feed.getDownload_url() : URLChecker.prepareURL(feed.getDownload_url());
|
this.source = feed.isLocalFeed() ? feed.getDownload_url() : UrlChecker.prepareUrl(feed.getDownload_url());
|
||||||
this.title = feed.getHumanReadableIdentifier();
|
this.title = feed.getHumanReadableIdentifier();
|
||||||
this.feedfileId = feed.getId();
|
this.feedfileId = feed.getId();
|
||||||
this.feedfileType = feed.getTypeAsInt();
|
this.feedfileType = feed.getTypeAsInt();
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.service.download;
|
package de.danoeh.antennapod.net.download.serviceinterface;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.service.download;
|
package de.danoeh.antennapod.net.download.serviceinterface;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.service.download;
|
package de.danoeh.antennapod.net.download.serviceinterface;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
|
@ -3,7 +3,9 @@ include ':core'
|
||||||
include ':event'
|
include ':event'
|
||||||
include ':model'
|
include ':model'
|
||||||
|
|
||||||
|
include ':net:common'
|
||||||
include ':net:discovery'
|
include ':net:discovery'
|
||||||
|
include ':net:download:service-interface'
|
||||||
include ':net:ssl'
|
include ':net:ssl'
|
||||||
include ':net:sync:gpoddernet'
|
include ':net:sync:gpoddernet'
|
||||||
include ':net:sync:model'
|
include ':net:sync:model'
|
||||||
|
|
Loading…
Reference in New Issue