瀏覽代碼

Disable some parts in code for testing actions in uploads view

masensio 9 年之前
父節點
當前提交
5fb74888c8
共有 1 個文件被更改,包括 36 次插入32 次删除
  1. 36 32
      src/com/owncloud/android/files/services/FileUploadService.java

+ 36 - 32
src/com/owncloud/android/files/services/FileUploadService.java

@@ -578,12 +578,13 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                 //TODO store renamed upload path?
                 updateDatabaseUploadResult(uploadResult, mCurrentUpload);
                 notifyUploadResult(uploadResult, mCurrentUpload);
-                sendFinalBroadcast(uploadResult, mCurrentUpload);                
-                if (!shouldRetryFailedUpload(uploadResult)) {
-                    Log_OC.d(TAG, "Upload with result " + uploadResult.getCode() + ": " + uploadResult.getLogMessage()
-                            + " will be abandoned.");                    
-                    mPendingUploads.remove(buildRemoteName(uploadDbObject));
-                }
+                sendFinalBroadcast(uploadResult, mCurrentUpload);
+                // TODO: Disable for testing of menu actions in uploads view
+//                if (!shouldRetryFailedUpload(uploadResult)) {
+//                    Log_OC.d(TAG, "Upload with result " + uploadResult.getCode() + ": " + uploadResult.getLogMessage()
+//                            + " will be abandoned.");
+//                    mPendingUploads.remove(buildRemoteName(uploadDbObject));
+//                }
                 Log_OC.d(TAG, "mCurrentUpload = null");
                 mCurrentUpload = null;
                 break;
@@ -1288,35 +1289,38 @@ public class FileUploadService extends Service implements OnDatatransferProgress
             if (uploadResult.isSuccess()) {
                 mDb.updateUploadStatus(upload.getOriginalStoragePath(), UploadStatus.UPLOAD_SUCCEEDED, uploadResult);
             } else {
-                if (shouldRetryFailedUpload(uploadResult)) {
-                    mDb.updateUploadStatus(upload.getOriginalStoragePath(), UploadStatus.UPLOAD_FAILED_RETRY, uploadResult);
-                } else {
-                    mDb.updateUploadStatus(upload.getOriginalStoragePath(),
-                            UploadDbHandler.UploadStatus.UPLOAD_FAILED_GIVE_UP, uploadResult);
-                }
+                // TODO: Disable for testing of menu actions in uploads view
+//                if (shouldRetryFailedUpload(uploadResult)) {
+//                    mDb.updateUploadStatus(upload.getOriginalStoragePath(), UploadStatus.UPLOAD_FAILED_RETRY, uploadResult);
+//                } else {
+//                    mDb.updateUploadStatus(upload.getOriginalStoragePath(),
+//                            UploadDbHandler.UploadStatus.UPLOAD_FAILED_GIVE_UP, uploadResult);
+//                }
             }
         }
     }
-    
-    /**
-     * Determines whether with given uploadResult the upload should be retried later.
-     * @param uploadResult
-     * @return true if upload should be retried later, false if is should be abandoned.
-     */
-    private boolean shouldRetryFailedUpload(RemoteOperationResult uploadResult) {
-        if (uploadResult.isSuccess()) {
-            return false;
-        }
-        switch (uploadResult.getCode()) {
-        case HOST_NOT_AVAILABLE:
-        case NO_NETWORK_CONNECTION:
-        case TIMEOUT:
-        case WRONG_CONNECTION: // SocketException
-            return true;
-        default:
-            return false;
-        }
-    }
+
+    // TODO: Disable for testing of menu actions in uploads view
+//
+//    /**
+//     * Determines whether with given uploadResult the upload should be retried later.
+//     * @param uploadResult
+//     * @return true if upload should be retried later, false if is should be abandoned.
+//     */
+//    private boolean shouldRetryFailedUpload(RemoteOperationResult uploadResult) {
+//        if (uploadResult.isSuccess()) {
+//            return false;
+//        }
+//        switch (uploadResult.getCode()) {
+//        case HOST_NOT_AVAILABLE:
+//        case NO_NETWORK_CONNECTION:
+//        case TIMEOUT:
+//        case WRONG_CONNECTION: // SocketException
+//            return true;
+//        default:
+//            return false;
+//        }
+//    }
 
     /**
      * Sends a broadcast in order to the interested activities can update their