This commit is contained in:
tobiasKaminsky 2015-10-07 22:35:55 +02:00
parent 25410ff36a
commit 8b3ed70791
3 changed files with 19 additions and 3 deletions

View file

@ -195,10 +195,13 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
&& (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))) { && (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))) {
DbHandler db = new DbHandler(context); DbHandler db = new DbHandler(context);
Cursor c = db.getAwaitingFiles(); Cursor c = db.getAwaitingFiles();
if (c.moveToFirst() && isOnline(context) if (c.moveToFirst()) {
&& (!instantPictureUploadViaWiFiOnly(context) ||
(instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))) {
do { do {
if (instantPictureUploadViaWiFiOnly(context) &&
!isConnectedViaWiFi(context)){
break;
}
String account_name = c.getString(c.getColumnIndex("account")); String account_name = c.getString(c.getColumnIndex("account"));
String file_path = c.getString(c.getColumnIndex("path")); String file_path = c.getString(c.getColumnIndex("path"));
File f = new File(file_path); File f = new File(file_path);

View file

@ -213,6 +213,16 @@ public class FileUploader extends Service
if (intent.hasExtra(KEY_CANCEL_ALL) && intent.hasExtra(KEY_ACCOUNT)){ if (intent.hasExtra(KEY_CANCEL_ALL) && intent.hasExtra(KEY_ACCOUNT)){
Account account = intent.getParcelableExtra(KEY_ACCOUNT); Account account = intent.getParcelableExtra(KEY_ACCOUNT);
Log_OC.d(TAG, "Account= " + account.name);
if (mCurrentUpload != null) {
Log_OC.d(TAG, "Current Upload Account= " + mCurrentUpload.getAccount().name);
if (mCurrentUpload.getAccount().name.equals(account.name)) {
mCurrentUpload.cancel();
}
}
// Cancel pending uploads
cancelUploadForAccount(account.name); cancelUploadForAccount(account.name);
} }

View file

@ -372,6 +372,9 @@ public class UploadFileOperation extends RemoteOperation {
if (temporalFile != null && !originalFile.equals(temporalFile)) { if (temporalFile != null && !originalFile.equals(temporalFile)) {
temporalFile.delete(); temporalFile.delete();
} }
if (result == null){
return new RemoteOperationResult(false, 404, null);
}
if (result.isSuccess()) { if (result.isSuccess()) {
Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " +
result.getLogMessage()); result.getLogMessage());