Search in sources :

Example 1 with ShareResponse

use of com.owncloud.android.lib.resources.shares.ShareResponse in project android by owncloud.

the class RefreshFolderOperation method updateShareIconsInFiles.

private void updateShareIconsInFiles(OwnCloudClient client) {
    RemoteOperationResult<ShareResponse> result;
    // remote request
    GetRemoteSharesForFileOperation operation = new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), true, true);
    result = operation.execute(client);
    if (result.isSuccess()) {
        resetShareFlagsInFolderChilds();
        for (RemoteShare remoteShare : result.getData().getShares()) {
            OCFile file = getStorageManager().getFileByPath(remoteShare.getPath());
            if (file != null) {
                ShareType shareType = ShareType.Companion.fromValue(remoteShare.getShareType().getValue());
                if (shareType.equals(ShareType.PUBLIC_LINK)) {
                    file.setSharedViaLink(true);
                } else if (shareType.equals(ShareType.USER) || shareType.equals(ShareType.FEDERATED) || shareType.equals(ShareType.GROUP)) {
                    file.setSharedWithSharee(true);
                }
                getStorageManager().saveFile(file);
            }
        }
    }
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) ShareResponse(com.owncloud.android.lib.resources.shares.ShareResponse) RemoteShare(com.owncloud.android.lib.resources.shares.RemoteShare) GetRemoteSharesForFileOperation(com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation) ShareType(com.owncloud.android.domain.sharing.shares.model.ShareType)

Aggregations

OCFile (com.owncloud.android.datamodel.OCFile)1 ShareType (com.owncloud.android.domain.sharing.shares.model.ShareType)1 GetRemoteSharesForFileOperation (com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation)1 RemoteShare (com.owncloud.android.lib.resources.shares.RemoteShare)1 ShareResponse (com.owncloud.android.lib.resources.shares.ShareResponse)1