mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Fix any potentially stuck thumbnail uploads.
This commit is contained in:
committed by
Michelle Tang
parent
293dcb93d6
commit
6d32e534dc
@@ -1105,6 +1105,17 @@ class AttachmentTable(
|
||||
.run()
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the [ARCHIVE_THUMBNAIL_TRANSFER_STATE] of any attachments that are currently in-progress of uploading.
|
||||
*/
|
||||
fun clearArchiveThumbnailTransferStateForInProgressItems(): Int {
|
||||
return writableDatabase
|
||||
.update(TABLE_NAME)
|
||||
.values(ARCHIVE_THUMBNAIL_TRANSFER_STATE to ArchiveTransferState.NONE.value)
|
||||
.where("$ARCHIVE_THUMBNAIL_TRANSFER_STATE = ?", ArchiveTransferState.UPLOAD_IN_PROGRESS.value)
|
||||
.run()
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks eligible attachments as offloaded based on their received at timestamp, their last restore time,
|
||||
* presence of thumbnail if media, and the full file being available in the archive.
|
||||
@@ -1177,6 +1188,13 @@ class AttachmentTable(
|
||||
.readToSingleLong()
|
||||
}
|
||||
|
||||
fun areAnyThumbnailsPendingUpload(): Boolean {
|
||||
return readableDatabase
|
||||
.exists(TABLE_NAME)
|
||||
.where("$ARCHIVE_THUMBNAIL_TRANSFER_STATE = ?", ArchiveTransferState.UPLOAD_IN_PROGRESS.value)
|
||||
.run()
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the incrementalMac for the specified [attachmentId], as well as any other attachments that share the same ([remoteKey], [plaintextHash]) pair (if present).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user