Reset exits counter when the version is updated

This commit is contained in:
David Capello 2017-10-05 18:01:38 -03:00
parent babe23adc8
commit 6611a5ec73
2 changed files with 9 additions and 4 deletions

View File

@ -173,6 +173,7 @@
<option id="wait_days" type="double" default="0.0" migrate="Updater.WaitDays" />
<option id="last_check" type="int" default="0" migrate="Updater.LastCheck" />
<option id="uuid" type="std::string" migrate="Updater.Uuid" />
<option id="current_version" type="std::string" />
<option id="new_version" type="std::string" />
<option id="new_url" type="std::string" />
</section>

View File

@ -202,15 +202,13 @@ void CheckUpdateThreadLauncher::checkForUpdates()
void CheckUpdateThreadLauncher::showUI()
{
std::string localVersionStr = VERSION;
base::replace_string(localVersionStr, "-x64", "");
bool newVer = false;
if (!m_preferences.updater.newVersion().empty()) {
base::Version serverVersion(m_preferences.updater.newVersion());
std::string localVersionStr = VERSION;
base::replace_string(localVersionStr, "-x64", "");
base::Version localVersion(localVersionStr);
newVer = (localVersion < serverVersion);
}
@ -219,6 +217,12 @@ void CheckUpdateThreadLauncher::showUI()
m_preferences.updater.newVersion());
}
else {
// If the program was updated, reset the "exits" counter
if (m_preferences.updater.currentVersion() != localVersionStr) {
m_preferences.updater.currentVersion(localVersionStr);
m_exits = m_inits;
}
m_delegate->onUpToDate();
}
}