import android.os.Looper;
import android.os.Message;
import android.os.Process;
-import android.util.Log;
import android.webkit.MimeTypeMap;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.owncloud.android.ui.fragment.FileDetailFragment;
import com.owncloud.android.ui.preview.PreviewImageActivity;
import com.owncloud.android.ui.preview.PreviewImageFragment;
+import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.OwnCloudVersion;
import eu.alefzero.webdav.OnDatatransferProgressListener;
// / create remote folder for instant uploads
if (mCurrentUpload.isRemoteFolderToBeCreated()) {
- mUploadClient.createDirectory(InstantUploadService.INSTANT_UPLOAD_DIR);
+ mUploadClient.createDirectory(FileStorageUtils.getInstantUploadFilePath(this, ""));
// ignoring result fail could just mean that it already exists,
// but local database is not synchronized the upload will be
// tried anyway
}
private boolean checkAndFixInstantUploadDirectory(FileDataStorageManager storageManager) {
- OCFile instantUploadDir = storageManager.getFileByPath(InstantUploadService.INSTANT_UPLOAD_DIR);
+ String instantUploadDirPath = FileStorageUtils.getInstantUploadFilePath(this, "");
+ OCFile instantUploadDir = storageManager.getFileByPath(instantUploadDirPath);
if (instantUploadDir == null) {
// first instant upload in the account. never account not
// synchronized after the remote InstantUpload folder was created
- OCFile newDir = new OCFile(InstantUploadService.INSTANT_UPLOAD_DIR);
+ OCFile newDir = new OCFile(instantUploadDirPath);
newDir.setMimetype("DIR");
OCFile path = storageManager.getFileByPath(OCFile.PATH_SEPARATOR);
newDir.setParentId(path.getFileId());
storageManager.saveFile(newDir);
return true;
- } else {
+ } else { // this should not happen anymore
return false;
}
String parentPath = new File(remotePath).getParent();
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath : parentPath + OCFile.PATH_SEPARATOR;
OCFile parentDir = storageManager.getFileByPath(parentPath);
- if (parentDir == null) {
- Toast t = Toast
- .makeText(
- getApplicationContext(),
- "The first time the InstantUpload is running you must be online, so the target folder can successfully created by the upload process",
- 30);
- t.show();
- return null;
- }
long parentDirId = parentDir.getFileId();
newFile.setParentId(parentDirId);
return newFile;