Revert oversimplified version check

This commit is contained in:
GriffinR 2024-01-21 18:41:23 -05:00
parent fec1d1fdd4
commit 58e4a21aa6
2 changed files with 10 additions and 1 deletions

View file

@ -33,6 +33,7 @@ private:
void resetDialog(); void resetDialog();
void processWebpage(const QJsonDocument &data); void processWebpage(const QJsonDocument &data);
void processError(const QString &err); void processError(const QString &err);
bool isNewerVersion(int major, int minor, int patch);
private slots: private slots:
void dialogButtonClicked(QAbstractButton *button); void dialogButtonClicked(QAbstractButton *button);

View file

@ -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. // 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; foundRelease = true;
if (major <= PORYMAP_VERSION_MAJOR && minor <= PORYMAP_VERSION_MINOR && patch <= PORYMAP_VERSION_PATCH) if (!this->isNewerVersion(major, minor, patch))
break; break;
const QString description = release.value("body").toString(); 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 // The dialog can either be shown programmatically when an update is available
// or if the user manually selects "Check for Updates" in the menu. // 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. // When the dialog is shown programmatically there is a check box to disable automatic alerts.