Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attachments not uploaded immediately when hitting the synchronize button #5796

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/core/qfieldcloudprojectsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ void QFieldCloudProjectsModel::projectUpload( const QString &projectId, const bo
QgsMessageLog::logMessage( QStringLiteral( "Failed to reset delta file after delta push. %1" ).arg( deltaFileWrapper->errorString() ) );

emit dataChanged( projectIndex, projectIndex, QVector<int>() << StatusRole << ModificationRole << LastLocalPushDeltasRole );
emit pushFinished( projectId, false );
emit pushFinished( projectId, false, false );
projectRefreshData( projectId, ProjectRefreshReason::DeltaUploaded );
}
} );
Expand Down Expand Up @@ -1500,12 +1500,13 @@ void QFieldCloudProjectsModel::projectUpload( const QString &projectId, const bo
// download the updated files, so the files are for sure the same on the client and on the server
if ( shouldDownloadUpdates )
{
emit pushFinished( projectId, true, false );
projectPackageAndDownload( projectId );
}
else
{
emit dataChanged( projectIndex, projectIndex, QVector<int>() << StatusRole );
emit pushFinished( projectId, false );
emit pushFinished( projectId, false, false );
projectRefreshData( projectId, ProjectRefreshReason::DeltaUploaded );
}
}
Expand Down Expand Up @@ -1649,7 +1650,7 @@ void QFieldCloudProjectsModel::projectCancelUpload( const QString &projectId )
project->errorStatus = UploadErrorStatus;

emit dataChanged( projectIndex, projectIndex, QVector<int>() << StatusRole << ErrorStatusRole );
emit pushFinished( projectId, true, project->deltaFileUploadStatusString );
emit pushFinished( projectId, false, true, project->deltaFileUploadStatusString );

return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qfieldcloudprojectsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class QFieldCloudProjectsModel : public QAbstractListModel
void networkAllAttachmentsUploaded( const QString &projectId );
void networkLayerDownloaded( const QString &projectId );
void networkAllLayersDownloaded( const QString &projectId );
void pushFinished( const QString &projectId, bool hasError, const QString &errorString = QString() );
void pushFinished( const QString &projectId, bool isDownloadingProject, bool hasError, const QString &errorString = QString() );

private slots:
void connectionStatusChanged();
Expand Down
6 changes: 4 additions & 2 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3736,12 +3736,14 @@ ApplicationWindow {
return hasError ? displayToast(qsTr("Project %1 failed to download").arg(projectName), 'error') : displayToast(qsTr("Project %1 successfully downloaded, it's now available to open").arg(projectName));
}

onPushFinished: function (projectId, hasError, errorString) {
onPushFinished: function (projectId, isDownloadingProject, hasError, errorString) {
if (hasError) {
displayToast(qsTr("Changes failed to reach QFieldCloud: %1").arg(errorString), 'error');
return;
}
displayToast(qsTr("Changes successfully pushed to QFieldCloud"));
if (!isDownloadingProject) {
displayToast(qsTr("Changes successfully pushed to QFieldCloud"));
}
if (QFieldCloudUtils.hasPendingAttachments()) {
// Go ahead and upload pending attachments in the background
platformUtilities.uploadPendingAttachments(cloudConnection);
Expand Down
Loading