public static final String EXTRA_PARENT_DIR_ID = "PARENT_DIR_ID";
public static final String EXTRA_UPLOAD_RESULT = "RESULT";
public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";
+ public static final String EXTRA_OLD_REMOTE_PATH = "OLD_REMOTE_PATH";
public static final String EXTRA_FILE_PATH = "FILE_PATH";
public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
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;
}
}
- 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<String> requestedUploads = new Vector<String>();
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());
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
private void sendFinalBroadcast(UploadFileOperation upload, RemoteOperationResult uploadResult) {
Intent end = new Intent(UPLOAD_FINISH_MESSAGE);
end.putExtra(EXTRA_REMOTE_PATH, upload.getRemotePath()); // real remote path, after possible automatic renaming
+ if (upload.wasRenamed()) {
+ end.putExtra(EXTRA_OLD_REMOTE_PATH, upload.getOldFile().getRemotePath());
+ }
end.putExtra(EXTRA_FILE_PATH, upload.getStoragePath());
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);
}