X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/38a80be828c9b10166df586e2c77d357030477a9..3f2081e6073bd0c11d672890f350da80abc554b2:/src/com/owncloud/android/files/services/FileUploader.java diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index 87dc1775..1847a960 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -199,6 +199,13 @@ public class FileUploader extends Service implements OnDatatransferProgressListe FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver()); + boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false); + boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false); + boolean fixed = false; + if (isInstant) { + fixed = checkAndFixInstantUploadDirectory(storageManager); // MUST be done BEFORE calling obtainNewOCFileToUpload + } + if (intent.hasExtra(KEY_FILE) && files == null) { Log.e(TAG, "Incorrect array for OCFiles provided in upload intent"); return Service.START_NOT_STICKY; @@ -223,18 +230,11 @@ public class FileUploader extends Service implements OnDatatransferProgressListe } } - boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false); - boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false); - OwnCloudVersion ocv = new OwnCloudVersion(AccountManager.get(this).getUserData(account, AccountAuthenticator.KEY_OC_VERSION)); boolean chunked = FileUploader.chunkedUploadIsSupported(ocv); AbstractList requestedUploads = new Vector(); String uploadKey = null; UploadFileOperation newUpload = null; - boolean fixed = false; - if (isInstant) { - fixed = checkAndFixInstantUploadDirectory(storageManager); - } try { for (int i=0; i < files.length; i++) { uploadKey = buildRemoteName(account, files[i].getRemotePath()); @@ -521,6 +521,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe if (localPath != null && localPath.length() > 0) { File localFile = new File(localPath); newFile.setFileLength(localFile.length()); + newFile.setLastSyncDateForData(localFile.lastModified()); } // don't worry about not assigning size, the problems with localPath are checked when the UploadFileOperation instance is created // MIME type @@ -682,7 +683,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe end.putExtra(ACCOUNT_NAME, upload.getAccount().name); end.putExtra(EXTRA_UPLOAD_RESULT, uploadResult.isSuccess()); end.putExtra(EXTRA_PARENT_DIR_ID, upload.getFile().getParentId()); - sendBroadcast(end); + sendStickyBroadcast(end); }