1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Sync manager: deal with FIXMEs.

This commit is contained in:
Tom Hacohen 2017-02-14 15:04:19 +00:00
parent c58ae8fb1c
commit 4008776812

View File

@ -221,9 +221,12 @@ abstract public class SyncManager {
}
/** Prepares synchronization (for instance, allocates necessary resources).
/**
* Prepares synchronization (for instance, allocates necessary resources).
*
* @return whether actual synchronization is required / can be made. true = synchronization
* shall be continued, false = synchronization can be skipped */
* shall be continued, false = synchronization can be skipped
*/
abstract protected boolean prepare() throws ContactsStorageException, CalendarStorageException;
abstract protected void processSyncEntry(SyncEntry cEntry) throws IOException, ContactsStorageException, CalendarStorageException, InvalidCalendarException;
@ -257,7 +260,7 @@ abstract public class SyncManager {
protected void pushEntries() throws Exceptions.HttpException, IOException, ContactsStorageException, CalendarStorageException {
// upload dirty contacts
// FIXME: Deal with failure
// FIXME: Deal with failure (someone else uploaded before we go here)
if (!localEntries.isEmpty()) {
journal.putEntries(localEntries, remoteCTag);
@ -288,7 +291,6 @@ abstract public class SyncManager {
localEntries.add(previousEntry);
}
try {
for (LocalResource local : localCollection.getDirty()) {
SyncEntry.Actions action;
if (local.isLocalOnly()) {
@ -303,10 +305,6 @@ abstract public class SyncManager {
previousEntry = tmp;
localEntries.add(previousEntry);
}
} catch (FileNotFoundException e) {
// FIXME: Do something
e.printStackTrace();
}
}
/**
@ -332,9 +330,6 @@ abstract public class SyncManager {
* Checks Thread.interrupted() before each request to allow quick sync cancellation.
*/
protected List<LocalResource> processLocallyDeleted() throws CalendarStorageException, ContactsStorageException {
// FIXME: This needs refactoring and fixing, it's just not true.
// Remove locally deleted entries from server (if they have a name, i.e. if they were uploaded before),
// but only if they don't have changed on the server. Then finally remove them from the local address book.
LocalResource[] localList = localCollection.getDeleted();
List<LocalResource> ret = new ArrayList<>(localList.length);