Эх сурвалжийг харах

Fix up uploads menu

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 жил өмнө
parent
commit
d099e7e52f

+ 10 - 12
src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java

@@ -458,11 +458,15 @@ public class UploadsStorageManager extends Observable {
     }
 
     public long clearSuccessfulUploads() {
+        Account account = AccountUtils.getCurrentOwnCloudAccount(mContext);
 
         long result = getDB().delete(
                 ProviderTableMeta.CONTENT_URI_UPLOADS,
-                ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value, null
+                ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value  + AND +
+                ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", new String[]{account.name}
+
         );
+
         Log_OC.d(TAG, "delete all successful uploads");
         if (result > 0) {
             notifyObserversNow();
@@ -471,16 +475,19 @@ public class UploadsStorageManager extends Observable {
     }
 
     public long clearAllFinishedButNotDelayedUploads() {
+        Account account = AccountUtils.getCurrentOwnCloudAccount(mContext);
 
-        String[] whereArgs = new String[2];
+        String[] whereArgs = new String[3];
         whereArgs[0] = String.valueOf(UploadStatus.UPLOAD_SUCCEEDED.value);
         whereArgs[1] = String.valueOf(UploadStatus.UPLOAD_FAILED.value);
+        whereArgs[2] = account.name;
         long result = getDB().delete(
                 ProviderTableMeta.CONTENT_URI_UPLOADS,
                 ProviderTableMeta.UPLOADS_STATUS + "=? OR " + ProviderTableMeta.UPLOADS_STATUS + "=? AND " +
                         ProviderTableMeta.UPLOADS_LAST_RESULT + "<>" + UploadResult.LOCK_FAILED.getValue() + AND +
                         ProviderTableMeta.UPLOADS_LAST_RESULT + "<>" + UploadResult.DELAYED_FOR_WIFI.getValue() + AND +
-                        ProviderTableMeta.UPLOADS_LAST_RESULT + "<>" + UploadResult.DELAYED_FOR_CHARGING.getValue(),
+                        ProviderTableMeta.UPLOADS_LAST_RESULT + "<>" + UploadResult.DELAYED_FOR_CHARGING.getValue() + AND +
+                        ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
                 whereArgs
         );
         Log_OC.d(TAG, "delete all finished uploads");
@@ -575,13 +582,4 @@ public class UploadsStorageManager extends Observable {
         }
         return result;
     }
-
-    public int removeAccountUploads(Account account) {
-        Log_OC.v(TAG, "Delete all uploads for account " + account.name);
-        return getDB().delete(
-                ProviderTableMeta.CONTENT_URI_UPLOADS,
-                ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=?",
-                new String[]{account.name});
-    }
-
 }

+ 2 - 2
src/main/res/values/strings.xml

@@ -539,8 +539,8 @@
     <string name="edit_share_unshare">Stop sharing</string>
     <string name="edit_share_done">done</string>
 
-    <string name="action_retry_uploads">New attempt failed</string>
-    <string name="action_clear_failed_uploads">Clear failed</string>
+    <string name="action_retry_uploads">Retry failed uploads</string>
+    <string name="action_clear_failed_uploads">Clear failed uploads</string>
     <string name="action_clear_successful_uploads">Clear successful uploads</string>
     <string name="action_clear_finished_uploads">Clear finished uploads</string>