import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.operations.CopyFileOperation;
import com.owncloud.android.operations.CreateFolderOperation;
-import com.owncloud.android.operations.CreateShareOperation;
+import com.owncloud.android.operations.CreateShareViaLinkOperation;
+import com.owncloud.android.operations.CreateShareWithShareeOperation;
import com.owncloud.android.operations.DownloadFileOperation;
import com.owncloud.android.operations.MoveFileOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation;
import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.operations.SynchronizeFolderOperation;
-import com.owncloud.android.operations.UnshareLinkOperation;
+import com.owncloud.android.operations.UnshareOperation;
import com.owncloud.android.operations.UploadFileOperation;
import org.apache.commons.httpclient.ConnectTimeoutException;
} else {
message = res.getString(R.string.create_dir_fail_msg);
}
- } else if (operation instanceof CreateShareOperation) {
- if (result.getCode() == ResultCode.SHARE_NOT_FOUND) { // Error --> SHARE_NOT_FOUND
+ } else if (operation instanceof CreateShareViaLinkOperation ||
+ operation instanceof CreateShareWithShareeOperation) {
+
+ if (result.getData() != null && result.getData().size() > 0) {
+ message = (String) result.getData().get(0); // share API sends its own error messages
+
+ } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
message = res.getString(R.string.share_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
message = res.getString(R.string.share_link_file_error);
}
- } else if (operation instanceof UnshareLinkOperation) {
+ } else if (operation instanceof UnshareOperation) {
+
+ if (result.getData() != null && result.getData().size() > 0) {
+ message = (String) result.getData().get(0); // share API sends its own error messages
- if (result.getCode() == ResultCode.SHARE_NOT_FOUND) { // Error --> SHARE_NOT_FOUND
+ } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
message = res.getString(R.string.unshare_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
}
} else if (operation instanceof MoveFileOperation) {
- if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
+ if(isNetworkError(result.getCode())){
+ message = getErrorMessage(result, res);
+ } else if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = res.getString(R.string.move_file_not_found);
-
} else if (result.getCode() == ResultCode.INVALID_MOVE_INTO_DESCENDANT) {
message = res.getString(R.string.move_file_invalid_into_descendent);
} else { // Generic error
// Show a Message, operation finished without success
- message = String.format(res.getString(R.string.download_folder_failed_content),
+ message = String.format(res.getString(R.string.sync_folder_failed_content),
folderPathName);
}
}
} else if (operation instanceof CopyFileOperation) {
-
- if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
+ if(isNetworkError(result.getCode())){
+ message = getErrorMessage(result, res);
+ } else if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = res.getString(R.string.copy_file_not_found);
-
- } else if (result.getCode() == ResultCode.INVALID_MOVE_INTO_DESCENDANT) {
+ } else if (result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT) {
message = res.getString(R.string.copy_file_invalid_into_descendent);
} else if (result.getCode() == ResultCode.INVALID_OVERWRITE) {