Stop nagging for updates if the user presses cancel

This commit is contained in:
Aditya Kulkarni
2019-01-29 15:10:31 -08:00
parent ed9364c0d4
commit 7026a530ff
2 changed files with 11 additions and 1 deletions

View File

@@ -943,8 +943,14 @@ void RPC::checkForUpdate(bool silent) {
}
auto currentVersion = QVersionNumber::fromString(APP_VERSION);
// Get the max version that the user has hidden updates for
QSettings s;
auto maxHiddenVersion = QVersionNumber::fromString(s.value("update/lastversion", "0.0.0").toString());
qDebug() << "Version check: Current " << currentVersion << ", Available " << maxVersion;
if (maxVersion > currentVersion) {
if (maxVersion > currentVersion && maxVersion > maxHiddenVersion) {
auto ans = QMessageBox::information(main, QObject::tr("Update Available"),
QObject::tr("A new release v%1 is available! You have v%2.\n\nWould you like to visit the releases page?")
.arg(maxVersion.toString())
@@ -952,6 +958,9 @@ void RPC::checkForUpdate(bool silent) {
QMessageBox::Yes, QMessageBox::Cancel);
if (ans == QMessageBox::Yes) {
QDesktopServices::openUrl(QUrl("https://github.com/ZcashFoundation/zec-qt-wallet/releases"));
} else {
// If the user selects cancel, don't bother them again for this version
s.setValue("update/lastversion", maxVersion.toString());
}
} else {
if (!silent) {