Only sync episode state after feeds have been persisted
This commit is contained in:
parent
b036c461da
commit
6498eed95c
|
@ -111,12 +111,17 @@ public class GpodnetSyncService extends Service {
|
|||
stopSelf();
|
||||
return;
|
||||
}
|
||||
boolean initialSync = GpodnetPreferences.getLastSubscriptionSyncTimestamp() == 0 &&
|
||||
GpodnetPreferences.getLastEpisodeActionsSyncTimestamp() == 0;
|
||||
if(syncSubscriptions) {
|
||||
syncSubscriptionChanges();
|
||||
syncSubscriptions = false;
|
||||
}
|
||||
if(syncActions) {
|
||||
syncEpisodeActions();
|
||||
// we only sync episode actions after the subscriptions have been added to the database
|
||||
if(!initialSync) {
|
||||
syncEpisodeActions();
|
||||
}
|
||||
syncActions = false;
|
||||
}
|
||||
stopSelf();
|
||||
|
|
|
@ -61,6 +61,7 @@ import de.danoeh.antennapod.core.gpoddernet.model.GpodnetEpisodeAction;
|
|||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetEpisodeAction.Action;
|
||||
import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.GpodnetSyncService;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
@ -318,6 +319,14 @@ public class DownloadService extends Service {
|
|||
cancelNotificationUpdater();
|
||||
unregisterReceiver(cancelDownloadReceiver);
|
||||
|
||||
// if this was the initial gpodder sync, i.e. we just synced the feeds successfully,
|
||||
// it is now time to sync the episode actions
|
||||
if(GpodnetPreferences.loggedIn() &&
|
||||
GpodnetPreferences.getLastSubscriptionSyncTimestamp() > 0 &&
|
||||
GpodnetPreferences.getLastEpisodeActionsSyncTimestamp() == 0) {
|
||||
GpodnetSyncService.sendSyncActionsIntent(this);
|
||||
}
|
||||
|
||||
// start auto download in case anything new has shown up
|
||||
DBTasks.autodownloadUndownloadedItems(getApplicationContext());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue