mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Make backup jobs cancelable.
This commit is contained in:
@@ -1068,6 +1068,23 @@ class AttachmentTable(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the attachment (and all attachments that share the same data file) with a new length.
|
||||
*/
|
||||
fun updateAttachmentLength(attachmentId: AttachmentId, length: Long) {
|
||||
val dataFile = getDataFileInfo(attachmentId)
|
||||
if (dataFile == null) {
|
||||
Log.w(TAG, "[$attachmentId] Failed to find data file!")
|
||||
return
|
||||
}
|
||||
|
||||
writableDatabase
|
||||
.update(TABLE_NAME)
|
||||
.values(DATA_SIZE to length)
|
||||
.where("$DATA_FILE = ?", dataFile.file.absolutePath)
|
||||
.run()
|
||||
}
|
||||
|
||||
/**
|
||||
* When we find out about a new inbound attachment pointer, we insert a row for it that contains all the info we need to download it via [insertAttachmentWithData].
|
||||
* Later, we download the data for that pointer. Call this method once you have the data to associate it with the attachment. At this point, it is assumed
|
||||
@@ -2804,7 +2821,10 @@ class AttachmentTable(
|
||||
FINISHED(3),
|
||||
|
||||
/** It is impossible to upload this attachment. */
|
||||
PERMANENT_FAILURE(4);
|
||||
PERMANENT_FAILURE(4),
|
||||
|
||||
/** Upload failed, but in a way where it may be worth retrying later. */
|
||||
TEMPORARY_FAILURE(5);
|
||||
|
||||
companion object {
|
||||
fun deserialize(value: Int): ArchiveTransferState {
|
||||
|
||||
Reference in New Issue
Block a user