/* ownCloud Android client application
- * Copyright (C) 2012-2013 ownCloud Inc.
+ * Copyright (C) 2012-2014 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.Log_OC;
/** 'True' means that the remote folder changed from last synchronization and should be fetched */
private boolean mRemoteFolderChanged;
+ /** 'True' means that Etag will be ignored */
+ private boolean mIgnoreETag;
+
/**
* Creates a new instance of {@link SynchronizeFolderOperation}.
long currentSyncTime,
boolean syncFullAccount,
boolean isShareSupported,
+ boolean ignoreETag,
FileDataStorageManager dataStorageManager,
Account account,
Context context ) {
mContext = context;
mForgottenLocalFiles = new HashMap<String, String>();
mRemoteFolderChanged = false;
+ mIgnoreETag = ignoreETag;
}
private RemoteOperationResult checkForChanges(OwnCloudClient client) {
- mRemoteFolderChanged = false;
+ mRemoteFolderChanged = true;
RemoteOperationResult result = null;
String remotePath = null;
result = operation.execute(client);
if (result.isSuccess()){
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
-
- // check if remote and local folder are different
- mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
-
+
+ if (!mIgnoreETag) {
+ // check if remote and local folder are different
+ mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
+ }
+
result = new RemoteOperationResult(ResultCode.OK);
Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " + (mRemoteFolderChanged ? "changed" : "not changed"));
if (remoteFile.keepInSync()) {
SynchronizeFileOperation operation = new SynchronizeFileOperation( localFile,
remoteFile,
- mStorageManager,
- mAccount,
+ mAccount,
true,
mContext
);
+
filesToSyncContents.add(operation);
}
private void startContentSynchronizations(List<SynchronizeFileOperation> filesToSyncContents, OwnCloudClient client) {
RemoteOperationResult contentsResult = null;
for (SynchronizeFileOperation op: filesToSyncContents) {
- contentsResult = op.execute(client); // returns without waiting for upload or download finishes
+ contentsResult = op.execute(mStorageManager, mContext); // returns without waiting for upload or download finishes
if (!contentsResult.isSuccess()) {
if (contentsResult.getCode() == ResultCode.SYNC_CONFLICT) {
mConflictsFound++;
file.setMimetype(remote.getMimeType());
file.setModificationTimestamp(remote.getModifiedTimestamp());
file.setEtag(remote.getEtag());
+ file.setPermissions(remote.getPermissions());
+ file.setRemoteId(remote.getRemoteId());
return file;
}