Fix up uploads menu

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-07-26 20:06:35 +02:00 committed by AndyScherzinger
parent fc3e981fe7
commit d099e7e52f
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 12 additions and 14 deletions

View file

@ -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});
}
}

View file

@ -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>