Skip to content

Commit

Permalink
Merge pull request #20025 from mathesoncalum/20024-audiocom_only_publish
Browse files Browse the repository at this point in the history
Fix #20024: Only start the "also share on Audio.com" flow after publishing (not save to cloud).
  • Loading branch information
RomanPudashkin committed Nov 15, 2023
2 parents e31e689 + 5367695 commit 16fc08d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/project/internal/projectactionscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,11 +1174,11 @@ Ret ProjectActionsController::uploadProject(const CloudProjectInfo& info, const
}

if (audio.isValid()) {
uploadAudio(audio, newSourceUrl, editUrl, isFirstSave);
uploadAudio(audio, newSourceUrl, editUrl, isFirstSave, publishMode);
} else {
onProjectSuccessfullyUploaded(editUrl, isFirstSave);

if (configuration()->alsoShareAudioCom() || configuration()->showAlsoShareAudioComDialog()) {
if (publishMode && (configuration()->alsoShareAudioCom() || configuration()->showAlsoShareAudioComDialog())) {
alsoShareAudioCom(audio);
}
}
Expand All @@ -1189,7 +1189,8 @@ Ret ProjectActionsController::uploadProject(const CloudProjectInfo& info, const
return ret;
}

void ProjectActionsController::uploadAudio(const AudioFile& audio, const QUrl& sourceUrl, const QUrl& urlToOpen, bool isFirstSave)
void ProjectActionsController::uploadAudio(const AudioFile& audio, const QUrl& sourceUrl, const QUrl& urlToOpen, bool isFirstSave,
bool publishMode)
{
m_uploadingAudioProgress = museScoreComService()->uploadAudio(*audio.device, audio.format, sourceUrl);

Expand All @@ -1203,7 +1204,7 @@ void ProjectActionsController::uploadAudio(const AudioFile& audio, const QUrl& s
}
});

m_uploadingAudioProgress->finished.onReceive(this, [this, audio, urlToOpen, isFirstSave](const ProgressResult& res) {
m_uploadingAudioProgress->finished.onReceive(this, [this, audio, urlToOpen, isFirstSave, publishMode](const ProgressResult& res) {
LOGD() << "Uploading audio finished";

if (!res.ret) {
Expand All @@ -1212,7 +1213,7 @@ void ProjectActionsController::uploadAudio(const AudioFile& audio, const QUrl& s

onProjectSuccessfullyUploaded(urlToOpen, isFirstSave);

if (configuration()->alsoShareAudioCom() || configuration()->showAlsoShareAudioComDialog()) {
if (publishMode && (configuration()->alsoShareAudioCom() || configuration()->showAlsoShareAudioComDialog())) {
alsoShareAudioCom(audio);
}

Expand Down
2 changes: 1 addition & 1 deletion src/project/internal/projectactionscontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ProjectActionsController : public IProjectFilesController, public QObject,
void closeUploadProgressDialog();

Ret uploadProject(const CloudProjectInfo& info, const AudioFile& audio, bool openEditUrl, bool publishMode);
void uploadAudio(const AudioFile& audio, const QUrl& sourceUrl, const QUrl& urlToOpen, bool isFirstSave);
void uploadAudio(const AudioFile& audio, const QUrl& sourceUrl, const QUrl& urlToOpen, bool isFirstSave, bool publishMode);

void onProjectSuccessfullyUploaded(const QUrl& urlToOpen = QUrl(), bool isFirstSave = true);
Ret onProjectUploadFailed(const Ret& ret, const CloudProjectInfo& info, const AudioFile& audio, bool openEditUrl, bool publishMode);
Expand Down

0 comments on commit 16fc08d

Please sign in to comment.