Skip to content

Commit 82c2fdb

Browse files
Upload all unfinished Attachments
1 parent 991b8ce commit 82c2fdb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/infomaniak/mail/utils/DraftUtils.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ suspend fun uploadAttachmentsWithMutex(
4747

4848
private suspend fun Draft.uploadAttachments(mailbox: Mailbox, draftController: DraftController, realm: Realm) {
4949

50-
fun getAwaitingAttachments(): List<Attachment> = attachments.filter { it.uploadStatus == UploadStatus.AWAITING }
50+
fun getUnfinishedAttachments(): List<Attachment> = attachments.filterNot { it.uploadStatus == UploadStatus.FINISHED }
5151

5252
fun setUploadStatus(attachment: Attachment, uploadStatus: UploadStatus, step: String) {
5353
realm.writeBlocking {
@@ -57,7 +57,7 @@ private suspend fun Draft.uploadAttachments(mailbox: Mailbox, draftController: D
5757
}
5858
}
5959

60-
val attachmentsToUpload = getAwaitingAttachments()
60+
val attachmentsToUpload = getUnfinishedAttachments()
6161
val attachmentsToUploadCount = attachmentsToUpload.count()
6262
if (attachmentsToUploadCount > 0) {
6363
SentryLog.d(ATTACHMENT_TAG, "Uploading $attachmentsToUploadCount attachments")

0 commit comments

Comments
 (0)