X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d25af7eea587e0112d3baeac6faf3c8321439aae..9aab2d26da38f26e7ff03a0b5db3bd01b51bce05:/src/com/owncloud/android/syncadapter/FileSyncAdapter.java diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 3763908a..ea833d49 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -28,9 +28,15 @@ import com.owncloud.android.R; import com.owncloud.android.datamodel.DataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; +//<<<<<<< HEAD import com.owncloud.android.operations.RemoteOperationResult; import com.owncloud.android.operations.SynchronizeFolderOperation; import com.owncloud.android.operations.UpdateOCVersionOperation; +/*======= +import com.owncloud.android.files.services.FileDownloader; +import com.owncloud.android.files.services.FileObserverService; +import com.owncloud.android.utils.OwnCloudVersion; +>>>>>>> origin/master*/ import android.accounts.Account; import android.app.Notification; @@ -83,7 +89,9 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { mFailedResultsCounter = 0; mLastFailedResult = null; mSyncResult = syncResult; - + mSyncResult.fullSyncRequested = false; + mSyncResult.delayUntil = 60*60*24; // sync after 24h + this.setAccount(account); this.setContentProvider(provider); this.setStorageManager(new FileDataStorageManager(account, getContentProvider())); @@ -185,6 +193,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { List children = synchFolderOp.getChildren(); fetchChildren(children); // beware of the 'hidden' recursion here! +//<<<<<<< HEAD } else { if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED) { mSyncResult.stats.numAuthExceptions++; @@ -194,6 +203,32 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { } else if (result.getException() instanceof IOException) { mSyncResult.stats.numIoExceptions++; +/*======= + // insertion or update of files + List updatedFiles = new Vector(resp.getResponses().length - 1); + for (int i = 1; i < resp.getResponses().length; ++i) { + WebdavEntry we = new WebdavEntry(resp.getResponses()[i], getUri().getPath()); + OCFile file = fillOCFile(we); + file.setParentId(parentId); + if (getStorageManager().getFileByPath(file.getRemotePath()) != null && + getStorageManager().getFileByPath(file.getRemotePath()).keepInSync() && + file.getModificationTimestamp() > getStorageManager().getFileByPath(file.getRemotePath()) + .getModificationTimestamp()) { + // first disable observer so we won't get file upload right after download + Log.d(TAG, "Disabling observation of remote file" + file.getRemotePath()); + Intent intent = new Intent(getContext(), FileObserverService.class); + intent.putExtra(FileObserverService.KEY_FILE_CMD, FileObserverService.CMD_ADD_DOWNLOADING_FILE); + intent.putExtra(FileObserverService.KEY_CMD_ARG, file.getRemotePath()); + getContext().startService(intent); + intent = new Intent(this.getContext(), FileDownloader.class); + intent.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount()); + intent.putExtra(FileDownloader.EXTRA_FILE, file); + file.setKeepInSync(true); + getContext().startService(intent); + } + if (getStorageManager().getFileByPath(file.getRemotePath()) != null) + file.setKeepInSync(getStorageManager().getFileByPath(file.getRemotePath()).keepInSync()); +>>>>>>> origin/master*/ } mFailedResultsCounter++;