mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-10-29 11:49:33 +00:00
Fix legacy sync queue state if a feed is both added and removed (#7768)
This commit is contained in:
parent
1e6fb8fc46
commit
a244fe0897
@ -201,6 +201,9 @@ public class SyncService extends Worker {
|
||||
.uploadSubscriptionChanges(queuedAddedFeeds, queuedRemovedFeeds);
|
||||
synchronizationQueueStorage.clearFeedQueues();
|
||||
newTimeStamp = uploadResponse.timestamp;
|
||||
} catch (SyncServiceException exception) {
|
||||
synchronizationQueueStorage.removeLegacyConflictingFeedEntries(localSubscriptions);
|
||||
throw exception;
|
||||
} finally {
|
||||
LockingAsyncExecutor.unlock();
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.storage.preferences.SynchronizationSettings;
|
||||
|
||||
@ -109,6 +111,22 @@ public class SynchronizationQueueStorage {
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove feed entries that conflict with the given list of current local subscriptions.
|
||||
* <>
|
||||
* This is only relevant for old clients that have legacy data. In newer versions, `enqueueFeedAdded`
|
||||
* and `enqueueFeedAdded` already take care of removing conflicting entries.
|
||||
* */
|
||||
protected void removeLegacyConflictingFeedEntries(Collection<String> currentLocalSubscriptions) {
|
||||
List<String> removedQueue = this.getQueuedRemovedFeeds();
|
||||
List<String> addedQueue = this.getQueuedAddedFeeds();
|
||||
removedQueue.removeAll(currentLocalSubscriptions);
|
||||
addedQueue.removeAll(removedQueue);
|
||||
sharedPreferences.edit()
|
||||
.putString(QUEUED_FEEDS_ADDED, addedQueue.toString())
|
||||
.putString(QUEUED_FEEDS_REMOVED, removedQueue.toString())
|
||||
.apply();
|
||||
}
|
||||
|
||||
protected void enqueueFeedRemoved(String downloadUrl) {
|
||||
SharedPreferences sharedPreferences = getSharedPreferences();
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user