X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/09a349346c331f88e0e61d9f306d7344dcccbf71..32dadbcc6ca0de9924f216f81c6a124862ab3136:/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 61b13fc8..f9f9e8c9 100644 --- a/src/com/owncloud/android/operations/RefreshFolderOperation.java +++ b/src/com/owncloud/android/operations/RefreshFolderOperation.java @@ -187,6 +187,7 @@ public class RefreshFolderOperation extends RemoteOperation { if (OCFile.ROOT_PATH.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) { updateOCVersion(client); + } result = checkForChanges(client); @@ -196,7 +197,7 @@ public class RefreshFolderOperation extends RemoteOperation { result = fetchAndSyncRemoteFolder(client); } else { fetchFavoritesToSyncFromLocalData(); - mChildren = mStorageManager.getFolderContent(mLocalFolder/*, false*/); + mChildren = mStorageManager.getFolderContent(mLocalFolder, false); } if (result.isSuccess()) { @@ -231,10 +232,24 @@ public class RefreshFolderOperation extends RemoteOperation { RemoteOperationResult result = update.execute(client); if (result.isSuccess()) { mIsShareSupported = update.getOCVersion().isSharedSupported(); + + // Update Capabilities for this account + if (update.getOCVersion().isVersionWithCapabilitiesAPI()) { + updateCapabilities(client); + } else { + Log_OC.d(TAG, "Capabilities API disabled"); + } + } + } + + private void updateCapabilities(OwnCloudClient client){ + GetCapabilitiesOperarion getCapabilities = new GetCapabilitiesOperarion(); + RemoteOperationResult result = getCapabilities.execute(mStorageManager,mContext); + if (!result.isSuccess()){ + Log_OC.w(TAG, "Update Capabilities unsuccessfully"); } } - private RemoteOperationResult checkForChanges(OwnCloudClient client) { mRemoteFolderChanged = true; RemoteOperationResult result = null; @@ -346,8 +361,7 @@ public class RefreshFolderOperation extends RemoteOperation { mFilesToSyncContents.clear(); // get current data about local contents of the folder to synchronize - // TODO Enable when "On Device" is recovered ? - List localFiles = mStorageManager.getFolderContent(mLocalFolder/*, false*/); + List localFiles = mStorageManager.getFolderContent(mLocalFolder, false); Map localFilesMap = new HashMap(localFiles.size()); for (OCFile file : localFiles) { localFilesMap.put(file.getRemotePath(), file); @@ -391,7 +405,8 @@ public class RefreshFolderOperation extends RemoteOperation { Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server"); } updatedFile.setPublicLink(localFile.getPublicLink()); - updatedFile.setShareByLink(localFile.isShareByLink()); + updatedFile.setShareViaLink(localFile.isSharedViaLink()); + updatedFile.setShareWithSharee(localFile.isSharedWithSharee()); updatedFile.setEtagInConflict(localFile.getEtagInConflict()); } else { // remote eTag will not be updated unless file CONTENTS are synchronized @@ -456,12 +471,19 @@ public class RefreshFolderOperation extends RemoteOperation { } + /** + * Syncs the Share resources for the files contained in the folder refreshed (children, not deeper descendants). + * + * @param client Handler of a session with an OC server. + * @return The result of the remote operation retrieving the Share resources in the folder refreshed by + * the operation. + */ private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) { RemoteOperationResult result = null; // remote request GetRemoteSharesForFileOperation operation = - new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true); + new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), true, true); result = operation.execute(client); if (result.isSuccess()) { @@ -502,7 +524,7 @@ public class RefreshFolderOperation extends RemoteOperation { private void fetchFavoritesToSyncFromLocalData() { - List children = mStorageManager.getFolderContent(mLocalFolder); + List children = mStorageManager.getFolderContent(mLocalFolder, false); for (OCFile child : children) { if (!child.isFolder() && child.isFavorite()) { SynchronizeFileOperation operation = new SynchronizeFileOperation(