diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-05 20:08:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 20:08:25 +0200 |
commit | 687db0f5ed13ab0ee4e3a9c09f85359d987a13c0 (patch) | |
tree | 0c2894e2a4abaec08eef2d6e2fd8047127a05d57 | |
parent | b6a4049ff4a792cbed826320064ccca72fc3e6e5 (diff) | |
download | AntennaPod-687db0f5ed13ab0ee4e3a9c09f85359d987a13c0.zip |
Merge :net:sync:model and :net:sync:service-interface (#7063)
41 files changed, 107 insertions, 138 deletions
diff --git a/app/build.gradle b/app/build.gradle index b96b96677..4de998537 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,7 +70,6 @@ dependencies { implementation project(':net:download:service') implementation project(':net:ssl') implementation project(':net:sync:service') - implementation project(':net:sync:model') implementation project(':parser:feed') implementation project(':playback:base') implementation project(':playback:cast') diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java index 55f865ef6..e1974940c 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java @@ -27,7 +27,7 @@ import de.danoeh.antennapod.ui.share.ShareUtils; import de.danoeh.antennapod.ui.share.ShareDialog; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.ui.appstartintent.MediaButtonStarter; import de.danoeh.antennapod.ui.view.LocalDeleteModal; diff --git a/net/download/service/build.gradle b/net/download/service/build.gradle index f74550c05..cebffc75c 100644 --- a/net/download/service/build.gradle +++ b/net/download/service/build.gradle @@ -14,7 +14,6 @@ dependencies { implementation project(':model') implementation project(':net:common') implementation project(':net:download:service-interface') - implementation project(':net:sync:model') implementation project(':net:sync:service-interface') implementation project(':parser:media') implementation project(':parser:feed') diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java index 6ed16aa80..406149100 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java @@ -23,7 +23,7 @@ import de.danoeh.antennapod.storage.database.DBWriter; import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; /** * Handles a completed media download. diff --git a/net/sync/gpoddernet/build.gradle b/net/sync/gpoddernet/build.gradle index ff1fc2f00..3eec12b58 100644 --- a/net/sync/gpoddernet/build.gradle +++ b/net/sync/gpoddernet/build.gradle @@ -8,7 +8,7 @@ android { } dependencies { - implementation project(':net:sync:model') + implementation project(':net:sync:service-interface') annotationProcessor "androidx.annotation:annotation:$annotationVersion" implementation "androidx.appcompat:appcompat:$appcompatVersion" 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 c65e654aa..b04e9bdc9 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 @@ -5,6 +5,12 @@ import android.util.Log; import androidx.annotation.NonNull; import de.danoeh.antennapod.net.sync.HostnameParser; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeActionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.ISyncService; +import de.danoeh.antennapod.net.sync.serviceinterface.SubscriptionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.SyncServiceException; +import de.danoeh.antennapod.net.sync.serviceinterface.UploadChangesResponse; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -27,12 +33,6 @@ import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetDevice; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetEpisodeActionPostResponse; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetUploadChangesResponse; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; -import de.danoeh.antennapod.net.sync.model.EpisodeActionChanges; -import de.danoeh.antennapod.net.sync.model.ISyncService; -import de.danoeh.antennapod.net.sync.model.SubscriptionChanges; -import de.danoeh.antennapod.net.sync.model.SyncServiceException; -import de.danoeh.antennapod.net.sync.model.UploadChangesResponse; import okhttp3.Credentials; import okhttp3.MediaType; import okhttp3.OkHttpClient; diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetServiceException.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetServiceException.java index 298c59073..5f16afbd1 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetServiceException.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetServiceException.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.net.sync.gpoddernet; -import de.danoeh.antennapod.net.sync.model.SyncServiceException; +import de.danoeh.antennapod.net.sync.serviceinterface.SyncServiceException; public class GpodnetServiceException extends SyncServiceException { private static final long serialVersionUID = 1L; diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/mapper/ResponseMapper.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/mapper/ResponseMapper.java index c8e607d74..2d2409eac 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/mapper/ResponseMapper.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/mapper/ResponseMapper.java @@ -2,6 +2,9 @@ package de.danoeh.antennapod.net.sync.gpoddernet.mapper; import androidx.annotation.NonNull; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeActionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.SubscriptionChanges; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -10,10 +13,6 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; -import de.danoeh.antennapod.net.sync.model.EpisodeActionChanges; -import de.danoeh.antennapod.net.sync.model.SubscriptionChanges; - public class ResponseMapper { public static SubscriptionChanges readSubscriptionChangesFromJsonObject(@NonNull JSONObject object) diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetEpisodeActionPostResponse.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetEpisodeActionPostResponse.java index 6d573ebfc..74e77ff44 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetEpisodeActionPostResponse.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetEpisodeActionPostResponse.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.net.sync.gpoddernet.model; import androidx.collection.ArrayMap; -import de.danoeh.antennapod.net.sync.model.UploadChangesResponse; +import de.danoeh.antennapod.net.sync.serviceinterface.UploadChangesResponse; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.json.JSONArray; diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetUploadChangesResponse.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetUploadChangesResponse.java index 7b09531a5..7d3f36fe4 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetUploadChangesResponse.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetUploadChangesResponse.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.net.sync.gpoddernet.model; import androidx.collection.ArrayMap; import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService; -import de.danoeh.antennapod.net.sync.model.UploadChangesResponse; +import de.danoeh.antennapod.net.sync.serviceinterface.UploadChangesResponse; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSyncService.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSyncService.java index eaee76baf..e98976c81 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSyncService.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSyncService.java @@ -3,12 +3,12 @@ package de.danoeh.antennapod.net.sync.nextcloud; import de.danoeh.antennapod.net.sync.HostnameParser; import de.danoeh.antennapod.net.sync.gpoddernet.mapper.ResponseMapper; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetUploadChangesResponse; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; -import de.danoeh.antennapod.net.sync.model.EpisodeActionChanges; -import de.danoeh.antennapod.net.sync.model.ISyncService; -import de.danoeh.antennapod.net.sync.model.SubscriptionChanges; -import de.danoeh.antennapod.net.sync.model.SyncServiceException; -import de.danoeh.antennapod.net.sync.model.UploadChangesResponse; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeActionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.ISyncService; +import de.danoeh.antennapod.net.sync.serviceinterface.SubscriptionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.SyncServiceException; +import de.danoeh.antennapod.net.sync.serviceinterface.UploadChangesResponse; import okhttp3.Credentials; import okhttp3.HttpUrl; import okhttp3.MediaType; diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSynchronizationServiceException.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSynchronizationServiceException.java index d907c229e..db66abce6 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSynchronizationServiceException.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudSynchronizationServiceException.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.net.sync.nextcloud; -import de.danoeh.antennapod.net.sync.model.SyncServiceException; +import de.danoeh.antennapod.net.sync.serviceinterface.SyncServiceException; public class NextcloudSynchronizationServiceException extends SyncServiceException { public NextcloudSynchronizationServiceException(Throwable e) { diff --git a/net/sync/model/README.md b/net/sync/model/README.md deleted file mode 100644 index 21d842914..000000000 --- a/net/sync/model/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# :net:sync:model - -This module contains the basic interfaces for implementing a sync backend. diff --git a/net/sync/model/build.gradle b/net/sync/model/build.gradle deleted file mode 100644 index 8520b0a49..000000000 --- a/net/sync/model/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - id("com.android.library") -} -apply from: "../../../common.gradle" - -android { - namespace "de.danoeh.antennapod.net.sync.model" -} - -dependencies { - implementation project(':model') - - annotationProcessor "androidx.annotation:annotation:$annotationVersion" -} diff --git a/net/sync/service-interface/build.gradle b/net/sync/service-interface/build.gradle index c1a559da3..fd170b36a 100644 --- a/net/sync/service-interface/build.gradle +++ b/net/sync/service-interface/build.gradle @@ -9,9 +9,7 @@ android { dependencies { implementation project(':model') - implementation project(':net:sync:model') implementation project(':storage:preferences') - implementation project(':ui:i18n') annotationProcessor "androidx.annotation:annotation:$annotationVersion" implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion" diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeAction.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeAction.java index 0efa2b847..3c3bd1418 100644 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeAction.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeAction.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.net.sync.model; +package de.danoeh.antennapod.net.sync.serviceinterface; import android.text.TextUtils; import android.util.Log; diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeActionChanges.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeActionChanges.java index 570e012c5..d2b17b492 100644 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeActionChanges.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeActionChanges.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.net.sync.model; +package de.danoeh.antennapod.net.sync.serviceinterface; import androidx.annotation.NonNull; diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/ISyncService.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/ISyncService.java index 9c75e5dac..29632ed1e 100644 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/ISyncService.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/ISyncService.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.net.sync.model; +package de.danoeh.antennapod.net.sync.serviceinterface; import java.util.List; diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SubscriptionChanges.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SubscriptionChanges.java index 2fbc8b45e..c0c9f131d 100644 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SubscriptionChanges.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SubscriptionChanges.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.net.sync.model; +package de.danoeh.antennapod.net.sync.serviceinterface; import androidx.annotation.NonNull; diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SyncServiceException.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SyncServiceException.java index 57262db17..5ccedd785 100644 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SyncServiceException.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SyncServiceException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.net.sync.model; +package de.danoeh.antennapod.net.sync.serviceinterface; public class SyncServiceException extends Exception { private static final long serialVersionUID = 1L; diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProvider.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProvider.java new file mode 100644 index 000000000..8c4047b6c --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProvider.java @@ -0,0 +1,25 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + +public enum SynchronizationProvider { + GPODDER_NET("GPODDER_NET"), + NEXTCLOUD_GPODDER("NEXTCLOUD_GPODDER"); + + public static SynchronizationProvider fromIdentifier(String provider) { + for (SynchronizationProvider synchronizationProvider : SynchronizationProvider.values()) { + if (synchronizationProvider.getIdentifier().equals(provider)) { + return synchronizationProvider; + } + } + return null; + } + + private final String identifier; + + SynchronizationProvider(String identifier) { + this.identifier = identifier; + } + + public String getIdentifier() { + return identifier; + } +} diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProviderViewData.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProviderViewData.java deleted file mode 100644 index 19624a95a..000000000 --- a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProviderViewData.java +++ /dev/null @@ -1,45 +0,0 @@ -package de.danoeh.antennapod.net.sync.serviceinterface; - -public enum SynchronizationProviderViewData { - GPODDER_NET( - "GPODDER_NET", - R.string.gpodnet_description, - R.drawable.gpodder_icon - ), - NEXTCLOUD_GPODDER( - "NEXTCLOUD_GPODDER", - R.string.synchronization_summary_nextcloud, - R.drawable.nextcloud_logo - ); - - public static SynchronizationProviderViewData fromIdentifier(String provider) { - for (SynchronizationProviderViewData synchronizationProvider : SynchronizationProviderViewData.values()) { - if (synchronizationProvider.getIdentifier().equals(provider)) { - return synchronizationProvider; - } - } - return null; - } - - private final String identifier; - private final int iconResource; - private final int summaryResource; - - SynchronizationProviderViewData(String identifier, int summaryResource, int iconResource) { - this.identifier = identifier; - this.iconResource = iconResource; - this.summaryResource = summaryResource; - } - - public String getIdentifier() { - return identifier; - } - - public int getIconResource() { - return iconResource; - } - - public int getSummaryResource() { - return summaryResource; - } -} diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueSink.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueSink.java index 8c94c44e7..ad235130a 100644 --- a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueSink.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueSink.java @@ -4,7 +4,6 @@ import android.content.Context; import de.danoeh.antennapod.storage.preferences.SynchronizationSettings; import de.danoeh.antennapod.model.feed.FeedMedia; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; public class SynchronizationQueueSink { // To avoid a dependency loop of every class to SyncService, and from SyncService back to every class. diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueStorage.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueStorage.java index 0ae794ac8..55dc07ae8 100644 --- a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueStorage.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationQueueStorage.java @@ -9,7 +9,6 @@ import org.json.JSONException; import java.util.ArrayList; import de.danoeh.antennapod.storage.preferences.SynchronizationSettings; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; public class SynchronizationQueueStorage { diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/UploadChangesResponse.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/UploadChangesResponse.java index 7503f429b..64bddc260 100644 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/UploadChangesResponse.java +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/UploadChangesResponse.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.net.sync.model; +package de.danoeh.antennapod.net.sync.serviceinterface; public abstract class UploadChangesResponse { diff --git a/net/sync/service/build.gradle b/net/sync/service/build.gradle index 7fa19d320..03b81a39c 100644 --- a/net/sync/service/build.gradle +++ b/net/sync/service/build.gradle @@ -13,7 +13,6 @@ dependencies { implementation project(':model') implementation project(':net:common') implementation project(':net:sync:gpoddernet') - implementation project(':net:sync:model') implementation project(':net:sync:service-interface') implementation project(':storage:database') implementation project(':storage:preferences') diff --git a/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilter.java b/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilter.java index 42fc1b7b9..17ea15ae8 100644 --- a/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilter.java +++ b/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilter.java @@ -8,7 +8,7 @@ import androidx.core.util.Pair; import java.util.List; import java.util.Map; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; public class EpisodeActionFilter { diff --git a/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/SyncService.java b/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/SyncService.java index f52c2b81d..97921e7f8 100644 --- a/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/SyncService.java +++ b/net/sync/service/src/main/java/de/danoeh/antennapod/net/sync/service/SyncService.java @@ -29,7 +29,7 @@ import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.model.feed.SortOrder; import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager; import de.danoeh.antennapod.net.sync.serviceinterface.LockingAsyncExecutor; -import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProviderViewData; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProvider; import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueStorage; import de.danoeh.antennapod.storage.database.DBWriter; import de.danoeh.antennapod.storage.database.FeedDatabaseWriter; @@ -55,12 +55,12 @@ import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; -import de.danoeh.antennapod.net.sync.model.EpisodeActionChanges; -import de.danoeh.antennapod.net.sync.model.ISyncService; -import de.danoeh.antennapod.net.sync.model.SubscriptionChanges; -import de.danoeh.antennapod.net.sync.model.SyncServiceException; -import de.danoeh.antennapod.net.sync.model.UploadChangesResponse; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeActionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.ISyncService; +import de.danoeh.antennapod.net.sync.serviceinterface.SubscriptionChanges; +import de.danoeh.antennapod.net.sync.serviceinterface.SyncServiceException; +import de.danoeh.antennapod.net.sync.serviceinterface.UploadChangesResponse; import de.danoeh.antennapod.net.sync.nextcloud.NextcloudSyncService; public class SyncService extends Worker { @@ -369,7 +369,7 @@ public class SyncService extends Worker { private ISyncService getActiveSyncProvider() { String selectedSyncProviderKey = SynchronizationSettings.getSelectedSyncProviderKey(); - SynchronizationProviderViewData selectedService = SynchronizationProviderViewData + SynchronizationProvider selectedService = SynchronizationProvider .fromIdentifier(selectedSyncProviderKey); if (selectedService == null) { return null; diff --git a/net/sync/service-interface/src/main/res/values/ids.xml b/net/sync/service/src/main/res/values/ids.xml index 842e421ea..842e421ea 100644 --- a/net/sync/service-interface/src/main/res/values/ids.xml +++ b/net/sync/service/src/main/res/values/ids.xml diff --git a/net/sync/service/src/test/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilterTest.java b/net/sync/service/src/test/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilterTest.java index 22ea316d4..38f5bdc4a 100644 --- a/net/sync/service/src/test/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilterTest.java +++ b/net/sync/service/src/test/java/de/danoeh/antennapod/net/sync/service/EpisodeActionFilterTest.java @@ -12,7 +12,7 @@ import java.util.Date; import java.util.List; import java.util.Map; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; public class EpisodeActionFilterTest extends TestCase { diff --git a/settings.gradle b/settings.gradle index 184df07f2..8cf8baf3e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,7 +25,6 @@ include ':net:download:service-interface' include ':net:download:service' include ':net:ssl' include ':net:sync:gpoddernet' -include ':net:sync:model' include ':net:sync:service-interface' include ':net:sync:service' diff --git a/storage/database/build.gradle b/storage/database/build.gradle index 60b57828a..60f385505 100644 --- a/storage/database/build.gradle +++ b/storage/database/build.gradle @@ -16,7 +16,6 @@ dependencies { implementation project(':event') implementation project(':model') implementation project(':net:download:service-interface') - implementation project(':net:sync:model') implementation project(':net:sync:service-interface') implementation project(':storage:preferences') implementation project(':ui:app-start-intent') diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBWriter.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBWriter.java index 3866b7ec1..a9c4f4dc3 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBWriter.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/DBWriter.java @@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.event.FavoritesEvent; import de.danoeh.antennapod.event.FeedItemEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent; -import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.event.playback.PlaybackHistoryEvent; import de.danoeh.antennapod.event.QueueEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; @@ -50,7 +49,7 @@ import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.SortOrder; import de.danoeh.antennapod.model.playback.Playable; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; /** * Provides methods for writing data to AntennaPod's database. @@ -114,8 +113,7 @@ public class DBWriter { // Local feed DocumentFile documentFile = DocumentFile.fromSingleUri(context, Uri.parse(media.getLocalFileUrl())); if (documentFile == null || !documentFile.exists() || !documentFile.delete()) { - EventBus.getDefault().post(new MessageEvent(context.getString(R.string.delete_local_failed))); - return false; + Log.d(TAG, "Deletion of local file failed."); } media.setLocalFileUrl(null); localDelete = true; @@ -123,9 +121,7 @@ public class DBWriter { // delete downloaded media file File mediaFile = new File(media.getLocalFileUrl()); if (mediaFile.exists() && !mediaFile.delete()) { - MessageEvent evt = new MessageEvent(context.getString(R.string.delete_failed)); - EventBus.getDefault().post(evt); - return false; + Log.d(TAG, "Deletion of downloaded file failed."); } media.setDownloaded(false); media.setLocalFileUrl(null); diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/FeedDatabaseWriter.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/FeedDatabaseWriter.java index 6429c3cb5..0a61007aa 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/FeedDatabaseWriter.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/FeedDatabaseWriter.java @@ -11,7 +11,7 @@ import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.SortOrder; -import de.danoeh.antennapod.net.sync.model.EpisodeAction; +import de.danoeh.antennapod.net.sync.serviceinterface.EpisodeAction; import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink; import de.danoeh.antennapod.storage.preferences.UserPreferences; import org.greenrobot.eventbus.EventBus; diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index 8b7f8b9ea..6242d229f 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -218,8 +218,6 @@ <string name="pause_label">Pause</string> <string name="stream_label">Stream</string> <string name="delete_label">Delete</string> - <string name="delete_failed">Unable to delete file. Rebooting the device could help.</string> - <string name="delete_local_failed">Unable to delete file. Try re-connecting the local folder from the podcast info screen.</string> <string name="delete_episode_label">Delete episode</string> <plurals name="deleted_multi_episode_batch_label"> <item quantity="one">1 downloaded episode deleted.</item> diff --git a/ui/preferences/build.gradle b/ui/preferences/build.gradle index eb595da58..fd9684e56 100644 --- a/ui/preferences/build.gradle +++ b/ui/preferences/build.gradle @@ -25,7 +25,6 @@ android { dependencies { implementation project(":event") implementation project(":net:common") - implementation project(":net:sync:model") implementation project(":net:sync:gpoddernet") implementation project(":storage:preferences") implementation project(":storage:importexport") diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/GpodderAuthenticationFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/GpodderAuthenticationFragment.java index 204287207..a2f210f2e 100644 --- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/GpodderAuthenticationFragment.java +++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/GpodderAuthenticationFragment.java @@ -20,7 +20,7 @@ import androidx.fragment.app.DialogFragment; import com.google.android.material.button.MaterialButton; import de.danoeh.antennapod.net.common.AntennapodHttpClient; import de.danoeh.antennapod.net.sync.service.SyncService; -import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProviderViewData; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProvider; import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink; import de.danoeh.antennapod.storage.preferences.SynchronizationCredentials; import de.danoeh.antennapod.storage.preferences.SynchronizationSettings; @@ -257,7 +257,7 @@ public class GpodderAuthenticationFragment extends DialogFragment { throw new IllegalStateException("Device must not be null here"); } else { SynchronizationSettings.setSelectedSyncProvider( - SynchronizationProviderViewData.GPODDER_NET.getIdentifier()); + SynchronizationProvider.GPODDER_NET.getIdentifier()); SynchronizationCredentials.setUsername(username); SynchronizationCredentials.setPassword(password); SynchronizationCredentials.setDeviceId(selectedDevice.getId()); diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java index c503ccef1..5df85efe2 100644 --- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java +++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java @@ -10,7 +10,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import de.danoeh.antennapod.net.common.AntennapodHttpClient; import de.danoeh.antennapod.net.sync.service.SyncService; -import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProviderViewData; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProvider; import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink; import de.danoeh.antennapod.storage.preferences.SynchronizationCredentials; import de.danoeh.antennapod.storage.preferences.SynchronizationSettings; @@ -89,7 +89,7 @@ public class NextcloudAuthenticationFragment extends DialogFragment @Override public void onNextcloudAuthenticated(String server, String username, String password) { SynchronizationSettings.setSelectedSyncProvider( - SynchronizationProviderViewData.NEXTCLOUD_GPODDER.getIdentifier()); + SynchronizationProvider.NEXTCLOUD_GPODDER.getIdentifier()); SynchronizationCredentials.clear(); SynchronizationQueueSink.clearQueue(getContext()); SynchronizationCredentials.setPassword(password); diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/SynchronizationPreferencesFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/SynchronizationPreferencesFragment.java index c8c993cbc..709f3e43b 100644 --- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/SynchronizationPreferencesFragment.java +++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/SynchronizationPreferencesFragment.java @@ -12,7 +12,9 @@ import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.TextView; +import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; +import androidx.annotation.StringRes; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.text.HtmlCompat; @@ -22,7 +24,7 @@ import androidx.preference.PreferenceFragmentCompat; import com.google.android.material.snackbar.Snackbar; import de.danoeh.antennapod.net.sync.service.SyncService; -import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProviderViewData; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationProvider; import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink; import de.danoeh.antennapod.ui.preferences.R; import org.greenrobot.eventbus.EventBus; @@ -114,11 +116,11 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat final boolean loggedIn = SynchronizationSettings.isProviderConnected(); Preference preferenceHeader = findPreference(PREFERENCE_SYNCHRONIZATION_DESCRIPTION); if (loggedIn) { - SynchronizationProviderViewData selectedProvider = - SynchronizationProviderViewData.fromIdentifier(getSelectedSyncProviderKey()); + SynchronizationProvider selectedProvider = + SynchronizationProvider.fromIdentifier(getSelectedSyncProviderKey()); preferenceHeader.setTitle(""); - preferenceHeader.setSummary(selectedProvider.getSummaryResource()); - preferenceHeader.setIcon(selectedProvider.getIconResource()); + preferenceHeader.setSummary(getProviderSummary(selectedProvider)); + preferenceHeader.setIcon(getProviderIcon(selectedProvider)); preferenceHeader.setOnPreferenceClickListener(null); } else { preferenceHeader.setTitle(R.string.synchronization_choose_title); @@ -131,7 +133,7 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat } Preference gpodnetSetLoginPreference = findPreference(PREFERENCE_GPODNET_SETLOGIN_INFORMATION); - gpodnetSetLoginPreference.setVisible(isProviderSelected(SynchronizationProviderViewData.GPODDER_NET)); + gpodnetSetLoginPreference.setVisible(isProviderSelected(SynchronizationProvider.GPODDER_NET)); gpodnetSetLoginPreference.setEnabled(loggedIn); findPreference(PREFERENCE_SYNC).setEnabled(loggedIn); findPreference(PREFERENCE_FORCE_FULL_SYNC).setEnabled(loggedIn); @@ -153,9 +155,8 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle(R.string.dialog_choose_sync_service_title); - SynchronizationProviderViewData[] providers = SynchronizationProviderViewData.values(); - ListAdapter adapter = new ArrayAdapter<SynchronizationProviderViewData>( - getContext(), R.layout.alertdialog_sync_provider_chooser, providers) { + SynchronizationProvider[] providers = SynchronizationProvider.values(); + ListAdapter adapter = new ArrayAdapter<>(getContext(), R.layout.alertdialog_sync_provider_chooser, providers) { ViewHolder holder; @@ -177,9 +178,9 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat } else { holder = (ViewHolder) convertView.getTag(); } - SynchronizationProviderViewData synchronizationProviderViewData = getItem(position); - holder.title.setText(synchronizationProviderViewData.getSummaryResource()); - holder.icon.setImageResource(synchronizationProviderViewData.getIconResource()); + SynchronizationProvider synchronizationProvider = getItem(position); + holder.title.setText(getProviderSummary(synchronizationProvider)); + holder.icon.setImageResource(getProviderIcon(synchronizationProvider)); return convertView; } }; @@ -203,7 +204,7 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat builder.show(); } - private boolean isProviderSelected(@NonNull SynchronizationProviderViewData provider) { + private boolean isProviderSelected(@NonNull SynchronizationProvider provider) { String selectedSyncProviderKey = getSelectedSyncProviderKey(); return provider.getIdentifier().equals(selectedSyncProviderKey); } @@ -219,4 +220,26 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat lastTime, DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, DateUtils.FORMAT_SHOW_TIME)); ((AppCompatActivity) getActivity()).getSupportActionBar().setSubtitle(status); } + + private @StringRes int getProviderSummary(SynchronizationProvider provider) { + switch (provider) { + case GPODDER_NET: + return R.string.gpodnet_description; + case NEXTCLOUD_GPODDER: + return R.string.synchronization_summary_nextcloud; + default: + return R.string.sync_status_error; + } + } + + private @DrawableRes int getProviderIcon(SynchronizationProvider provider) { + switch (provider) { + case GPODDER_NET: + return R.drawable.gpodder_icon; + case NEXTCLOUD_GPODDER: + return R.drawable.nextcloud_logo; + default: + return R.drawable.ic_error; + } + } } diff --git a/net/sync/service-interface/src/main/res/drawable-nodpi/gpodder_icon.png b/ui/preferences/src/main/res/drawable-nodpi/gpodder_icon.png Binary files differindex cd133aa98..cd133aa98 100644 --- a/net/sync/service-interface/src/main/res/drawable-nodpi/gpodder_icon.png +++ b/ui/preferences/src/main/res/drawable-nodpi/gpodder_icon.png diff --git a/net/sync/service-interface/src/main/res/drawable-nodpi/nextcloud_logo.png b/ui/preferences/src/main/res/drawable-nodpi/nextcloud_logo.png Binary files differindex 2164e37fb..2164e37fb 100644 --- a/net/sync/service-interface/src/main/res/drawable-nodpi/nextcloud_logo.png +++ b/ui/preferences/src/main/res/drawable-nodpi/nextcloud_logo.png |