djmaze 2020-09-23 12:18:36 +02:00
parent 1bb154d6f4
commit 39f39db447

View file

@ -1048,7 +1048,30 @@ class ComposePopupView extends AbstractViewNext {
const downloads = this.getAttachmentsDownloadsForUpload();
if (Array.isNotEmpty(downloads)) {
Remote.messageUploadAttachments(()=>this.onMessageUploadAttachments(), downloads);
Remote.messageUploadAttachments((sResult, oData) => {
if (StorageResultType.Success === sResult && oData && oData.Result) {
Object.entries(oData.Result).forEach(([tempName, id]) => {
const attachment = this.getAttachmentById(id);
if (attachment) {
attachment.tempName(tempName);
attachment
.waiting(false)
.uploading(false)
.complete(true);
}
});
} else {
this.attachments().forEach(attachment => {
if (attachment && attachment.fromMessage) {
attachment
.waiting(false)
.uploading(false)
.complete(true)
.error(getUploadErrorDescByCode(UploadErrorCode.FileNoUploaded));
}
});
}
}, downloads);
}
if (identity) {
@ -1056,25 +1079,6 @@ class ComposePopupView extends AbstractViewNext {
}
}
onMessageUploadAttachments(sResult, oData) {
if (StorageResultType.Success === sResult && oData && oData.Result) {
if (!this.viewModelVisibility()) {
oData.Result.forEach((id, tempName) => {
const attachment = this.getAttachmentById(id);
if (attachment) {
attachment.tempName(tempName);
attachment
.waiting(false)
.uploading(false)
.complete(true);
}
});
}
} else {
this.setMessageAttachmentFailedDownloadText();
}
}
setFocusInPopup() {
if (!bMobileDevice) {
setTimeout(() => {
@ -1404,18 +1408,6 @@ class ComposePopupView extends AbstractViewNext {
}
}
setMessageAttachmentFailedDownloadText() {
this.attachments().forEach(attachment => {
if (attachment && attachment.fromMessage) {
attachment
.waiting(false)
.uploading(false)
.complete(true)
.error(getUploadErrorDescByCode(UploadErrorCode.FileNoUploaded));
}
});
}
/**
* @param {boolean=} includeAttachmentInProgress = true
* @returns {boolean}