X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/06d5cc94778ee4fe5ec49cd9061c039283ea7cdc..6b84d83b3544f8de4e56186f6ecbccd3d612702b:/src/com/owncloud/android/operations/RefreshFolderOperation.java diff --git a/src/com/owncloud/android/operations/RefreshFolderOperation.java b/src/com/owncloud/android/operations/RefreshFolderOperation.java index 251409a8..977f72a8 100644 --- a/src/com/owncloud/android/operations/RefreshFolderOperation.java +++ b/src/com/owncloud/android/operations/RefreshFolderOperation.java @@ -201,7 +201,8 @@ public class RefreshFolderOperation extends RemoteOperation { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { - mChildren = mStorageManager.getFolderContent(mLocalFolder); + // TODO Enable when "On Device" is recovered ? + mChildren = mStorageManager.getFolderContent(mLocalFolder/*, false*/); } } @@ -228,7 +229,7 @@ public class RefreshFolderOperation extends RemoteOperation { private void updateOCVersion(OwnCloudClient client) { UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext); - RemoteOperationResult result = update.execute(client, MainApp.getUserAgent()); + RemoteOperationResult result = update.execute(client); if (result.isSuccess()) { mIsShareSupported = update.getOCVersion().isSharedSupported(); } @@ -245,14 +246,20 @@ public class RefreshFolderOperation extends RemoteOperation { // remote request ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath); - result = operation.execute(client, MainApp.getUserAgent()); + result = operation.execute(client); if (result.isSuccess()){ OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0)); if (!mIgnoreETag) { // check if remote and local folder are different - mRemoteFolderChanged = - !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag())); + String remoteFolderETag = remoteFolder.getEtag(); + if (remoteFolderETag != null) { + mRemoteFolderChanged = + !(remoteFolderETag.equalsIgnoreCase(mLocalFolder.getEtag())); + } else { + Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + " : " + + "No ETag received from server"); + } } result = new RemoteOperationResult(ResultCode.OK); @@ -281,7 +288,7 @@ public class RefreshFolderOperation extends RemoteOperation { private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) { String remotePath = mLocalFolder.getRemotePath(); ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath); - RemoteOperationResult result = operation.execute(client, MainApp.getUserAgent()); + RemoteOperationResult result = operation.execute(client); Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath); if (result.isSuccess()) { @@ -341,7 +348,8 @@ public class RefreshFolderOperation extends RemoteOperation { List filesToSyncContents = new Vector(); // get current data about local contents of the folder to synchronize - List localFiles = mStorageManager.getFolderContent(mLocalFolder); + // TODO Enable when "On Device" is recovered ? + List localFiles = mStorageManager.getFolderContent(mLocalFolder/*, false*/); Map localFilesMap = new HashMap(localFiles.size()); for (OCFile file : localFiles) { localFilesMap.put(file.getRemotePath(), file); @@ -363,7 +371,7 @@ public class RefreshFolderOperation extends RemoteOperation { if (localFile != null) { // some properties of local state are kept unmodified remoteFile.setFileId(localFile.getFileId()); - remoteFile.setKeepInSync(localFile.keepInSync()); + remoteFile.setFavorite(localFile.isFavorite()); remoteFile.setLastSyncDateForData(localFile.getLastSyncDateForData()); remoteFile.setModificationTimestampAtLastSyncForData( localFile.getModificationTimestampAtLastSyncForData() @@ -395,7 +403,7 @@ public class RefreshFolderOperation extends RemoteOperation { searchForLocalFileInDefaultPath(remoteFile); // legacy /// prepare content synchronization for kept-in-sync files - if (remoteFile.keepInSync()) { + if (remoteFile.isFavorite()) { SynchronizeFileOperation operation = new SynchronizeFileOperation( localFile, remoteFile, mAccount, @@ -549,7 +557,7 @@ public class RefreshFolderOperation extends RemoteOperation { // remote request GetRemoteSharesForFileOperation operation = new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true); - result = operation.execute(client, MainApp.getUserAgent()); + result = operation.execute(client); if (result.isSuccess()) { // update local database