mirror of
https://github.com/etesync/android
synced 2025-07-04 13:52:40 +00:00
Sync manager: deal with FIXMEs.
This commit is contained in:
parent
c58ae8fb1c
commit
4008776812
@ -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
|
* @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 boolean prepare() throws ContactsStorageException, CalendarStorageException;
|
||||||
|
|
||||||
abstract protected void processSyncEntry(SyncEntry cEntry) throws IOException, ContactsStorageException, CalendarStorageException, InvalidCalendarException;
|
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 {
|
protected void pushEntries() throws Exceptions.HttpException, IOException, ContactsStorageException, CalendarStorageException {
|
||||||
// upload dirty contacts
|
// upload dirty contacts
|
||||||
// FIXME: Deal with failure
|
// FIXME: Deal with failure (someone else uploaded before we go here)
|
||||||
if (!localEntries.isEmpty()) {
|
if (!localEntries.isEmpty()) {
|
||||||
journal.putEntries(localEntries, remoteCTag);
|
journal.putEntries(localEntries, remoteCTag);
|
||||||
|
|
||||||
@ -288,7 +291,6 @@ abstract public class SyncManager {
|
|||||||
localEntries.add(previousEntry);
|
localEntries.add(previousEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
for (LocalResource local : localCollection.getDirty()) {
|
for (LocalResource local : localCollection.getDirty()) {
|
||||||
SyncEntry.Actions action;
|
SyncEntry.Actions action;
|
||||||
if (local.isLocalOnly()) {
|
if (local.isLocalOnly()) {
|
||||||
@ -303,10 +305,6 @@ abstract public class SyncManager {
|
|||||||
previousEntry = tmp;
|
previousEntry = tmp;
|
||||||
localEntries.add(previousEntry);
|
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.
|
* Checks Thread.interrupted() before each request to allow quick sync cancellation.
|
||||||
*/
|
*/
|
||||||
protected List<LocalResource> processLocallyDeleted() throws CalendarStorageException, ContactsStorageException {
|
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();
|
LocalResource[] localList = localCollection.getDeleted();
|
||||||
List<LocalResource> ret = new ArrayList<>(localList.length);
|
List<LocalResource> ret = new ArrayList<>(localList.length);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user