mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Remove unique upload by his ID when it already exists in current ones
This commit is contained in:
parent
cbf619be77
commit
467071321f
2 changed files with 20 additions and 1 deletions
|
@ -326,6 +326,25 @@ public class UploadsStorageManager extends Observable {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a specific upload given his unique ID.
|
||||
*
|
||||
* @param uploadId unique ID of the upload.
|
||||
* @return true when the upload entry was removed
|
||||
*/
|
||||
public int removeUpload(long uploadId) {
|
||||
int result = getDB().delete(
|
||||
ProviderTableMeta.CONTENT_URI_UPLOADS,
|
||||
ProviderTableMeta._ID + "=?",
|
||||
new String[]{String.valueOf(uploadId)}
|
||||
);
|
||||
Log_OC.d(TAG, "delete returns " + result + " for upload with ID " + uploadId);
|
||||
if (result > 0) {
|
||||
notifyObserversNow();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public OCUpload[] getAllStoredUploads() {
|
||||
return getUploads(null, null);
|
||||
|
|
|
@ -525,7 +525,7 @@ public class FileUploader extends Service
|
|||
uploadKey = putResult.first;
|
||||
requestedUploads.add(uploadKey);
|
||||
} else {
|
||||
mUploadsStorageManager.removeUpload(account.name, files[i].getRemotePath());
|
||||
mUploadsStorageManager.removeUpload(newUpload.getOCUploadId());
|
||||
}
|
||||
// else, file already in the queue of uploads; don't repeat the request
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue