From 58e4a21aa6fe68b49438812a5a1df0dd02616850 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 21 Jan 2024 18:41:23 -0500 Subject: [PATCH] Revert oversimplified version check --- include/ui/updatepromoter.h | 1 + src/ui/updatepromoter.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/ui/updatepromoter.h b/include/ui/updatepromoter.h index 4b0f209d..b9129156 100644 --- a/include/ui/updatepromoter.h +++ b/include/ui/updatepromoter.h @@ -33,6 +33,7 @@ private: void resetDialog(); void processWebpage(const QJsonDocument &data); void processError(const QString &err); + bool isNewerVersion(int major, int minor, int patch); private slots: void dialogButtonClicked(QAbstractButton *button); diff --git a/src/ui/updatepromoter.cpp b/src/ui/updatepromoter.cpp index 5d91d271..f8270b4e 100644 --- a/src/ui/updatepromoter.cpp +++ b/src/ui/updatepromoter.cpp @@ -90,7 +90,7 @@ void UpdatePromoter::processWebpage(const QJsonDocument &data) { // We've found a valid release tag. If the version number is not newer than the host version then we can stop looking at releases. foundRelease = true; - if (major <= PORYMAP_VERSION_MAJOR && minor <= PORYMAP_VERSION_MINOR && patch <= PORYMAP_VERSION_PATCH) + if (!this->isNewerVersion(major, minor, patch)) break; const QString description = release.value("body").toString(); @@ -142,6 +142,14 @@ void UpdatePromoter::processError(const QString &err) { } } +bool UpdatePromoter::isNewerVersion(int major, int minor, int patch) { + if (major != PORYMAP_VERSION_MAJOR) + return major > PORYMAP_VERSION_MAJOR; + if (minor != PORYMAP_VERSION_MINOR) + return minor > PORYMAP_VERSION_MINOR; + return patch > PORYMAP_VERSION_PATCH; +} + // The dialog can either be shown programmatically when an update is available // or if the user manually selects "Check for Updates" in the menu. // When the dialog is shown programmatically there is a check box to disable automatic alerts.