mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-10-29 03:36:21 +00:00
Remove SPA importer (#7814)
This commit is contained in:
parent
a977b44f7a
commit
49e6da6727
@ -273,14 +273,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".spa.SPAReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="de.danoeh.antennapdsp.intent.SP_APPS_QUERY_FEEDS_RESPONSE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<provider
|
||||
android:authorities="@string/provider_authority"
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
|
||||
@ -6,7 +6,6 @@ import android.util.Log;
|
||||
|
||||
import com.google.android.material.color.DynamicColors;
|
||||
|
||||
import de.danoeh.antennapod.spa.SPAUtil;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.EventBusException;
|
||||
|
||||
@ -45,6 +44,5 @@ public class PodcastApp extends Application {
|
||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
||||
ClientConfigurator.initialize(this);
|
||||
PreferenceUpgrader.checkUpgrades(this);
|
||||
SPAUtil.sendSPAppsQueryFeedsIntent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
package de.danoeh.antennapod.spa;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.ClientConfigurator;
|
||||
import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager;
|
||||
import de.danoeh.antennapod.storage.database.FeedDatabaseWriter;
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
|
||||
/**
|
||||
* Receives intents from AntennaPod Single Purpose apps
|
||||
*/
|
||||
public class SPAReceiver extends BroadcastReceiver{
|
||||
private static final String TAG = "SPAReceiver";
|
||||
|
||||
public static final String ACTION_SP_APPS_QUERY_FEEDS = "de.danoeh.antennapdsp.intent.SP_APPS_QUERY_FEEDS";
|
||||
private static final String ACTION_SP_APPS_QUERY_FEEDS_REPSONSE = "de.danoeh.antennapdsp.intent.SP_APPS_QUERY_FEEDS_RESPONSE";
|
||||
private static final String ACTION_SP_APPS_QUERY_FEEDS_REPSONSE_FEEDS_EXTRA = "feeds";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (!TextUtils.equals(intent.getAction(), ACTION_SP_APPS_QUERY_FEEDS_REPSONSE)) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "Received SP_APPS_QUERY_RESPONSE");
|
||||
if (!intent.hasExtra(ACTION_SP_APPS_QUERY_FEEDS_REPSONSE_FEEDS_EXTRA)) {
|
||||
Log.e(TAG, "Received invalid SP_APPS_QUERY_RESPONSE: Contains no extra");
|
||||
return;
|
||||
}
|
||||
String[] feedUrls = intent.getStringArrayExtra(ACTION_SP_APPS_QUERY_FEEDS_REPSONSE_FEEDS_EXTRA);
|
||||
if (feedUrls == null) {
|
||||
Log.e(TAG, "Received invalid SP_APPS_QUERY_REPSONSE: extra was null");
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "Received feeds list: " + Arrays.toString(feedUrls));
|
||||
ClientConfigurator.initialize(context);
|
||||
for (String url : feedUrls) {
|
||||
Feed feed = new Feed(url, null, "Unknown podcast");
|
||||
feed.setItems(Collections.emptyList());
|
||||
FeedDatabaseWriter.updateFeed(context, feed, false);
|
||||
}
|
||||
Toast.makeText(context, R.string.sp_apps_importing_feeds_msg, Toast.LENGTH_LONG).show();
|
||||
FeedUpdateManager.getInstance().runOnce(context);
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
package de.danoeh.antennapod.spa;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
|
||||
/**
|
||||
* Provides methods related to AntennaPodSP (https://github.com/danieloeh/AntennaPodSP)
|
||||
*/
|
||||
public class SPAUtil {
|
||||
private static final String TAG = "SPAUtil";
|
||||
|
||||
private static final String PREF_HAS_QUERIED_SP_APPS = "prefSPAUtil.hasQueriedSPApps";
|
||||
|
||||
private SPAUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an ACTION_SP_APPS_QUERY_FEEDS intent to all AntennaPod Single Purpose apps.
|
||||
* The receiving single purpose apps will then send their feeds back to AntennaPod via an
|
||||
* ACTION_SP_APPS_QUERY_FEEDS_RESPONSE intent.
|
||||
* This intent will only be sent once.
|
||||
*
|
||||
* @return True if an intent was sent, false otherwise (for example if the intent has already been
|
||||
* sent before.
|
||||
*/
|
||||
public static synchronized boolean sendSPAppsQueryFeedsIntent(Context context) {
|
||||
assert context != null : "context = null";
|
||||
final Context appContext = context.getApplicationContext();
|
||||
if (appContext == null) {
|
||||
Log.wtf(TAG, "Unable to get application context");
|
||||
return false;
|
||||
}
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
|
||||
if (!prefs.getBoolean(PREF_HAS_QUERIED_SP_APPS, false)) {
|
||||
appContext.sendBroadcast(new Intent(SPAReceiver.ACTION_SP_APPS_QUERY_FEEDS));
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Sending SP_APPS_QUERY_FEEDS intent");
|
||||
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, true);
|
||||
editor.apply();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,16 +11,16 @@
|
||||
<suppress checks="." files="[\\/].idea[\\/]"/>
|
||||
|
||||
<!-- Legacy code, should be gradually updated when touching these lines anyway -->
|
||||
<suppress checks="LineLength" files="(VolumeAdaptionSettingTest.java|DBUpgrader.java|PlaybackServiceMediaPlayer.java|PlaybackService.java|LocalPSMP.java|PlaybackServiceTaskManager.java|DBWriter.java|PodcastSearchResult.java|PlaybackServiceTaskManagerTest.java|HTTPBin.java|SPAReceiver.java|UriUtil.java|FeedDiscovererTest.java|PlaybackServiceMediaPlayerTest.java|UITestUtils.java)"/>
|
||||
<suppress checks="LineLength" files="(VolumeAdaptionSettingTest.java|DBUpgrader.java|PlaybackServiceMediaPlayer.java|PlaybackService.java|LocalPSMP.java|PlaybackServiceTaskManager.java|DBWriter.java|PodcastSearchResult.java|PlaybackServiceTaskManagerTest.java|HTTPBin.java|UriUtil.java|FeedDiscovererTest.java|PlaybackServiceMediaPlayerTest.java|UITestUtils.java)"/>
|
||||
<suppress checks="VariableDeclarationUsageDistance" files="(FeedFilterTest.java|ChapterReader.java|FastBlurTransformation.java|PreferencesTest.java|ItemFilterDialog.java|PlaybackServiceMediaPlayerTest.java)"/>
|
||||
<suppress checks="WhitespaceAround" files="(LongList.java|IntentUtils.java|PlaybackServiceMediaPlayer.java|ShakeListener.java|LocalPSMP.java|PodcastSearchResult.java|UITestUtils.java|SPAReceiver.java|SkipIntroEndingChangedEvent.java|PlaybackController.java)"/>
|
||||
<suppress checks="WhitespaceAround" files="(LongList.java|IntentUtils.java|PlaybackServiceMediaPlayer.java|ShakeListener.java|LocalPSMP.java|PodcastSearchResult.java|UITestUtils.java|SkipIntroEndingChangedEvent.java|PlaybackController.java)"/>
|
||||
<suppress checks="WhitespaceAfter" files="(LongList.java|IntentUtils.java|TimeSpeedConverter.java|LocalPSMP.java|PlaybackController.java|PodcastSearchResult.java)"/>
|
||||
<suppress checks="AbbreviationAsWordInName" files="(FeedItemPermutorsTest.java|DBUpgrader.java|PodDBAdapter.java|DBWriter.java|DBReader.java|RewindAfterPauseUtilTest.java|PlaybackServiceMediaPlayer.java|PlaybackService.java|LocalPSMP.java|PlaybackServiceTaskManager.java|GpodnetUploadChangesResponse.java|GpodnetEpisodeActionPostResponse.java|UrlCheckerTest.java|UriUtilTest.java|UriUtil.java|PlaybackServiceTaskManagerTest.java|SPAUtil.java|FeedDiscovererTest.java|PlaybackServiceMediaPlayerTest.java|DefaultPSMPCallback.java|UITestUtils.java|APCleanupAlgorithmTest.java|APNullCleanupAlgorithm.java|APCleanupAlgorithm.java|HTTPBin.java|UITestUtilsTest.java|FeedDiscoverer.java|SPAReceiver.java|APQueueCleanupAlgorithm.java|CancelablePSMPCallback.java)"/>
|
||||
<suppress checks="NeedBraces" files="(PlaybackServiceMediaPlayerTest.java|FeedPreferences.java|DownloadRequest.java|HTTPBin.java|UITestUtils.java|SPAUtil.java)"/>
|
||||
<suppress checks="AbbreviationAsWordInName" files="(FeedItemPermutorsTest.java|DBUpgrader.java|PodDBAdapter.java|DBWriter.java|DBReader.java|RewindAfterPauseUtilTest.java|PlaybackServiceMediaPlayer.java|PlaybackService.java|LocalPSMP.java|PlaybackServiceTaskManager.java|GpodnetUploadChangesResponse.java|GpodnetEpisodeActionPostResponse.java|UrlCheckerTest.java|UriUtilTest.java|UriUtil.java|PlaybackServiceTaskManagerTest.java|FeedDiscovererTest.java|PlaybackServiceMediaPlayerTest.java|DefaultPSMPCallback.java|UITestUtils.java|APCleanupAlgorithmTest.java|APNullCleanupAlgorithm.java|APCleanupAlgorithm.java|HTTPBin.java|UITestUtilsTest.java|FeedDiscoverer.java|APQueueCleanupAlgorithm.java|CancelablePSMPCallback.java)"/>
|
||||
<suppress checks="NeedBraces" files="(PlaybackServiceMediaPlayerTest.java|FeedPreferences.java|DownloadRequest.java|HTTPBin.java|UITestUtils.java)"/>
|
||||
<suppress checks="NonEmptyAtclauseDescription" files="(FeedFilter.java|AspectRatioVideoView.java|Playable.java|PlaybackServiceTaskManager.java|PodcastSearchResult.java|OpmlBackupAgent.java)"/>
|
||||
<suppress checks="OperatorWrapCheck" files="(Atom.java|DBUpgrader.java|PodDBAdapter.java|PlaybackController.java|GpodnetUploadChangesResponse.java|HtmlToPlainText.java|PodcastSearchResult.java|PowerConnectionReceiver.java|FeedDiscoverer.java|PlaybackService.java)"/>
|
||||
<suppress checks="JavadocParagraph" files="(FeedItemPermutors.java|HtmlToPlainText.java|FeedItemMenuHandler.java|RewindAfterPauseUtils.java|PlaybackServiceMediaPlayer.java|UITestUtils.java|NestedScrollableHost.java|PlaybackService.java)"/>
|
||||
<suppress checks="JavadocTagContinuationIndentation" files="(LongList.java|DBReader.java|LocalPSMP.java|GpodnetService.java|FeedDiscoverer.java|SPAUtil.java|PlaybackServiceMediaPlayer.java)"/>
|
||||
<suppress checks="JavadocTagContinuationIndentation" files="(LongList.java|DBReader.java|LocalPSMP.java|GpodnetService.java|FeedDiscoverer.java|PlaybackServiceMediaPlayer.java)"/>
|
||||
<suppress checks="MemberName" files="(OpmlBackupAgent.java|ShakeListener.java|PlaybackController.java|AspectRatioVideoView.java|PlaybackService.java|PlaybackServiceMediaPlayerTest.java)"/>
|
||||
<suppress checks="LocalVariableName" files="(ShakeListener.java|ItemEnqueuePositionCalculatorTest.java)"/>
|
||||
</suppressions>
|
||||
|
||||
@ -811,9 +811,6 @@
|
||||
<string name="release_schedule_saturday">Sat</string>
|
||||
<string name="release_schedule_sunday">Sun</string>
|
||||
|
||||
<!-- AntennaPodSP -->
|
||||
<string name="sp_apps_importing_feeds_msg">Importing subscriptions from single-purpose apps…</string>
|
||||
|
||||
<!-- Add podcast fragment -->
|
||||
<string name="search_podcast_hint">Search podcast…</string>
|
||||
<string name="search_itunes_label">Search Apple Podcasts</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user