From 687db0f5ed13ab0ee4e3a9c09f85359d987a13c0 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 5 Apr 2024 20:08:25 +0200 Subject: Merge :net:sync:model and :net:sync:service-interface (#7063) --- net/sync/gpoddernet/build.gradle | 2 +- .../net/sync/gpoddernet/GpodnetService.java | 12 +- .../sync/gpoddernet/GpodnetServiceException.java | 2 +- .../net/sync/gpoddernet/mapper/ResponseMapper.java | 7 +- .../model/GpodnetEpisodeActionPostResponse.java | 2 +- .../model/GpodnetUploadChangesResponse.java | 2 +- .../net/sync/nextcloud/NextcloudSyncService.java | 12 +- .../NextcloudSynchronizationServiceException.java | 2 +- net/sync/model/README.md | 3 - net/sync/model/build.gradle | 14 - .../antennapod/net/sync/model/EpisodeAction.java | 293 --------------------- .../net/sync/model/EpisodeActionChanges.java | 34 --- .../antennapod/net/sync/model/ISyncService.java | 20 -- .../net/sync/model/SubscriptionChanges.java | 39 --- .../net/sync/model/SyncServiceException.java | 13 - .../net/sync/model/UploadChangesResponse.java | 13 - net/sync/service-interface/build.gradle | 2 - .../net/sync/serviceinterface/EpisodeAction.java | 293 +++++++++++++++++++++ .../serviceinterface/EpisodeActionChanges.java | 34 +++ .../net/sync/serviceinterface/ISyncService.java | 20 ++ .../sync/serviceinterface/SubscriptionChanges.java | 39 +++ .../serviceinterface/SyncServiceException.java | 13 + .../serviceinterface/SynchronizationProvider.java | 25 ++ .../SynchronizationProviderViewData.java | 45 ---- .../serviceinterface/SynchronizationQueueSink.java | 1 - .../SynchronizationQueueStorage.java | 1 - .../serviceinterface/UploadChangesResponse.java | 13 + .../src/main/res/drawable-nodpi/gpodder_icon.png | Bin 32098 -> 0 bytes .../src/main/res/drawable-nodpi/nextcloud_logo.png | Bin 3432 -> 0 bytes .../service-interface/src/main/res/values/ids.xml | 5 - net/sync/service/build.gradle | 1 - .../net/sync/service/EpisodeActionFilter.java | 2 +- .../antennapod/net/sync/service/SyncService.java | 16 +- net/sync/service/src/main/res/values/ids.xml | 5 + .../net/sync/service/EpisodeActionFilterTest.java | 2 +- 35 files changed, 472 insertions(+), 515 deletions(-) delete mode 100644 net/sync/model/README.md delete mode 100644 net/sync/model/build.gradle delete mode 100644 net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeAction.java delete mode 100644 net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeActionChanges.java delete mode 100644 net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/ISyncService.java delete mode 100644 net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SubscriptionChanges.java delete mode 100644 net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SyncServiceException.java delete mode 100644 net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/UploadChangesResponse.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeAction.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeActionChanges.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/ISyncService.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SubscriptionChanges.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SyncServiceException.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProvider.java delete mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SynchronizationProviderViewData.java create mode 100644 net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/UploadChangesResponse.java delete mode 100644 net/sync/service-interface/src/main/res/drawable-nodpi/gpodder_icon.png delete mode 100644 net/sync/service-interface/src/main/res/drawable-nodpi/nextcloud_logo.png delete mode 100644 net/sync/service-interface/src/main/res/values/ids.xml create mode 100644 net/sync/service/src/main/res/values/ids.xml (limited to 'net/sync') 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/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeAction.java b/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeAction.java deleted file mode 100644 index 0efa2b847..000000000 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeAction.java +++ /dev/null @@ -1,293 +0,0 @@ -package de.danoeh.antennapod.net.sync.model; - -import android.text.TextUtils; -import android.util.Log; - -import androidx.annotation.NonNull; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.Objects; -import java.util.TimeZone; - -import de.danoeh.antennapod.model.feed.FeedItem; - -public class EpisodeAction { - private static final String TAG = "EpisodeAction"; - private static final String PATTERN_ISO_DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss"; - public static final Action NEW = Action.NEW; - public static final Action DOWNLOAD = Action.DOWNLOAD; - public static final Action PLAY = Action.PLAY; - public static final Action DELETE = Action.DELETE; - - private final String podcast; - private final String episode; - private final String guid; - private final Action action; - private final Date timestamp; - private final int started; - private final int position; - private final int total; - - private EpisodeAction(Builder builder) { - this.podcast = builder.podcast; - this.episode = builder.episode; - this.guid = builder.guid; - this.action = builder.action; - this.timestamp = builder.timestamp; - this.started = builder.started; - this.position = builder.position; - this.total = builder.total; - } - - /** - * Create an episode action object from JSON representation. Mandatory fields are "podcast", - * "episode" and "action". - * - * @param object JSON representation - * @return episode action object, or null if mandatory values are missing - */ - public static EpisodeAction readFromJsonObject(JSONObject object) { - String podcast = object.optString("podcast", null); - String episode = object.optString("episode", null); - String actionString = object.optString("action", null); - if (TextUtils.isEmpty(podcast) || TextUtils.isEmpty(episode) || TextUtils.isEmpty(actionString)) { - return null; - } - EpisodeAction.Action action; - try { - action = EpisodeAction.Action.valueOf(actionString.toUpperCase(Locale.US)); - } catch (IllegalArgumentException e) { - return null; - } - EpisodeAction.Builder builder = new EpisodeAction.Builder(podcast, episode, action); - String utcTimestamp = object.optString("timestamp", null); - if (!TextUtils.isEmpty(utcTimestamp)) { - try { - SimpleDateFormat parser = new SimpleDateFormat(PATTERN_ISO_DATEFORMAT, Locale.US); - parser.setTimeZone(TimeZone.getTimeZone("UTC")); - builder.timestamp(parser.parse(utcTimestamp)); - } catch (ParseException e) { - e.printStackTrace(); - } - } - String guid = object.optString("guid", null); - if (!TextUtils.isEmpty(guid)) { - builder.guid(guid); - } - if (action == EpisodeAction.Action.PLAY) { - int started = object.optInt("started", -1); - int position = object.optInt("position", -1); - int total = object.optInt("total", -1); - if (started >= 0 && position > 0 && total > 0) { - builder - .started(started) - .position(position) - .total(total); - } - } - return builder.build(); - } - - public String getPodcast() { - return this.podcast; - } - - public String getEpisode() { - return this.episode; - } - - public String getGuid() { - return this.guid; - } - - public Action getAction() { - return this.action; - } - - private String getActionString() { - return this.action.name().toLowerCase(Locale.US); - } - - public Date getTimestamp() { - return this.timestamp; - } - - /** - * Returns the position (in seconds) at which the client started playback. - * - * @return start position (in seconds) - */ - public int getStarted() { - return this.started; - } - - /** - * Returns the position (in seconds) at which the client stopped playback. - * - * @return stop position (in seconds) - */ - public int getPosition() { - return this.position; - } - - /** - * Returns the total length of the file in seconds. - * - * @return total length in seconds - */ - public int getTotal() { - return this.total; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof EpisodeAction)) { - return false; - } - - EpisodeAction that = (EpisodeAction) o; - return started == that.started - && position == that.position - && total == that.total - && action != that.action - && Objects.equals(podcast, that.podcast) - && Objects.equals(episode, that.episode) - && Objects.equals(timestamp, that.timestamp) - && Objects.equals(guid, that.guid); - } - - @Override - public int hashCode() { - int result = podcast != null ? podcast.hashCode() : 0; - result = 31 * result + (episode != null ? episode.hashCode() : 0); - result = 31 * result + (guid != null ? guid.hashCode() : 0); - result = 31 * result + (action != null ? action.hashCode() : 0); - result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); - result = 31 * result + started; - result = 31 * result + position; - result = 31 * result + total; - return result; - } - - /** - * Returns a JSON object representation of this object. - * - * @return JSON object representation, or null if the object is invalid - */ - public JSONObject writeToJsonObject() { - JSONObject obj = new JSONObject(); - try { - obj.putOpt("podcast", this.podcast); - obj.putOpt("episode", this.episode); - obj.putOpt("guid", this.guid); - obj.put("action", this.getActionString()); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US); - formatter.setTimeZone(TimeZone.getTimeZone("UTC")); - obj.put("timestamp", formatter.format(this.timestamp)); - if (this.getAction() == Action.PLAY) { - obj.put("started", this.started); - obj.put("position", this.position); - obj.put("total", this.total); - } - } catch (JSONException e) { - Log.e(TAG, "writeToJSONObject(): " + e.getMessage()); - return null; - } - return obj; - } - - @NonNull - @Override - public String toString() { - return "EpisodeAction{" - + "podcast='" + podcast + '\'' - + ", episode='" + episode + '\'' - + ", guid='" + guid + '\'' - + ", action=" + action - + ", timestamp=" + timestamp - + ", started=" + started - + ", position=" + position - + ", total=" + total - + '}'; - } - - public enum Action { - NEW, DOWNLOAD, PLAY, DELETE - } - - public static class Builder { - - // mandatory - private final String podcast; - private final String episode; - private final Action action; - - // optional - private Date timestamp; - private int started = -1; - private int position = -1; - private int total = -1; - private String guid; - - public Builder(FeedItem item, Action action) { - this(item.getFeed().getDownloadUrl(), item.getMedia().getDownloadUrl(), action); - this.guid(item.getItemIdentifier()); - } - - public Builder(String podcast, String episode, Action action) { - this.podcast = podcast; - this.episode = episode; - this.action = action; - } - - public Builder timestamp(Date timestamp) { - this.timestamp = timestamp; - return this; - } - - public Builder guid(String guid) { - this.guid = guid; - return this; - } - - public Builder currentTimestamp() { - return timestamp(new Date()); - } - - public Builder started(int seconds) { - if (action == Action.PLAY) { - this.started = seconds; - } - return this; - } - - public Builder position(int seconds) { - if (action == Action.PLAY) { - this.position = seconds; - } - return this; - } - - public Builder total(int seconds) { - if (action == Action.PLAY) { - this.total = seconds; - } - return this; - } - - public EpisodeAction build() { - return new EpisodeAction(this); - } - - } - -} diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeActionChanges.java b/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeActionChanges.java deleted file mode 100644 index 570e012c5..000000000 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/EpisodeActionChanges.java +++ /dev/null @@ -1,34 +0,0 @@ -package de.danoeh.antennapod.net.sync.model; - - -import androidx.annotation.NonNull; - -import java.util.List; - -public class EpisodeActionChanges { - - private final List episodeActions; - private final long timestamp; - - public EpisodeActionChanges(@NonNull List episodeActions, long timestamp) { - this.episodeActions = episodeActions; - this.timestamp = timestamp; - } - - public List getEpisodeActions() { - return this.episodeActions; - } - - public long getTimestamp() { - return this.timestamp; - } - - @NonNull - @Override - public String toString() { - return "EpisodeActionGetResponse{" - + "episodeActions=" + episodeActions - + ", timestamp=" + timestamp - + '}'; - } -} diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/ISyncService.java b/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/ISyncService.java deleted file mode 100644 index 9c75e5dac..000000000 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/ISyncService.java +++ /dev/null @@ -1,20 +0,0 @@ -package de.danoeh.antennapod.net.sync.model; - -import java.util.List; - -public interface ISyncService { - - void login() throws SyncServiceException; - - SubscriptionChanges getSubscriptionChanges(long lastSync) throws SyncServiceException; - - UploadChangesResponse uploadSubscriptionChanges( - List addedFeeds, List removedFeeds) throws SyncServiceException; - - EpisodeActionChanges getEpisodeActionChanges(long lastSync) throws SyncServiceException; - - UploadChangesResponse uploadEpisodeActions(List queuedEpisodeActions) - throws SyncServiceException; - - void logout() throws SyncServiceException; -} diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SubscriptionChanges.java b/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SubscriptionChanges.java deleted file mode 100644 index 2fbc8b45e..000000000 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SubscriptionChanges.java +++ /dev/null @@ -1,39 +0,0 @@ -package de.danoeh.antennapod.net.sync.model; - -import androidx.annotation.NonNull; - -import java.util.List; - -public class SubscriptionChanges { - private final List added; - private final List removed; - private final long timestamp; - - public SubscriptionChanges(@NonNull List added, - @NonNull List removed, - long timestamp) { - this.added = added; - this.removed = removed; - this.timestamp = timestamp; - } - - @Override - public String toString() { - return "SubscriptionChange [added=" + added.toString() - + ", removed=" + removed.toString() + ", timestamp=" - + timestamp + "]"; - } - - public List getAdded() { - return added; - } - - public List getRemoved() { - return removed; - } - - public long getTimestamp() { - return timestamp; - } - -} diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SyncServiceException.java b/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SyncServiceException.java deleted file mode 100644 index 57262db17..000000000 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/SyncServiceException.java +++ /dev/null @@ -1,13 +0,0 @@ -package de.danoeh.antennapod.net.sync.model; - -public class SyncServiceException extends Exception { - private static final long serialVersionUID = 1L; - - public SyncServiceException(String message) { - super(message); - } - - public SyncServiceException(Throwable cause) { - super(cause); - } -} diff --git a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/UploadChangesResponse.java b/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/UploadChangesResponse.java deleted file mode 100644 index 7503f429b..000000000 --- a/net/sync/model/src/main/java/de/danoeh/antennapod/net/sync/model/UploadChangesResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package de.danoeh.antennapod.net.sync.model; - -public abstract class UploadChangesResponse { - - /** - * timestamp/ID that can be used for requesting changes since this upload. - */ - public final long timestamp; - - public UploadChangesResponse(long timestamp) { - this.timestamp = timestamp; - } -} 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/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeAction.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeAction.java new file mode 100644 index 000000000..3c3bd1418 --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeAction.java @@ -0,0 +1,293 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + +import android.text.TextUtils; +import android.util.Log; + +import androidx.annotation.NonNull; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.Objects; +import java.util.TimeZone; + +import de.danoeh.antennapod.model.feed.FeedItem; + +public class EpisodeAction { + private static final String TAG = "EpisodeAction"; + private static final String PATTERN_ISO_DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss"; + public static final Action NEW = Action.NEW; + public static final Action DOWNLOAD = Action.DOWNLOAD; + public static final Action PLAY = Action.PLAY; + public static final Action DELETE = Action.DELETE; + + private final String podcast; + private final String episode; + private final String guid; + private final Action action; + private final Date timestamp; + private final int started; + private final int position; + private final int total; + + private EpisodeAction(Builder builder) { + this.podcast = builder.podcast; + this.episode = builder.episode; + this.guid = builder.guid; + this.action = builder.action; + this.timestamp = builder.timestamp; + this.started = builder.started; + this.position = builder.position; + this.total = builder.total; + } + + /** + * Create an episode action object from JSON representation. Mandatory fields are "podcast", + * "episode" and "action". + * + * @param object JSON representation + * @return episode action object, or null if mandatory values are missing + */ + public static EpisodeAction readFromJsonObject(JSONObject object) { + String podcast = object.optString("podcast", null); + String episode = object.optString("episode", null); + String actionString = object.optString("action", null); + if (TextUtils.isEmpty(podcast) || TextUtils.isEmpty(episode) || TextUtils.isEmpty(actionString)) { + return null; + } + EpisodeAction.Action action; + try { + action = EpisodeAction.Action.valueOf(actionString.toUpperCase(Locale.US)); + } catch (IllegalArgumentException e) { + return null; + } + EpisodeAction.Builder builder = new EpisodeAction.Builder(podcast, episode, action); + String utcTimestamp = object.optString("timestamp", null); + if (!TextUtils.isEmpty(utcTimestamp)) { + try { + SimpleDateFormat parser = new SimpleDateFormat(PATTERN_ISO_DATEFORMAT, Locale.US); + parser.setTimeZone(TimeZone.getTimeZone("UTC")); + builder.timestamp(parser.parse(utcTimestamp)); + } catch (ParseException e) { + e.printStackTrace(); + } + } + String guid = object.optString("guid", null); + if (!TextUtils.isEmpty(guid)) { + builder.guid(guid); + } + if (action == EpisodeAction.Action.PLAY) { + int started = object.optInt("started", -1); + int position = object.optInt("position", -1); + int total = object.optInt("total", -1); + if (started >= 0 && position > 0 && total > 0) { + builder + .started(started) + .position(position) + .total(total); + } + } + return builder.build(); + } + + public String getPodcast() { + return this.podcast; + } + + public String getEpisode() { + return this.episode; + } + + public String getGuid() { + return this.guid; + } + + public Action getAction() { + return this.action; + } + + private String getActionString() { + return this.action.name().toLowerCase(Locale.US); + } + + public Date getTimestamp() { + return this.timestamp; + } + + /** + * Returns the position (in seconds) at which the client started playback. + * + * @return start position (in seconds) + */ + public int getStarted() { + return this.started; + } + + /** + * Returns the position (in seconds) at which the client stopped playback. + * + * @return stop position (in seconds) + */ + public int getPosition() { + return this.position; + } + + /** + * Returns the total length of the file in seconds. + * + * @return total length in seconds + */ + public int getTotal() { + return this.total; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EpisodeAction)) { + return false; + } + + EpisodeAction that = (EpisodeAction) o; + return started == that.started + && position == that.position + && total == that.total + && action != that.action + && Objects.equals(podcast, that.podcast) + && Objects.equals(episode, that.episode) + && Objects.equals(timestamp, that.timestamp) + && Objects.equals(guid, that.guid); + } + + @Override + public int hashCode() { + int result = podcast != null ? podcast.hashCode() : 0; + result = 31 * result + (episode != null ? episode.hashCode() : 0); + result = 31 * result + (guid != null ? guid.hashCode() : 0); + result = 31 * result + (action != null ? action.hashCode() : 0); + result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); + result = 31 * result + started; + result = 31 * result + position; + result = 31 * result + total; + return result; + } + + /** + * Returns a JSON object representation of this object. + * + * @return JSON object representation, or null if the object is invalid + */ + public JSONObject writeToJsonObject() { + JSONObject obj = new JSONObject(); + try { + obj.putOpt("podcast", this.podcast); + obj.putOpt("episode", this.episode); + obj.putOpt("guid", this.guid); + obj.put("action", this.getActionString()); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US); + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); + obj.put("timestamp", formatter.format(this.timestamp)); + if (this.getAction() == Action.PLAY) { + obj.put("started", this.started); + obj.put("position", this.position); + obj.put("total", this.total); + } + } catch (JSONException e) { + Log.e(TAG, "writeToJSONObject(): " + e.getMessage()); + return null; + } + return obj; + } + + @NonNull + @Override + public String toString() { + return "EpisodeAction{" + + "podcast='" + podcast + '\'' + + ", episode='" + episode + '\'' + + ", guid='" + guid + '\'' + + ", action=" + action + + ", timestamp=" + timestamp + + ", started=" + started + + ", position=" + position + + ", total=" + total + + '}'; + } + + public enum Action { + NEW, DOWNLOAD, PLAY, DELETE + } + + public static class Builder { + + // mandatory + private final String podcast; + private final String episode; + private final Action action; + + // optional + private Date timestamp; + private int started = -1; + private int position = -1; + private int total = -1; + private String guid; + + public Builder(FeedItem item, Action action) { + this(item.getFeed().getDownloadUrl(), item.getMedia().getDownloadUrl(), action); + this.guid(item.getItemIdentifier()); + } + + public Builder(String podcast, String episode, Action action) { + this.podcast = podcast; + this.episode = episode; + this.action = action; + } + + public Builder timestamp(Date timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder guid(String guid) { + this.guid = guid; + return this; + } + + public Builder currentTimestamp() { + return timestamp(new Date()); + } + + public Builder started(int seconds) { + if (action == Action.PLAY) { + this.started = seconds; + } + return this; + } + + public Builder position(int seconds) { + if (action == Action.PLAY) { + this.position = seconds; + } + return this; + } + + public Builder total(int seconds) { + if (action == Action.PLAY) { + this.total = seconds; + } + return this; + } + + public EpisodeAction build() { + return new EpisodeAction(this); + } + + } + +} diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeActionChanges.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeActionChanges.java new file mode 100644 index 000000000..d2b17b492 --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/EpisodeActionChanges.java @@ -0,0 +1,34 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + + +import androidx.annotation.NonNull; + +import java.util.List; + +public class EpisodeActionChanges { + + private final List episodeActions; + private final long timestamp; + + public EpisodeActionChanges(@NonNull List episodeActions, long timestamp) { + this.episodeActions = episodeActions; + this.timestamp = timestamp; + } + + public List getEpisodeActions() { + return this.episodeActions; + } + + public long getTimestamp() { + return this.timestamp; + } + + @NonNull + @Override + public String toString() { + return "EpisodeActionGetResponse{" + + "episodeActions=" + episodeActions + + ", timestamp=" + timestamp + + '}'; + } +} diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/ISyncService.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/ISyncService.java new file mode 100644 index 000000000..29632ed1e --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/ISyncService.java @@ -0,0 +1,20 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + +import java.util.List; + +public interface ISyncService { + + void login() throws SyncServiceException; + + SubscriptionChanges getSubscriptionChanges(long lastSync) throws SyncServiceException; + + UploadChangesResponse uploadSubscriptionChanges( + List addedFeeds, List removedFeeds) throws SyncServiceException; + + EpisodeActionChanges getEpisodeActionChanges(long lastSync) throws SyncServiceException; + + UploadChangesResponse uploadEpisodeActions(List queuedEpisodeActions) + throws SyncServiceException; + + void logout() throws SyncServiceException; +} diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SubscriptionChanges.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SubscriptionChanges.java new file mode 100644 index 000000000..c0c9f131d --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SubscriptionChanges.java @@ -0,0 +1,39 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + +import androidx.annotation.NonNull; + +import java.util.List; + +public class SubscriptionChanges { + private final List added; + private final List removed; + private final long timestamp; + + public SubscriptionChanges(@NonNull List added, + @NonNull List removed, + long timestamp) { + this.added = added; + this.removed = removed; + this.timestamp = timestamp; + } + + @Override + public String toString() { + return "SubscriptionChange [added=" + added.toString() + + ", removed=" + removed.toString() + ", timestamp=" + + timestamp + "]"; + } + + public List getAdded() { + return added; + } + + public List getRemoved() { + return removed; + } + + public long getTimestamp() { + return timestamp; + } + +} diff --git a/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SyncServiceException.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SyncServiceException.java new file mode 100644 index 000000000..5ccedd785 --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/SyncServiceException.java @@ -0,0 +1,13 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + +public class SyncServiceException extends Exception { + private static final long serialVersionUID = 1L; + + public SyncServiceException(String message) { + super(message); + } + + public SyncServiceException(Throwable cause) { + super(cause); + } +} 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/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/UploadChangesResponse.java b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/UploadChangesResponse.java new file mode 100644 index 000000000..64bddc260 --- /dev/null +++ b/net/sync/service-interface/src/main/java/de/danoeh/antennapod/net/sync/serviceinterface/UploadChangesResponse.java @@ -0,0 +1,13 @@ +package de.danoeh.antennapod.net.sync.serviceinterface; + +public abstract class UploadChangesResponse { + + /** + * timestamp/ID that can be used for requesting changes since this upload. + */ + public final long timestamp; + + public UploadChangesResponse(long timestamp) { + this.timestamp = timestamp; + } +} diff --git a/net/sync/service-interface/src/main/res/drawable-nodpi/gpodder_icon.png b/net/sync/service-interface/src/main/res/drawable-nodpi/gpodder_icon.png deleted file mode 100644 index cd133aa98..000000000 Binary files a/net/sync/service-interface/src/main/res/drawable-nodpi/gpodder_icon.png and /dev/null differ diff --git a/net/sync/service-interface/src/main/res/drawable-nodpi/nextcloud_logo.png b/net/sync/service-interface/src/main/res/drawable-nodpi/nextcloud_logo.png deleted file mode 100644 index 2164e37fb..000000000 Binary files a/net/sync/service-interface/src/main/res/drawable-nodpi/nextcloud_logo.png and /dev/null differ diff --git a/net/sync/service-interface/src/main/res/values/ids.xml b/net/sync/service-interface/src/main/res/values/ids.xml deleted file mode 100644 index 842e421ea..000000000 --- a/net/sync/service-interface/src/main/res/values/ids.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - 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/src/main/res/values/ids.xml b/net/sync/service/src/main/res/values/ids.xml new file mode 100644 index 000000000..842e421ea --- /dev/null +++ b/net/sync/service/src/main/res/values/ids.xml @@ -0,0 +1,5 @@ + + + + + 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 { -- cgit v1.2.3