import com.owncloud.android.lib.operations.common.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.operations.remote.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.operations.remote.RemoveRemoteShareOperation;
-import com.owncloud.android.lib.utils.FileUtils;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.Log_OC;
RemoteOperationResult result = null;
// Get Share for a file
- String path = mRemotePath;
- if (path.endsWith(FileUtils.PATH_SEPARATOR)) {
- path = path.substring(0, path.length()-1); // Remove last /
- }
- OCShare share = getStorageManager().getShareByPath(path);
+ OCShare share = getStorageManager().getShareByPath(mRemotePath);
if (share != null) {
RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getIdRemoteShared());
import java.io.IOException;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import com.owncloud.android.datamodel.FileDataStorageManager;
-import com.owncloud.android.lib.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.network.OwnCloudClientFactory;
import com.owncloud.android.lib.network.OwnCloudClient;
import com.owncloud.android.operations.CreateShareOperation;
public void clearListeners() {
+
mBoundListeners.clear();
}
* @return 'True' when an operation that enforces the user to wait for completion is in process.
*/
public boolean isPerformingBlockingOperation() {
- return (mPendingOperations.size() > 0);
+ return (!mPendingOperations.isEmpty());
}
}
private void onCreateShareOperationFinish(CreateShareOperation operation, RemoteOperationResult result) {
dismissLoadingDialog();
if (result.isSuccess()) {
+ updateFileFromDB();
+
Intent sendIntent = operation.getSendIntent();
startActivity(sendIntent);
private void onUnshareLinkOperationFinish(UnshareLinkOperation operation, RemoteOperationResult result) {
dismissLoadingDialog();
- if (result.getCode() == ResultCode.SHARE_NOT_FOUND) { // Error --> SHARE_NOT_FOUND
+ if (result.isSuccess()){
+ updateFileFromDB();
+
+ } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) { // Error --> SHARE_NOT_FOUND
Toast t = Toast.makeText(this, getString(R.string.unshare_link_file_no_exist), Toast.LENGTH_LONG);
t.show();
- } else if (!result.isSuccess()){ // Generic error
+ } else { // Generic error
// Show a Message, operation finished without success
Toast t = Toast.makeText(this, getString(R.string.unshare_link_file_error), Toast.LENGTH_LONG);
t.show();
}
+
+ private void updateFileFromDB(){
+ OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
+ if (file != null) {
+ setFile(file);
+ }
+ }
+
/**
* Show loading dialog
*/
private void onCreateShareOperationFinish(CreateShareOperation operation, RemoteOperationResult result) {
if (result.isSuccess()) {
- OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
- if (file != null) {
- setFile(file);
- }
refreshShowDetails();
refeshListOfFilesFragment();
}
private void onUnshareLinkOperationFinish(UnshareLinkOperation operation, RemoteOperationResult result) {
if (result.isSuccess()) {
- OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
- if (file != null) {
- setFile(file);
- }
refreshShowDetails();
refeshListOfFilesFragment();
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {